[rspec-users] Stylistic preferences

Daniel Tenner daniel.ruby at tenner.org
Mon Dec 3 08:42:42 EST 2007


The code works fine. I was asking about the "given" thing.

Daniel

On 3 Dec 2007, at 13:32 3 Dec 2007, Bryan Liles wrote:

>
> On Nov 29, 2007, at 5:54 AM, Daniel Tenner wrote:
>
>> What are people's opinions on which of these two styles is better to
>> use?
>>
>>
>>   it "should be possible to disable the number" do
>>     given(valid_sms_user) do |user|
>>       user.save
>>       user.disable_number
>>       user.should be_disabled
>>     end
>>   end
>>
>
>
> it "should be possible to disable the number" do
>    lambda {
>      user.save
>      user.disable_number
>    }.should change(user, :disabled?).from(true).to(false)
> end
>
> If this doesn't work, the solution is very close to this.
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list