Sha256: bf420aec466b17c9cd4afb4d84df6bbc33f621bc6b0068cf01ca4dbc101672f9

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

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

    when /the simple panel page/
      '/panel/simple'

    when /the server caller page/
      '/panel/server_caller'

    when /the component loader page/
      '/panel/component_loader'

    when /the (.*) test page/
      components_path(:component => $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

6 entries across 6 versions & 2 rubygems

Version Path
netzke-core-0.6.4 features/support/paths.rb
netzke-persistence-0.1.0 features/support/paths.rb
netzke-core-0.6.3 features/support/paths.rb
netzke-core-0.6.2 features/support/paths.rb
netzke-core-0.6.1 features/support/paths.rb
netzke-core-0.6.0 features/support/paths.rb