Skip to content

Commit

Permalink
rspec improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
faxm0dem committed Feb 19, 2020
1 parent b2ba927 commit a368e9a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions spec/types/cpan_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
end
end
it 'rejects other values' do
expect { described_type.new(name: 'test', ensure: 'foo') }.to raise_error(Puppet::Error)
expect { is_expected.to be_valid_type.with_set_attributes(ensure: 'foo') }.to raise_error(Puppet::ResourceError)
end
end

Expand All @@ -41,9 +41,7 @@
end
end
it 'rejects other values' do
# for some reason expect { be_valid_type.with_set_attributes({:force => 'nope'})}.to raise_error doesn't raise
# expect {be_valid_type.with_set_attributes({:force => 'nope'})}.to raise_error(Puppet::ResourceError)
expect { described_type.new(name: 'test', force: 'nope') }.to raise_error(Puppet::Error)
expect { is_expected.to be_valid_type.with_set_attributes(force: 'nope') }.to raise_error(Puppet::ResourceError)
end
it 'defaults to false' do
expect(described_type.new(name: 'test')[:force]).to eq(false)
Expand All @@ -67,7 +65,7 @@
describe 'invalid values' do
[true, false, 220, '0', '888', 'invalid'].each do |value|
it "rejects #{value}" do
expect { described_type.new(name: 'test', umask: value) }.to raise_error(Puppet::Error)
expect { is_expected.to be_valid_type.with_set_attributes(umask: value) }.to raise_error(Puppet::ResourceError)
end
end
end
Expand Down

0 comments on commit a368e9a

Please sign in to comment.