Ruby on Rails Friday, January 18, 2013

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/example_group.rb#L82

- Mirri

On Fri, Jan 18, 2013 at 5:22 PM, <andreo@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 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/-/iNBNpjYdySMJ.

For more options, visit https://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.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment