Guest User

Untitled

a guest
Nov 20th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. require "spec_helper"
  2.  
  3. # require the helper module
  4. require "savon/mock/spec_helper"
  5.  
  6. describe AuthenticationService do
  7. # include the helper module
  8. include Savon::SpecHelper
  9.  
  10. # set Savon in and out of mock mode
  11. before(:all) { savon.mock! }
  12. after(:all) { savon.unmock! }
  13.  
  14. describe "#authenticate" do
  15. it "authenticates the user with the service" do
  16. message = { username: "luke", password: "secret" }
  17. fixture = File.read("spec/fixtures/authentication_service/authenticate.xml")
  18.  
  19. # set up an expectation
  20. savon.expects(:authenticate).with(message: message).returns(fixture)
  21.  
  22. # call the service
  23. service = AuthenticationService.new
  24. response = service.authenticate(message)
  25.  
  26. expect(response).to be_successful
  27. end
  28. end
  29. end
Add Comment
Please, Sign In to add comment