Guest User

Untitled

a guest
May 21st, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. require 'sample' # <-- your sinatra app
  2. require 'spec'
  3. require 'rack/test'
  4.  
  5. set :environment, :test
  6. set :sessions, true
  7.  
  8. describe 'The HelloWorld App' do
  9. include Rack::Test::Methods
  10.  
  11. def app
  12. Sinatra::Application
  13. end
  14.  
  15. it "should say hello using sessions attempt one" do
  16. get '/', {}, :sessions => {:username => "garren"}
  17. last_response.should be_ok
  18. last_response.body.should == 'Hello garren'
  19. end
  20.  
  21. it "should say hello using sessions attempt one" do
  22. get '/', {}, { "rack.session" => { :username => 'garren'}}
  23. last_response.should be_ok
  24. last_response.body.should == 'Hello garren'
  25. end
  26. end
Add Comment
Please, Sign In to add comment