Commit deaa80dc49d57189ccf3ceb2bdeb30ed5b564e34
- Date: Mon Mar 17 09:40:26 +0000 2008
- Committer: David Chelimsky (dchelimsky@gmail.com)
- Author: David Chelimsky (dchelimsky@gmail.com)
- Commit SHA1: deaa80dc49d57189ccf3ceb2bdeb30ed5b564e34
- Tree SHA1: 51dc08adf2244d8ee6416083edbb72fbd091232c
fixed example for include_text matcher
Commit diff
| |   |
| 49 | 49 | |
| 50 | 50 | it "should fail when a template is rendered" do |
| 51 | 51 | post 'some_action' |
| 52 | failure_message = case mode |
| 53 | when 'isolation' |
| 54 | /expected to find \"this is the text for this action\" in \"render_spec\/some_action\"/ |
| 55 | when 'integration' |
| 56 | /expected to find \"this is the text for this action\" in \"\"/ |
| 57 | end |
| 52 | 58 | lambda { |
| 53 | 59 | response.should include_text("this is the text for this action") |
| 54 | | }.should fail_with(/expected to find \"this is the text for this action\" in \"render_spec\/some_action\"/) |
| 60 | }.should fail_with(failure_message) |
| 55 | 61 | end |
| 56 | 62 | |
| 57 | 63 | it "should pass using should_not with incorrect text" do |
| toggle raw diff |
--- a/rspec_on_rails/spec/rails/matchers/include_text_spec.rb
+++ b/rspec_on_rails/spec/rails/matchers/include_text_spec.rb
@@ -49,9 +49,15 @@ describe "include_text", :type => :controller do
it "should fail when a template is rendered" do
post 'some_action'
+ failure_message = case mode
+ when 'isolation'
+ /expected to find \"this is the text for this action\" in \"render_spec\/some_action\"/
+ when 'integration'
+ /expected to find \"this is the text for this action\" in \"\"/
+ end
lambda {
response.should include_text("this is the text for this action")
- }.should fail_with(/expected to find \"this is the text for this action\" in \"render_spec\/some_action\"/)
+ }.should fail_with(failure_message)
end
it "should pass using should_not with incorrect text" do |