spec/ammeter/rspec/generator/matchers/contain_spec.rb in ammeter-0.2.9 vs spec/ammeter/rspec/generator/matchers/contain_spec.rb in ammeter-1.0.0
- old
+ new
@@ -5,25 +5,25 @@
context "when the file exists" do
let(:contents) { "This file\ncontains\nthis text" }
subject { '/some/file/path' }
before do
- File.stub(:read).with('/some/file/path').and_return(contents)
+ allow(File).to receive(:read).with('/some/file/path').and_return(contents)
end
- it { should contain "This file\ncontains\nthis text" }
- it { should contain "This file" }
- it { should contain "this text" }
- it { should contain /This file/ }
- it { should contain /this text/ }
- it { should contain "contains", /this text/ }
- it { should_not contain /something not there/ }
- it { should_not contain /this isn't at the contents/, /neither is this/ }
+ it { is_expected.to contain "This file\ncontains\nthis text" }
+ it { is_expected.to contain "This file" }
+ it { is_expected.to contain "this text" }
+ it { is_expected.to contain /This file/ }
+ it { is_expected.to contain /this text/ }
+ it { is_expected.to contain "contains", /this text/ }
+ it { is_expected.to_not contain /something not there/ }
+ it { is_expected.to_not contain /this isn't at the contents/, /neither is this/ }
end
context "when the file is not there" do
it 'raises an error when the file does not exist' do
expect do
- 'some/file/that/does/not/exist'.should contain 'something'
- end.to raise_error 'No such file or directory - some/file/that/does/not/exist'
+ expect('some/file/that/does/not/exist').to contain 'something'
+ end.to raise_error /No such file or directory/
end
end
end