> > I'd rename it to something like "has_alert_flag?" or "flagged_for_alert?"
> > so I could say "model.should have_alert_flag" or "model.should
> > be_flagged_for_alert".
Ok, for whatever reason I wasn't 100% clear on this.. So the rule is, any
predicate method that starts with "has_" can be rep
On Oct 11, 2011, at 6:19 PM, David Chelimsky wrote:
> On Oct 11, 2011, at 7:38 PM, Pat Maddox wrote:
>
>> On Oct 11, 2011, at 5:22 PM, Patrick J. Collins wrote:
>>> Having a spec that does:
>>>
>>> @my_model.alert_flag?.should be_true
>>>
>>> Seemed a little goofy to me... So I did:
>>
>>
On Oct 11, 2011, at 7:38 PM, Pat Maddox wrote:
> On Oct 11, 2011, at 5:22 PM, Patrick J. Collins wrote:
>> Having a spec that does:
>>
>>@my_model.alert_flag?.should be_true
>>
>> Seemed a little goofy to me... So I did:
>
> You can do
>
> @my_model.should be_alert_flag
That name feels
On Oct 11, 2011, at 5:22 PM, Patrick J. Collins wrote:
> Having a spec that does:
>
> @my_model.alert_flag?.should be_true
>
> Seemed a little goofy to me... So I did:
You can do
@my_model.should be_alert_flag
A custom matcher isn't worth it in this case, in my opinion.
Pat
___
> On Oct 10, 2011, at 8:17 PM, Patrick J. Collins wrote:
>
> > I know I can do:
> >
> > blah.should be_empty
> >
> > or
> >
> > blah.should have_key(:to_my_house)
> >
> > ...
> >
> > But, is there a way to do:
> >
> > str = "lmaonade omg rotfcopter!"
> >
> > str.should start_with("lmao")
>
On Oct 10, 2011, at 8:17 PM, Patrick J. Collins wrote:
> I know I can do:
>
> blah.should be_empty
>
> or
>
> blah.should have_key(:to_my_house)
>
> ...
>
> But, is there a way to do:
>
> str = "lmaonade omg rotfcopter!"
>
> str.should start_with("lmao")
>
> Or is it just best to do:
>
>
I know I can do:
blah.should be_empty
or
blah.should have_key(:to_my_house)
...
But, is there a way to do:
str = "lmaonade omg rotfcopter!"
str.should start_with("lmao")
Or is it just best to do:
str.starts_with?("lmao").should be_true
?
Patrick J. Collins
http://collinatorstudios.com