James Britt <james_b / neurogami.com> writes:

> Ryan Leavengood wrote:
>
>> What about:
>> test_method :add_item => [:item4] do
>>         before {@items = [:item1, :item2, :item3]}
>>         after {size == 4}
>> end
>> Or variations thereof.
>
> Such as
>
> test_method :add_item => [:item4] do
>     given {@items = [:item1, :item2, :item3]}
>     expected {size == 4}
> end

Continuing the brainstorm (I used "assuming" before "given", but that
reads better):

given { @items = [:item1, :item2, :item3] }.expect {
  add_item_should_increase_size {
    given {
      @previous_size = size
    }
    doing { add_item :item4 }
    results_in { size > @previous_size }
  }

  add_item_should_increase_size_by_one {
    doing { add_item :item4 }
    results_in { size == 4 }
  }
}

I'm still not sure whether instance_eval'ing tests is a good idea.

> James
-- 
Christian Neukirchen  <chneukirchen / gmail.com>  http://chneukirchen.org