Sha256: 050b7b63235de47e8e974ff0902642fa3648a2cc188d02f2a7babe5f912ca9ec

Contents?: true

Size: 1.41 KB

Versions: 42

Compression:

Stored size: 1.41 KB

Contents

#
# Where to go
#

#
# GET
# Go to a given page.
When "$actor goes to $path" do |actor, path|
  case path
  when 'the home page' then get '/'
  else                      get path
  end
end

# POST -- Ex:
#   When she creates a book with ISBN: '0967539854' and comment: 'I love this book' and rating: '4'
#   When she creates a singular session with login: 'reggie' and password: 'i_haxxor_joo'
# Since I'm not smart enough to do it right, explicitly specify singular resources
When /^(\w+) creates an? ([\w ]+) with ([\w: \',]+)$/ do |actor, resource, attributes|
  attributes = attributes.to_hash_from_story
  if resource =~ %r{singular ([\w/]+)}
    resource = $1.downcase.singularize
    post "/#{resource}", attributes
  else
    post "/#{resource.downcase.pluralize}", { resource.downcase.singularize => attributes }
  end
end

# PUT
When %r{$actor asks to update '$resource' with $attributes} do |_, resource, attributes|
  attributes = attributes.to_hash_from_story
  put "#{resource}", attributes
  dump_response
end

# DELETE -- Slap together the POST-form-as-fake-HTTP-DELETE submission
When %r{$actor asks to delete '$resource'} do |_, resource|
  post "/#{resource.downcase.pluralize}", { :_method => :delete }
  dump_response
end


# Redirect --
#   Rather than coding in get/get_via_redirect's and past/p_v_r's,
#   let's just demand that in the story itself.
When "$actor follows that redirect!" do |actor|
  follow_redirect!
end

Version data entries

42 entries across 42 versions & 7 rubygems

Version Path
smukherjee-openbill-0.1.5 vendor/plugins/restful-authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
smukherjee-openbill-0.1.6 vendor/plugins/restful-authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
smukherjee-openbill-0.1.7 vendor/plugins/restful-authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
rails3-restful-authentication-3.0.1 lib/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
tournament-5.0.0 webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
jashmenn-restful-authentication-2.0.0.beta1 lib/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
restful-authentication-1.2.1 lib/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
branston-0.6.6 lib/branston/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
branston-0.6.5 lib/branston/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
branston-0.6.4 lib/branston/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
branston-0.6.3 lib/branston/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
branston-0.6.2 lib/branston/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
tournament-4.2.0 webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
tournament-4.0.2 webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
tournament-4.0.0 webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
branston-0.6.1 lib/branston/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
branston-0.6.0 lib/branston/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
tournament-3.3.3 webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
tournament-3.3.2 webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb
tournament-3.3.1 webgui/vendor/plugins/restful_authentication/generators/authenticated/templates/features/step_definitions/ra_navigation_steps.rb