Sha256: ee1f89010eab0369a259f0e677f7cd63d9e77cd351525ca7bfbaf27253087910
Contents?: true
Size: 788 Bytes
Versions: 2
Compression:
Stored size: 788 Bytes
Contents
require 'spec_helper' describe "contain" do context "when the file exists" do let(:contents) { "This file\ncontains\nthis text" } let(:mock_file) { mock(:read=>contents) } subject { '/some/file/path' } before do File.stub(:new).with('/some/file/path').and_return(mock_file) end it { should contain "This file\ncontains\nthis text" } it { should contain /This file/ } it { should contain /this text/ } it { should_not contain /something not there/ } 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' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ammeter-0.1.1 | spec/ammeter/rspec/rails/generator/matchers/contain_spec.rb |
ammeter-0.1.0 | spec/ammeter/rspec/rails/generator/matchers/contain_spec.rb |