Guest User

Untitled

a guest
Jul 19th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. ## features/order_management.feature
  2. Feature: Order management
  3. In order to maintain accurate order records
  4. As an administrator
  5. I want to be able to cancel and delete orders
  6.  
  7. Scenario: Delete an order
  8. Given a current order for user "user1" containing spaces "A13"
  9. And a logged in admin user "admin" with password "secret"
  10. When I go to "This Year's Orders"
  11. And I follow "Delete"
  12. Then I should have 0 orders
  13. And space "A13" should not be reserved
  14. And I should see "This Year's Orders"
  15.  
  16. ## features/steps/order_steps.rb
  17. Given /^a current order for user "([^\"]*)" containing spaces "([^\"]*)"$/ do |user, spaces|
  18. Given "a current Var entry"
  19. And "a multispace discount Product"
  20. And "existing non-reserved spaces \"#{spaces}\""
  21. @order = Factory(:order, :user => Factory(:user, :login => user))
  22. spaces.split(/, /).each do |space|
  23. @order.line_items << Factory(:line_item, :billable => Space.find_by_name(space), :price => 50.0, :quantity => 1)
  24. end
  25. end
  26.  
  27. Then /^I should have ([0-9]+) orders$/ do |count|
  28. Order.count.should = count
  29. end
  30.  
  31. ## features/steps/var_steps.rb
  32. Given /^a current Var entry$/ do
  33. Factory(:var)
  34. end
  35.  
  36. ## features/steps/product_steps.rb
  37. Given /^a multispace discount Product$/ do
  38. Factory(:msd)
  39. end
  40.  
  41. ## features/steps/space_steps.rb
  42. Given /^existing non-reserved spaces "([^\"]*)"$/ do |spaces|
  43. spaces.split(/, /).each do |space|
  44. myarray = space.scan(/([A-Z]{1,2})([0-9]{2})/)
  45. row = myarray[0][1]
  46. col = myarray[0][0]
  47. Factory(:space, :row => row, :col => col, :user => nil)
  48. end
  49. end
  50.  
  51. When /^(?:|I )search for the space "([^\"]*)"$/ do |space|
  52. visit search_spaces_path(:search => "#{space}")
  53. end
  54.  
  55. Then /^space "([^\"]*)" should not be reserved$/ do |space|
  56. space.user.should = nil
  57. end
  58.  
  59. ## features/steps/authentication_steps.rb
  60. Given /^an existing normal user "([^\"]*)" with password "([^\"]*)"$/ do |user_name, password|
  61. Factory(:user, :login => user_name, :password => password, :password_confirmation => password, :admin => false)
  62. end
  63.  
  64. Given /^an existing admin user "([^\"]*)" with password "([^\"]*)"$/ do |user_name, password|
  65. Factory(:user, :login => user_name, :password => password, :password_confirmation => password, :admin => true)
  66. end
  67.  
  68. Given /^a logged in admin user "([^\"]*)" with password "([^\"]*)"$/ do |user_name, password|
  69. Given "an existing admin user \"#{user_name}\" with password \"#{password}\""
  70. And "I sign in as \"#{user_name}\" with password \"#{password}\""
  71. end
  72.  
  73. Given /^(?:|I )sign in as "(.*)" with password "(.*)"$/ do |user_name, password|
  74. Given "I am on the login page"
  75. fill_in 'login', :with => user_name
  76. fill_in 'password', :with => password
  77. click_button 'Log in'
  78. end
Add Comment
Please, Sign In to add comment