Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
184 additions
and
104 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
language: ruby | ||
rvm: | ||
- 1.9.3 | ||
- 2.0.0 | ||
- 2.1.3 | ||
- 2.3 | ||
- 2.4 | ||
- 2.5 | ||
|
||
script: bundle exec rake | ||
notifications: | ||
email: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
|
||
gem 'coveralls', require: false | ||
|
||
group :development, :test do | ||
gem 'faraday', '~> 0.15.3' | ||
gem 'mocha', '~> 1.7' | ||
gem 'webmock', '~> 3.4', '>= 3.4.2' | ||
gem 'yard', '~> 0.9.16', require: false | ||
end | ||
|
||
# Specify your gem's dependencies in minitest-vcr.gemspec | ||
gemspec | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,17 @@ | ||
# encoding: utf-8 | ||
|
||
require 'rubygems' | ||
|
||
begin | ||
require 'bundler' | ||
rescue LoadError => e | ||
warn e.message | ||
warn "Run `gem install bundler` to install Bundler." | ||
exit -1 | ||
end | ||
|
||
begin | ||
Bundler.setup(:development) | ||
rescue Bundler::BundlerError => e | ||
warn e.message | ||
warn "Run `bundle install` to install missing gems." | ||
exit e.status_code | ||
end | ||
|
||
require 'rake' | ||
|
||
require 'rubygems/tasks' | ||
Gem::Tasks.new | ||
# frozen_string_literal: true | ||
|
||
require 'bundler/gem_tasks' | ||
require 'rake/testtask' | ||
|
||
Rake::TestTask.new do |test| | ||
test.libs << 'test' | ||
test.pattern = 'test/**/*_test.rb' | ||
test.verbose = true | ||
Rake::TestTask.new(:test) do |t| | ||
t.libs << 'test' | ||
t.libs << 'lib' | ||
t.test_files = FileList['test/**/*_test.rb'] | ||
t.verbose = true | ||
end | ||
|
||
task default: :test | ||
|
||
require 'yard' | ||
YARD::Rake::YardocTask.new | ||
task :doc => :yard | ||
|
||
task :default => :test | ||
|
||
task doc: :yard |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'vcr' | ||
require 'active_support/testing/metadata' | ||
|
||
module MinitestVcr | ||
module ActiveSupport | ||
module TestCase | ||
def before_setup | ||
super | ||
|
||
return unless metadata.key?(:vcr) | ||
|
||
base_path = self.class.name.split('::').map do |p| | ||
p.underscore.tr(' ', '_') | ||
end | ||
|
||
base_path = File.join(*base_path) | ||
|
||
file_name = name.gsub(/^test_.\d+_/, ' ').strip.tr(' ', '_') | ||
path = File.join(base_path, file_name) | ||
|
||
options = metadata[:vcr].is_a?(Hash) ? metadata[:vcr] : {} | ||
|
||
::VCR.insert_cassette(path, options) | ||
end | ||
|
||
def after_teardown | ||
::VCR.eject_cassette if metadata.key?(:vcr) | ||
|
||
super | ||
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
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
24 changes: 12 additions & 12 deletions
24
.../MinitestVcr_Spec/an_it_with_metadata/with_a_nested_example_group/can_supply_metadata.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
64 changes: 64 additions & 0 deletions
64
...st_vcr/active_support/test_case_test/test_create_a_cassette_name_with_the_proper_path.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require "helper" | ||
|
||
class ActiveSupport::TestCase | ||
include MinitestVcr::ActiveSupport::TestCase | ||
end | ||
|
||
class MinitestVcr::ActiveSupport::TestCaseTest < ActiveSupport::TestCase | ||
test 'create a cassette name with the proper path', :vcr do | ||
conn = Faraday.new | ||
@response = conn.get 'http://example.com' | ||
|
||
expected = File.join(self.class.name.underscore, name) | ||
actual = VCR.current_cassette.name | ||
|
||
assert_equal expected, actual | ||
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