On 1 Jun 2009, at 20:52, Pat Maddox wrote:

You can do

it "should do something" do
 some_precondition.should be_met
 an_object.do_something
 some_postcondition.should be_met
end

Also, more verbosely...

describe "when there is some precondition"
  before(:each) do
    do_stuff_which_attempts_to_set_up_some_precondition
    some_precondition.should be_met
  end

  it "should do something"
    an_object.do_something
    some_postcondition.should be_met
  end
end

Which, can often make your specs read nicely. I also offers an obvious space to think of a few more examples to throw in there.

cheers,
Matt
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to