but, it doesn't know what to do with "I am on the homepage"
and it looks like you defined a step for it?
try using a more common phrase that the paths.rb will pick up, like
When I go to the home page
and then add a path as shown below.
in an older project, i see i have a features/support/paths.rb file with
stuff like this in it:
module NavigationHelpers
# Maps a name to a path. Used by the
#
# When /^I go to (.+)$/ do |page_name|
#
# step definition in web_steps.rb
#
def path_to(page_name)
case page_name
when /the home\s?page/
root_path
when /login/
login_path
when /re-run messages/i
url_for({:controller => '/message_logs', :action =>
'message_form', :only_path => true})
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
#
# when /^(.*)'s profile page$/i
# user_profile_path(User.find_by_login($1))
else
begin
page_name =~ /the (.*) page/
path_components = $1.split(/\s+/)
self.send(path_components.push('path').join('_').to_sym)
rescue Object => e
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
"Now, go and add a mapping in #{__FILE__}"
end
end
end
end
World(NavigationHelpers)
jon
blog: http://technicaldebt.com
twitter: http://twitter.com/JonKernPA
Suzanne said the following on 2/26/12 4:03 PM:
jon blog: http://technicaldebt.com twitter: http://twitter.com/JonKernPA
Okay I a very confused. I have been following a rails book that uses
webrat and since it is no longer valid, I am getting quite frustrated
with the very simple. Given I am on the home page. I bought the
cucumber book, but it doesn't specifically discuss routing. So am I
supposed to be using a paths.rb file? Is there a good example as to
what my routes should look like?
here is my error
Feature: Signing up
In order to be attributed for my work
As a user
I want to be able to sign up
Scenario: Signing up # features/
signing_up.feature:6
Given I am on the homepage # features/
step_definitions/Signing_up_steps.rb:1
undefined method `path_to' for #<Cucumber::Rails::World:
0x2f42200> (NoMethodError)
./features/step_definitions/Signing_up_steps.rb:2:in `/^I am on
the (.+)$/'
features/signing_up.feature:7:in `Given I am on the homepage'
When I follow "Sign up" # features/
step_definitions/Signing_up_steps.rb:5
And I fill in "Email" with "cout...@motorcitypmc.com" # features/
step_definitions/Signing_up_steps.rb:9
And I fill in "Password" with "password". # features/
step_definitions/Signing_up_steps.rb:13
And I fill in "Password confirmation" with "password" # features/
step_definitions/Signing_up_steps.rb:9
And I press "Sign up" # features/
step_definitions/Signing_up_steps.rb:17
Then I should see "You have signed up successfully." # features/
step_definitions/Signing_up_steps.rb:21
This is what I have in my steps.
Given /^I am on the (.+)$/ do |page_name|
visit path_to(page_name)
end
in my routes I have
root :to => "home#index"
formally I had used "home/index" instead of page_name, but that didn't
work
There is so much contradictory information I am getting quite
frustrated. I had thought the cucumber book would set it straight,
but alas it has not.
HELP
> okay so I thought webrat was out.......that is the beginning of my
> confusion....
>
> so if not webrat what?
Capybara. The book has a full chapter on it. Have you read that chapter?
> and also are you saying that a path.rb file is
> required.
Boilerplate code like paths.rb is no longer recommended:
http://aslakhellesoy.com/post/11055981222/the-training-wheels-came-off
Aslak
> --
> You received this message because you are subscribed to the Google Groups "Cukes" group.
> To post to this group, send email to cu...@googlegroups.com.
> To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/cukes?hl=en.
>
and if you want an easier time of writing cukes that march around your
UI (u can write complete smoke tests in no time), I find paths.rb a
must-have -- at least for starters, you should stick with something
simple that works.
jon
blog: http://technicaldebt.com
twitter: http://twitter.com/JonKernPA
Suzanne said the following on 2/26/12 5:50 PM:
jon
blog: http://technicaldebt.com
twitter: http://twitter.com/JonKernPA
Suzanne said the following on 2/26/12 5:50 PM:
I will take a look
On Feb 26, 2012 6:47 PM, "Aslak Hellesøy" <aslak.h...@gmail.com> wrote:On Feb 26, 2012, at 22:50, Suzanne <cout...@gmail.com> wrote:
> okay so I thought webrat was out.....
Capybara. The book has a full chapter on it. Have you read that chapter?
Boilerplate code like paths.rb is no longer recommended:
> and also are you saying that a path.rb file is
> required.
http://aslakhellesoy.com/post/11055981222/the-training-wheels-came-off
Aslak
> it is not discussed in the cucumber book?
>
> On Feb 26, 5:28 pm, Jon Kern <jonker...@gmail.com>...
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.
Thanks. So what does the routes file look like?
> # Maps a n...
--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post...