Skip to content

Commit

Permalink
improved contain matcher for strings to be "contain" (it was checking…
Browse files Browse the repository at this point in the history
… equals)
  • Loading branch information
alexrothenberg committed Sep 30, 2011
1 parent 3dbaf42 commit 48e278f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ammeter/rspec/generator/matchers/contain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@actual_contents = File.new(file_path).read
case expected_content
when String
@actual_contents == expected_content
@actual_contents.include? expected_content
when Regexp
@actual_contents =~ expected_content
end
Expand Down
2 changes: 2 additions & 0 deletions spec/ammeter/rspec/generator/matchers/contain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
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 contain /This file/ }
it { should contain /this text/ }
it { should_not contain /something not there/ }
Expand Down

0 comments on commit 48e278f

Please sign in to comment.