Ignore this, I had a different problem in my code causing this.
On Oct 5, 9:28 pm, nathanvda wrote:
> I am trying to spec my helpers, and I find a few of my helpers
> actually render a partial.
>
> My code:
>
> module PageHelper
> def settings_menu
> render :partial => '_shared/
I have a simple controller test, containing a.o. the following code:
context "POST :create" do
before (:each) do
post :create, :user_id => @user.id,
:account => { .. some data ... }
end
it { response.status.should == 201 }
it { response.location.sho
>From looking at the RSpec Rails documentation
(https://www.relishapp.com/rspec/rspec-rails/docs/view-specs/view-spec) it
seems like rendered is just a string and you can't really do any
assert_select type stuff out of the box.
After Googling around, it seems that the RSpec authors decided that
We count how many examples before start executing example, we used to use
--dry--run option to achieve this. Now dry run is removed in Rspec 2, do you
have a way that we can count examples without executing examples? Thanks.
_
Hey guys. One of my models uses a Rails URL helper. In IRB, the method
works. However, when I run the specs for the method, the URL helper doesn't
exist.
The only solution I've found is to include
Rails.application.routes.url_helpers in both the model and the example
group. Obviously, that's n
On Oct 8, 2011, at 1:30 PM, Christopher J. Bottaro wrote:
> >From looking at the RSpec Rails documentation
> >(https://www.relishapp.com/rspec/rspec-rails/docs/view-specs/view-spec) it
> >seems like rendered is just a string and you can't really do any
> >assert_select type stuff out of the bo
On 10 Oct 2011, at 18:02, Nick wrote:
> Hey guys. One of my models uses a Rails URL helper. In IRB, the method works.
> However, when I run the specs for the method, the URL helper doesn't exist.
>
> The only solution I've found is to include
> Rails.application.routes.url_helpers in both the
> 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 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 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 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:
>>
>>
Hey Matt. Thanks for replying. I deleted that gist by accident earlier
today. Despite that, the problem's solved by
including Rails.application.routes.url_helpers in my model.
My Rails console sessions include Rails.application.routes.url_helpers
automatically, which is why it worked in IRB but
> > 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
Hi all,
I am trying to figure out how to use assert_select properly.
When I created a new resource in rails 3 called Brands, the view
specs for brands had a test which read:
# Run the generator again with the --webrat flag if you want to
use webrat matchers
assert_select "form", :acti
14 matches
Mail list logo