Ruby on Rails
Wednesday, January 23, 2013
That seems like it :)
also about your cookie problem, is there anything that might look like this: http://stackoverflow.com/questions/9960732/rspec-vs-cookies-the-test-fails-even-if-the-applications-works-simulating-lo
all the best,
Andre
On Tuesday, 22 January 2013 15:00:21 UTC+1, fuzzy wrote:
-- On Tuesday, 22 January 2013 15:00:21 UTC+1, fuzzy wrote:
Hi Andre,
Thanks for your reply.
I did see a 'put_via_redirect'.
So I would have to rewrite the test and use this command and it would
be testing the redirect which is a way to test the put?
I will give that a try.
Thanks again.
On Jan 22, 2:57 am, and...@benjamin.dk wrote:
> So basically I think you are near the solution:
>
> request tests, allow you to test requests(like put and others):https://www.relishapp.com/rspec/rspec-rails/docs/ ..request-specs/reques.
>
> when you doing integration testing at a feature level you dont make
> requests(you would have instantiate the controller which is not correct),
> you can instead maybe visit a page that makes that put request you want to
> test the redirect happening. does that makes sense to you?
>
>
>
> On Saturday, 19 January 2013 03:07:24 UTC+1, Mirri Kim wrote:
>
> > Nope, just an alias.
>
> > On Sat, Jan 19, 2013 at 12:48 AM, fuzzy <hlo...@gmail.com <javascript:>>wrote:
>
> >> Thanks Mirri for you post ... I had a look at the link ... are they
> >> saying that 'specify' has now been superceded by 'it'?
>
> >> On Jan 18, 10:17 am, Mirri Kim <mirri....@gmail.com> wrote:
> >> > Hi,
>
> >> > `specify` is actually just the same as `it`. It's just there because
> >> > sometimes it reads better. See here:
> >>https://github.com/rspec/rspec-core/blob/master/lib/ ..rspec/core/exampl.
>
> >> > - Mirri
>
> >> > On Fri, Jan 18, 2013 at 5:22 PM, <and...@benjamin.dk> wrote:
> >> > > Hey fuzzy,
>
> >> > > I think the first thing that is maybe wrong with your spec is that
> >> you are
> >> > > trying to do a request inside of a describe.
>
> >> > > it should be something like:
>
> >> > > describe "#update" do
> >> > > before { put employee_path(employee) }
> >> > > it "returns something or does something" do
> >> > > specify { response.should redirect_to(signin_path) }
> >> > > end
> >> > > end
>
> >> > > also whats the whole spec file you are running and in which like you
> >> get
> >> > > and which error exactly: please copy all this details
>
> >> > > all the best,
>
> >> > > Andre
>
> >> > > On Thursday, 17 January 2013 00:05:44 UTC+1, fuzzy wrote:
>
> >> > >> I just read that Capybara does not do integration testing ... this I
> >> > >> found right at the bottom of the Capybara documentation page. So
> >> since
> >> > >> all Capybara tests reside in the spec/features folder, I moved the
>
> >> > >> submitting a PUT request to the Employees#update
>
> >> > >> test into the spec/request folder and it passes.
>
> >> > >> Some progress .. now for the other two failing tests ... namely the:
>
> >> > >> undefined local variable or method 'cookies'
>
> >> > >> Some more research of maybe someone has an understanding of why this
> >> > >> test is failing and is willing to give me some guidance?
>
> >> > >> Thanks.
>
> >> > >> On Jan 15, 5:09 pm, fuzzy <hlog...@gmail.com> wrote:
> >> > >> > Hi,
>
> >> > >> > rails 3.2.11 and Capybara 2.0.2 and the latest rspec.
>
> >> > >> > I have another test that has me searching for a solution ... just
> >> now,
> >> > >> I do
> >> > >> > not have one and I have spent a number of days trying out different
> >> > >> > solutions.
>
> >> > >> > If I may ... here is the test, spec/features:
>
> >> > >> > describe "submitting a PUT request to the
> >> Employees#update
> >> > >> > action" do
> >> > >> > before { put employee_path(employee) }
> >> > >> > specify { response.should redirect_to(signin_path) }
> >> > >> > end
>
> >> > >> > It fails with this message:
>
> >> > >> > NoMethodErrror: undefined method 'put'
>
> >> > >> > In this same group, I have another two tests failing both with:
>
> >> > >> > undefined local variable or method 'cookies'
>
> >> > >> > and it identifies the sign_in def as the culprit:
>
> >> > >> > def sign_in(employee)
> >> > >> > visit signin_path
> >> > >> > fill_in "Email", with: employee.email
> >> > >> > fill_in "Password", with: employee.password
> >> > >> > click_button "Sign in"
> >> > >> > # Sign in when not using Capybara.
> >> > >> > cookies[:remember_token] =
> >> employee.remember_token
> >> > >> > end
>
> >> > >> > This is part of the spec/support/utilities file.
>
> >> > >> > Does anyone have any ideas on how to solve this?
>
> >> > >> > Thanks.
>
> >> > > --
> >> > > You received this message because you are subscribed to the Google
> >> Groups
> >> > > "Ruby on Rails: Talk" group.
> >> > > To post to this group, send email to rubyonra...@googlegroups.com<javascript:>
> >> .
> >> > > To unsubscribe from this group, send email to
> >> > > rubyonrails-ta...@googlegroups.com <javascript:>.
> >> > > To view this discussion on the web visit
> >> > >https://groups.google.com/d/msg/rubyonrails-talk/-/ .iNBNpjYdySMJ
>
> >> > > For more options, visithttps://groups.google.com/groups/opt_out .
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Ruby on Rails: Talk" group.
> >> To post to this group, send email to rubyonra...@googlegroups.com<javascript:>
> >> .
> >> To unsubscribe from this group, send email to
> >> rubyonrails-ta...@googlegroups.com <javascript:>.
> >> For more options, visithttps://groups.google.com/groups/opt_out .
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/_XwZY7AryuwJ.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment