I’ve written a custom matcher (gist:46858 · GitHub) which
I’d like to use in Cucumber specifically.
In my spec_helper, I have required the file where the matcher lives
in, and added it to Spec::Runner.configure.
In one of my cucumber steps, I have: response.should have_notice
(“foo”).
However, when I run the feature, I get the following error:
undefined method `has_notice?’ for #<ActionController::CgiResponse:
0x308fc84> (NoMethodError)
Note the has_notice?..
Any ideas on how to add this matcher to the response?
However, when I run the feature, I get the following error:
undefined method `has_notice?’ for #<ActionController::CgiResponse:
0x308fc84> (NoMethodError)
Note the has_notice?..
Any ideas on how to add this matcher to the response?
World do |world|
world.extend(Matchers)
world
end
Thanks, now my matcher did get included. However, I’m trying to use
have_tag (as in gist:46868 · GitHub), and I get this error:
undefined method `have_tag’ for #Matchers::HaveNotice:0x2e4a5c8
(NoMethodError)
Any ideas on how to make have_tag available in my custom matcher?
In my spec_helper, I have required the file where the matcher lives in,
world.extend(Matchers)
world
end
Thanks, now my matcher did get included. However, I’m trying to use have_tag
(as in gist:46868 · GitHub), and I get this error:
undefined method `have_tag’ for #Matchers::HaveNotice:0x2e4a5c8
(NoMethodError)
Any ideas on how to make have_tag available in my custom matcher?
Gotta include the rspec-rails matchers as well (or webrat if you’re
using those).
undefined method `has_notice?’ for
Thanks, now my matcher did get included. However, I’m trying to use
I’ve included this in spec_helper, so I thought the webrat/rspec-rails
matchers were included automatically…
Ah - I see the problem. They are, but outside the scope of the custom
matcher.
Here’s how I’ve gotten around this: gist:47126 · GitHub -
don’t know if that’ll work as/is, but it should give you the idea,
which is to provide access to the scope in which have_tag is defined
and call it on that scope.
HTH,
David
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.