Skip to content

Commit

Permalink
Some improvements in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed Jan 19, 2016
1 parent 409b95a commit fa7c3b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions test/lib/users/local_password_test.rb
Expand Up @@ -43,6 +43,17 @@
end

describe "#errors" do
before do
allow(Yast::UsersSimple).to receive(:LoadCracklib).and_return true
allow(Yast::UsersSimple).to receive(:UnLoadCracklib)
end

it "disables cracklib if it couldn't be loaded" do
allow(Yast::UsersSimple).to receive(:LoadCracklib).and_return false
expect(Yast::UsersSimple).to receive(:UseCrackLib).with false
Users::LocalPassword.new(username: "irrelevant").errors
end

context "when checking the root password" do
subject { Users::LocalPassword.new(username: "root") }

Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Expand Up @@ -30,7 +30,7 @@
end

# for coverage we need to load all ruby files
Dir["#{src_path}/{module,lib}/**/*.rb"].each { |f| require_relative f }
Dir["#{src_path}/{modules,lib}/**/*.rb"].each { |f| require_relative f }

# use coveralls for on-line code coverage reporting at Travis CI
if ENV["TRAVIS"]
Expand Down

0 comments on commit fa7c3b6

Please sign in to comment.