Sha256: d61c42d012aad2c040023165933bd7b46e65d1a5e3ca450761c0747d07386c60

Contents?: true

Size: 796 Bytes

Versions: 238

Compression:

Stored size: 796 Bytes

Contents

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/
      '/'

    # 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)

Version data entries

238 entries across 238 versions & 32 rubygems

Version Path
ar-octopus-0.8.2 sample_app/features/support/paths.rb
ar-octopus-0.8.1 sample_app/features/support/paths.rb
the_jobbook_admin_data-1.3.0a test/dummy/features/support/paths.rb
ar-octopus-0.8.0 sample_app/features/support/paths.rb
ar-octopus-0.7.0 sample_app/features/support/paths.rb
ar-octopus-0.6.1 sample_app/features/support/paths.rb
navi-0.2.1 features/support/paths.rb
ar-octopus-0.6.0 sample_app/features/support/paths.rb
navi-0.2.0 features/support/paths.rb
ar-octopus-0.5.0 sample_app/features/support/paths.rb
muck-engine-3.5.0 test/features/support/paths.rb
blog_logic-1.4.15 features/support/paths.rb
blog_logic-1.4.14 features/support/paths.rb
cucumber-rails2-0.3.5 templates/install/support/paths.rb
cucumber-rails2-0.3.4 templates/install/support/paths.rb
cucumber-rails2-0.3.3 templates/install/support/paths.rb
site_logic-1.9.13 features/support/paths.rb
site_logic-1.9.12 features/support/paths.rb
admin_data-1.2.1 test/rails_root/features/support/paths.rb
campfire_logic-2.0.7 features/support/paths.rb