Sha256: 17eaf293a7e20ab1408a1a7a8e9a7a0e9cd1053025a0190aa4a1a50c8372c43e

Contents?: true

Size: 1.47 KB

Versions: 1

Compression:

Stored size: 1.47 KB

Contents

# this file generated by script/generate pickle page.
# You should edit the page_to_path method below for your own app's needs

# When I go to /sessions/new
When(/^I go to \/(.+?)$/) do |path|
  visit "/#{path}"
end

# Then I should be at /sessions/new
Then(/^I should be at \/(.+?)$/) do |path|
  request.path.should =~ /^\/#{path}/
end

# When I go to the posts's new comment page
When(/^I go to (.+?) page$/) do |page|
  visit page_to_path(page)
end

# Then I should be at the posts's new comment page
Then(/^I should be at (.+?) page$/) do |page|
  request.path.should =~ /^#{page_to_path(page)}/
end

# passed a string like 'the home', returns a path
def page_to_path(page)
  case page
  # add your own app-specific mappings, e.g.
  #
  # when 'the home'
  #   '/'
  #
  # when /$#{capture_model}'s activation^/
  #   activation_by_code_path(created_model($1).activation_code)
    
  when /^#{capture_model}'s$/                           # the forum's
    pickle_path $1
    
  when /^#{capture_model}'s #{capture_model}'s$/        # the forum's post's
    pickle_path $1, $2

  when /^#{capture_model}'s #{capture_model}'s (.+?)$/  # the forum's post's comments
    pickle_path $1, $2, :extra => $3

  when /^#{capture_model}'s (.+?)$/                     # the post's comments
    pickle_path $1, :extra => $2

  when /^the (.+?)$/                                    # the new session
    send "#{$1.downcase.gsub(' ','_')}_path"
    
  else
    raise "Could not map '#{page}' page to a path"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ianwhite-pickle-0.1.6 rails_generators/pickle/templates/pickle_path_steps.rb