Guest User

Untitled

a guest
Jul 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. require 'webmock'
  2.  
  3. # RSpec 1.x and 2.x compatibility
  4. if defined?(RSpec) && defined?(RSpec::Expectations)
  5. RSPEC_NAMESPACE = RSPEC_CONFIGURER = RSpec
  6. elsif defined?(Spec)
  7. RSPEC_NAMESPACE = Spec
  8. RSPEC_CONFIGURER = Spec::Runner
  9. else
  10. begin
  11. require 'rspec/core'
  12. require 'rspec/expectations'
  13. RSPEC_NAMESPACE = RSPEC_CONFIGURER = RSpec
  14. rescue LoadError
  15. require 'spec'
  16. RSPEC_NAMESPACE = Spec
  17. RSPEC_CONFIGURER = Spec::Runner
  18. end
  19. end
  20.  
  21. require 'webmock/rspec/matchers'
  22.  
  23. RSPEC_CONFIGURER.configure { |config|
  24.  
  25. config.include WebMock::API
  26. config.include WebMock::Matchers
  27.  
  28. config.after(:each) do
  29. WebMock.reset!
  30. end
  31. }
  32.  
  33. WebMock::AssertionFailure.error_class = RSPEC_NAMESPACE::Expectations::ExpectationNotMetError
Add Comment
Please, Sign In to add comment