Last active
January 22, 2016 05:06
-
-
Save hxegon/d78db392d61c78225819 to your computer and use it in GitHub Desktop.
Why does this give me VCR::Errors::UnhandledHTTPRequestError
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
group :development do | |
gem 'rake' | |
gem 'guard', require: false | |
gem 'guard-rspec', require: false | |
end | |
group :development, :testing do | |
gem 'dotenv' | |
end | |
group :testing do | |
gem 'rspec' | |
gem 'vcr' | |
gem 'webmock' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'vcr' | |
RSpec.configure do |config| | |
config.extend VCR::RSpec::Macros | |
config.expect_with :rspec do |expectations| | |
expectations.include_chain_clauses_in_custom_matcher_descriptions = true | |
end | |
config.mock_with :rspec do |mocks| | |
mocks.verify_partial_doubles = true | |
end | |
# Tag tests with :focus to only run them. | |
config.filter_run :focus | |
config.run_all_when_everything_filtered = true | |
# Allows RSpec to persist some state between runs in order to support | |
# the `--only-failures` and `--next-failure` CLI options. We recommend | |
# you configure your source control system to ignore this file. | |
config.example_status_persistence_file_path = "spec/examples.txt" | |
config.disable_monkey_patching! | |
config.warnings = false | |
if config.files_to_run.one? | |
# Use the documentation formatter for detailed output, | |
# unless a formatter has already been configured | |
# (e.g. via a command-line flag). | |
config.default_formatter = 'doc' | |
end | |
# Print the 10 slowest examples and example groups at the | |
# end of the spec run, to help surface which specs are running | |
# particularly slow. | |
config.profile_examples = 10 | |
config.order = :random | |
Kernel.srand config.seed | |
end | |
VCR.configure do |config| | |
config.cassette_library_dir = 'fixtures/vcr_cassettes' | |
config.debug_logger = File.open('vcr_log.txt', 'w') | |
config.hook_into :webmock | |
#config.default_cassette_options = { record: :new_episodes } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
RSpec.describe ProductClient do | |
before(:all) do | |
@client = ProductClient.new | |
@products = Array JSON.parse(File.read('spec/fixtures/products.json')) | |
end | |
context '#index', :focus do | |
VCR.use_cassette('index') do | |
before(:all) { @response = @client.index } | |
subject { @response } | |
it 'is successful' do | |
expect(@response).to be_kind_of Hash | |
expect(@response['errors']).to be_nil | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Cassette: 'index'] Initialized with options: {:record=>:once, :match_requests_on=>[:method, :uri], :allow_unused_http_interactions=>true, :serialize_with=>:yaml, :persist_with=>:file_system} | |
[webmock] Handling request: [get http://0.0.0.0:3000/api/products?page=1] (disabled: false) | |
[webmock] Identified request type (unhandled) for [get http://0.0.0.0:3000/api/products?page=1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment