Sha256: 6df8e8c97828d95fc17ad5d2720c4f5fb8b3f1245e96d56ffe8ef60463223928

Contents?: true

Size: 821 Bytes

Versions: 10

Compression:

Stored size: 821 Bytes

Contents

module NavigationHelpers
  # Maps a static name to a static route.
  #
  # This method is *not* designed to map from a dynamic name to a 
  # dynamic route like <tt>post_comments_path(post)</tt>. For dynamic 
  # routes like this you should *not* rely on #path_to, but write 
  # your own step definitions instead. Example:
  #
  #   Given /I am on the comments page for the "(.+)" post/ |name|
  #     post = Post.find_by_name(name)
  #     visit post_comments_path(post)
  #   end
  #
  def path_to(page_name)
    case page_name
    
    when /the homepage/
      root_path
    
    # Add more page name => path mappings here
    
    else
      raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
        "Now, go and add a mapping in features/support/paths.rb"
    end
  end
end

World(NavigationHelpers)

Version data entries

10 entries across 10 versions & 5 rubygems

Version Path
aslakhellesoy-cucumber-0.2.3.2 rails_generators/cucumber/templates/paths.rb
aslakhellesoy-cucumber-0.2.3.3 rails_generators/cucumber/templates/paths.rb
aslakhellesoy-cucumber-0.2.3.4 rails_generators/cucumber/templates/paths.rb
aslakhellesoy-cucumber-0.3.0 rails_generators/cucumber/templates/paths.rb
cavalle-cucumber-0.2.3.3.1 rails_generators/cucumber/templates/paths.rb
cavalle-cucumber-0.2.3.3.2 rails_generators/cucumber/templates/paths.rb
jnicklas-courgette-0.0.2 fixture_rails_root/features/support/paths.rb
jnicklas-courgette-0.0.3 fixture_rails_root/features/support/paths.rb
kosmas58-cucumber-0.2.3.3 rails_generators/cucumber/templates/paths.rb
cucumber-0.3.0 rails_generators/cucumber/templates/paths.rb