Skip to content

Commit

Permalink
Updated testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf committed Apr 24, 2014
1 parent 63c8627 commit bb12e76
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ TESTS = \
new_device_startmode_test.rb \
widgets_test.rb \
install_inf_convertor_test.rb \
lan_items_helpers_test.rb
lan_items_helpers_test.rb \
link_handlers_test.rb

TEST_EXTENSIONS = .rb
RB_LOG_COMPILER = rspec
Expand Down
21 changes: 21 additions & 0 deletions test/link_handlers_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env rspec

ENV["Y2DIR"] = File.expand_path("../../src", __FILE__)

require "yast"

describe "phy_connected?" do
before(:each) do
Yast.include self, "network/routines.rb"
end

it "returns true if PHY layer is available" do
Yast::SCR.stub(:Read).with(path(".target.string"), /\/sys\/class\/net/) { 1 }
expect(phy_connected?("enp0s3")).to eql true
end

it "returns false if PHY layer is available" do
Yast::SCR.stub(:Read).with(path(".target.string"), /\/sys\/class\/net/) { 0 }
expect(phy_connected?("enp0s3")).to eql false
end
end

0 comments on commit bb12e76

Please sign in to comment.