Skip to content

Commit

Permalink
convert rest of testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Sep 20, 2016
1 parent 07bb3fe commit a8b9f13
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 60 deletions.
38 changes: 36 additions & 2 deletions test/ftpserver_test.rb
Expand Up @@ -4,6 +4,16 @@

require "yast"

# stub module to prevent its Import
# Useful for modules from different yast packages, to avoid build dependencies
def stub_module(name)
Yast.const_set name.to_sym, Class.new { def self.fake_method; end }
end

stub_module("Users")



Yast.import "FtpServer"

VS_CONFIG_PATH = Yast::Path.new(".vsftpd")
Expand Down Expand Up @@ -68,8 +78,32 @@ def mock_config(config_path, map)

describe "Yast::FtpServer" do
describe ".Modified" do
it "returns false if no modification happens"
expect(Yast::FtpServer.ValueUI("VerboseLogging", false)).to eq false
it "returns false if no modification happens" do
expect(Yast::FtpServer.Modified).to eq false
end
end

describe ".GetPassivePortRangeBoundaries" do
it "can read boundaries when separated by colon" do
Yast::FtpServer.PURE_SETTINGS = { "PassivePortRange" => "1024:4201" }

expected_boundaries = ["1024", "4201"]

expect(Yast::FtpServer.GetPassivePortRangeBoundaries).to eq expected_boundaries
end

it "can read boundaries when separated by whitespace" do
Yast::FtpServer.PURE_SETTINGS = { "PassivePortRange" => "1024 \t 4201" }

expected_boundaries = ["1024", "4201"]

expect(Yast::FtpServer.GetPassivePortRangeBoundaries).to eq expected_boundaries
end

it "returns nil if boundaries is spearated by invalid delimeter" do
Yast::FtpServer.PURE_SETTINGS = { "PassivePortRange" => "1024::4201" }

expect(Yast::FtpServer.GetPassivePortRangeBoundaries).to eq nil
end
end

Expand Down
21 changes: 0 additions & 21 deletions testsuite/Makefile.am

This file was deleted.

Empty file.
Empty file.
37 changes: 0 additions & 37 deletions testsuite/tests/PassivePortRange.rb

This file was deleted.

0 comments on commit a8b9f13

Please sign in to comment.