Displaying 2 results from an estimated 2 matches for "example_block".
2007 Sep 21
11
given_it
...th GivenScenario). I was not
sure if this possibility already exists in rspec (and, honestly, was
lazy to check), so I have created this helper:
def given_it(name)
example_definition = behaviour.example_definitions.find{|i|
i.description == name }
instance_eval(&example_definition.example_block)
end
so it is possible to write things like
it "should do something after another action" do
given_it "should successfully do another action"
do_something.should be_fine
end
Is there anything already in rspec that allows me to do the same
stuff? Or was it a bad idea a...
2007 Nov 07
1
Helper methods starting with should_ get picked up as examples?
...using custom matchers when I''m being lazy and instead just defining
methods. Anyway, it seems RSpec picks up methods starting with
should_ as examples. Here is some debug output that I generated for a
method called should_have_emailed:
#<Spec::DSL::ExampleDefinition:0x3383bfc @example_block=#<Proc:
0x003f0250@/Users/peter/src/gear/specialist/vendor/plugins/rspec/lib/
spec/dsl/example.rb:27>, @from="/Users/peter/src/gear/specialist/
vendor/plugins/rspec/lib/spec/dsl/example.rb:22:in `each''",
@description="should_have_emailed", @options={}>
Is...