Hi
Where do you include matcher modules in Cucumber so they don''t pollute
Object? ie so
module TwitterMatchers
class HaveUserStatus
# ...
end
def have_user_status(user, status)
HaveUserStatus.new(user, status)
end
end
is only visible in
Then "it should push an announcement to Twitter" do
t = Twitter::Base.new("dummy_user", "secret", :api_host
=>
"localhost", :api_port => 7002)
t.should have_user_status("followme_ann", "Story title
#@num_stories")
end
(Actually I''m not convinced it''s necessary in this case, but
anyway.)
I had a look at the Cucumber examples but none of them use custom
matchers.
Thanks
Ashley
--
http://www.patchspace.co.uk/
http://aviewfromafar.net/
On Mon, Sep 22, 2008 at 1:21 PM, Ashley Moran <ashley.moran at patchspace.co.uk> wrote:> Hi > > Where do you include matcher modules in Cucumber so they don''t pollute > Object? ie so > > module TwitterMatchers > class HaveUserStatus > # ... > end > > def have_user_status(user, status) > HaveUserStatus.new(user, status) > end > end > > is only visible in > > Then "it should push an announcement to Twitter" do > t = Twitter::Base.new("dummy_user", "secret", :api_host => "localhost", > :api_port => 7002) > t.should have_user_status("followme_ann", "Story title #@num_stories") > end > > (Actually I''m not convinced it''s necessary in this case, but anyway.) > > I had a look at the Cucumber examples but none of them use custom matchers. ># Put this in steps/env.rb World do w = Object.new w.extend(TwitterMatchers) w end Aslak> Thanks > Ashley > > > -- > http://www.patchspace.co.uk/ > http://aviewfromafar.net/ > > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Sep 22, 2008, at 12:30 pm, aslak hellesoy wrote:> # Put this in steps/env.rb > World do > w = Object.new > w.extend(TwitterMatchers) > w > end > > AslakCool! I did it like this in the end, when I figured out what it was doing: class MyWorld include TwitterMatchers end World do MyWorld.new end Thanks Aslak Ashley -- http://www.patchspace.co.uk/ http://aviewfromafar.net/