Sha256: 7520b09717c962b569f5cd10cd0cafa7e79420b7606bebf069440296dd577dbc

Contents?: true

Size: 671 Bytes

Versions: 9

Compression:

Stored size: 671 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/
      '/'
    when /the new user page/
      '/users/new'
    else
      begin
        page_name =~ /the (.*) page/
        path_components = Regexp.last_match(1).split(/\s+/)
        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

9 entries across 9 versions & 1 rubygems

Version Path
activerecord-tablefree-3.1.8 features/support/paths.rb
activerecord-tablefree-3.1.7 features/support/paths.rb
activerecord-tablefree-3.1.6 features/support/paths.rb
activerecord-tablefree-3.1.5 features/support/paths.rb
activerecord-tablefree-3.1.4 features/support/paths.rb
activerecord-tablefree-3.1.3 features/support/paths.rb
activerecord-tablefree-3.1.2 features/support/paths.rb
activerecord-tablefree-3.1.1 features/support/paths.rb
activerecord-tablefree-3.1.0 features/support/paths.rb