spec/spec_helper.rb in googleauth-0.4.2 vs spec/spec_helper.rb in googleauth-0.5.0
- old
+ new
@@ -37,22 +37,54 @@
# set up coverage
require 'simplecov'
require 'coveralls'
-SimpleCov.formatter = Coveralls::SimpleCov::Formatter
+SimpleCov.formatters = [
+ Coveralls::SimpleCov::Formatter,
+ SimpleCov::Formatter::HTMLFormatter
+]
SimpleCov.start
require 'faraday'
require 'rspec'
require 'logging'
require 'rspec/logging_helper'
+require 'webmock/rspec'
+require 'multi_json'
+# Preload adapter to work around Rubinius error with FakeFS
+MultiJson.use(:json_gem)
+
# Allow Faraday to support test stubs
Faraday::Adapter.load_middleware(:test)
# Configure RSpec to capture log messages for each test. The output from the
# logs will be stored in the @log_output variable. It is a StringIO instance.
RSpec.configure do |config|
include RSpec::LoggingHelper
config.capture_log_messages
+ config.include WebMock::API
+end
+
+module TestHelpers
+ include WebMock::API
+ include WebMock::Matchers
+end
+
+class DummyTokenStore
+ def initialize
+ @tokens = {}
+ end
+
+ def load(id)
+ @tokens[id]
+ end
+
+ def store(id, token)
+ @tokens[id] = token
+ end
+
+ def delete(id)
+ @tokens.delete(id)
+ end
end