Guest User

Untitled

a guest
Apr 15th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. ## stories/all.rb: [ruby]
  2.  
  3. $LOAD_PATH.unshift File.dirname(__FILE__)
  4. require 'helper'
  5.  
  6. with_steps_for :data, :auth, :browsing, :parsing, :debug do
  7. Dir['stories/text/**/*'].select { |x| File.file?(x) }.each do |story_path|
  8. run story_path, :type => RailsStory
  9. end
  10. # or be explicit:
  11. # run "stories/text/logging_in"
  12. end
  13.  
  14.  
  15. ## stories/helper.rb: [ruby]
  16.  
  17. ENV["RAILS_ENV"] = "test"
  18. require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
  19. require 'spec'
  20. require 'spec/rails/story_adapter'
  21. require 'hpricot'
  22.  
  23. Dir['stories/steps/**/*.rb'].each do |steps_file|
  24. require steps_file
  25. end
  26.  
  27.  
  28. ## stories/steps/data.rb: [ruby]
  29. steps_for(:data) do
  30. Given("a user with $privileges privileges") do |privileges|
  31. user = User.create!(:first_name => 'Example', :last_name => 'User', :email => 'user@example.com', :password => 'password')
  32. case privileges
  33. when 'admin' then user.admin = true
  34. when 'fundraising' then user.fundraising_account = true
  35. end
  36. user.save!
  37. @current_user = user
  38. end
  39. end
Add Comment
Please, Sign In to add comment