site_prism.vcr 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +12 -0
- data/Gemfile +17 -0
- data/LICENSE.txt +22 -0
- data/README.md +381 -0
- data/Rakefile +1 -0
- data/TODO.md +71 -0
- data/lib/site_prism.vcr.rb +1 -0
- data/lib/site_prism_vcr/applier.rb +54 -0
- data/lib/site_prism_vcr/dsl/adjuster.rb +82 -0
- data/lib/site_prism_vcr/dsl/initial_adjuster.rb +97 -0
- data/lib/site_prism_vcr/element.rb +18 -0
- data/lib/site_prism_vcr/fixture.rb +29 -0
- data/lib/site_prism_vcr/fixtures/converter.rb +17 -0
- data/lib/site_prism_vcr/fixtures/handler.rb +31 -0
- data/lib/site_prism_vcr/fixtures/manager.rb +38 -0
- data/lib/site_prism_vcr/fixtures/modifiers/home_path.rb +27 -0
- data/lib/site_prism_vcr/fixtures/modifiers/path.rb +30 -0
- data/lib/site_prism_vcr/fixtures/tmp_keeper.rb +21 -0
- data/lib/site_prism_vcr/fixtures.rb +41 -0
- data/lib/site_prism_vcr/options.rb +22 -0
- data/lib/site_prism_vcr/options_with_path.rb +7 -0
- data/lib/site_prism_vcr/patches/element_container.rb +15 -0
- data/lib/site_prism_vcr/patches/page.rb +41 -0
- data/lib/site_prism_vcr/vcr_helpers.rb +18 -0
- data/lib/site_prism_vcr/version.rb +3 -0
- data/lib/site_prism_vcr/waiter.rb +23 -0
- data/lib/site_prism_vcr.rb +24 -0
- data/site_prism.vcr.gemspec +24 -0
- data/spec/fixtures/arya_stark.yml +44 -0
- data/spec/fixtures/custom/blank.yml +44 -0
- data/spec/fixtures/custom/bran_stark.yml +44 -0
- data/spec/fixtures/custom/daenerys_targaryen.yml +44 -0
- data/spec/fixtures/jon_snow.yml +44 -0
- data/spec/fixtures/ned_stark.yml +44 -0
- data/spec/fixtures/robb_stark.yml +44 -0
- data/spec/integration/http_interactions_on_even/click_spec.rb +75 -0
- data/spec/integration/immediate_http_interactions/page_load_on_click_spec.rb +18 -0
- data/spec/integration/immediate_http_interactions/page_load_spec.rb +56 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/spec_integration_helper.rb +27 -0
- data/spec/support/shared/integration/custom_fixtures.rb +32 -0
- data/spec/support/shared/integration/exchange.rb +42 -0
- data/spec/support/shared/integration/home_path.rb +49 -0
- data/spec/support/shared/integration/waiter.rb +75 -0
- data/spec/support/site_prism/pages/base.rb +18 -0
- data/spec/support/site_prism/pages/home.rb +44 -0
- data/spec/support/site_prism/pages/immediate_http_interactions/home_path.rb +15 -0
- data/spec/support/site_prism/pages/immediate_http_interactions/one_request.rb +13 -0
- data/spec/support/site_prism/pages/immediate_http_interactions/subpage.rb +7 -0
- data/spec/support/site_prism/pages/immediate_http_interactions/two_requests.rb +12 -0
- data/spec/support/site_prism/pages/immediate_http_interactions/waiter_without_fixtures_ejection.rb +12 -0
- data/spec/support/site_prism/sections/console_block.rb +8 -0
- data/spec/support/test_app/public/jquery.min.js +5 -0
- data/spec/support/test_app/public/test.js +44 -0
- data/spec/support/test_app/test_app.rb +46 -0
- data/spec/support/test_app/views/index.erb +26 -0
- data/spec/unit/applier_spec.rb +134 -0
- data/spec/unit/dsl/adjuster_spec.rb +141 -0
- data/spec/unit/dsl/initial_adjuster_spec.rb +166 -0
- data/spec/unit/element_container_spec.rb +48 -0
- data/spec/unit/element_spec.rb +47 -0
- data/spec/unit/fixture_spec.rb +45 -0
- data/spec/unit/fixtures/converter_spec.rb +36 -0
- data/spec/unit/fixtures/handler_spec.rb +72 -0
- data/spec/unit/fixtures/manager_spec.rb +58 -0
- data/spec/unit/fixtures/modifiers/home_path_spec.rb +47 -0
- data/spec/unit/fixtures/modifiers/path_spec.rb +45 -0
- data/spec/unit/fixtures/tmp_keeper_spec.rb +17 -0
- data/spec/unit/fixtures_spec.rb +76 -0
- data/spec/unit/options_spec.rb +41 -0
- data/spec/unit/patches/element_container_spec.rb +48 -0
- data/spec/unit/patches/page_spec.rb +57 -0
- data/spec/unit/vcr_helpers_spec.rb +18 -0
- data/spec/unit/waiter_spec.rb +67 -0
- metadata +213 -0
@@ -0,0 +1,97 @@
|
|
1
|
+
module SPV
|
2
|
+
module DSL
|
3
|
+
# This class provides DSL which is used while defining fixtures
|
4
|
+
# and applying them.
|
5
|
+
class InitialAdjuster
|
6
|
+
def initialize(options)
|
7
|
+
@options = options
|
8
|
+
@tmp_keeper = Fixtures::TmpKeeper.new(@options)
|
9
|
+
@fixtures_handler = Fixtures::Handler.new(@options)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Defines fixtures which will be inserted into VCR.
|
13
|
+
#
|
14
|
+
# @param list [Array<String>] List of fixtures.
|
15
|
+
#
|
16
|
+
# @return [void]
|
17
|
+
#
|
18
|
+
# @api public
|
19
|
+
def fixtures(list)
|
20
|
+
prepared_fixtures = @fixtures_handler.handle_raw(
|
21
|
+
list,
|
22
|
+
[Fixtures::Modifiers::HomePath.new(@options)]
|
23
|
+
)
|
24
|
+
|
25
|
+
@tmp_keeper.add_fixtures(prepared_fixtures)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Defines path to fixtures. Later this path
|
29
|
+
# can be used for defining fixtures. It is especially
|
30
|
+
# useful when you use deep subdirectories structure for storing fixtures.
|
31
|
+
#
|
32
|
+
# @param path [String] Path to fixtures.
|
33
|
+
#
|
34
|
+
# @return [void]
|
35
|
+
#
|
36
|
+
# @api public
|
37
|
+
def home_path(path)
|
38
|
+
@options.home_path = path
|
39
|
+
end
|
40
|
+
|
41
|
+
# Applies a given path to list of fixtures and defines
|
42
|
+
# those fixtures to be inserted into VCR.
|
43
|
+
#
|
44
|
+
# @param path [String] Path to fixtures.
|
45
|
+
# @param fixture_names [Array<String>] List of fixtures.
|
46
|
+
#
|
47
|
+
# @return [void]
|
48
|
+
#
|
49
|
+
# @raise [ArgumentError] If any of fixture names has path to a home directory.
|
50
|
+
#
|
51
|
+
# @api public
|
52
|
+
def path(path, fixture_names)
|
53
|
+
options_with_path = OptionsWithPath.new(@options)
|
54
|
+
options_with_path.path = path
|
55
|
+
|
56
|
+
path_modifier = Fixtures::Modifiers::Path.new(options_with_path)
|
57
|
+
home_path_modifier = Fixtures::Modifiers::HomePath.new(options_with_path)
|
58
|
+
|
59
|
+
prepared_fixtures = @fixtures_handler.handle_raw(
|
60
|
+
fixture_names,
|
61
|
+
[
|
62
|
+
path_modifier,
|
63
|
+
home_path_modifier
|
64
|
+
]
|
65
|
+
)
|
66
|
+
|
67
|
+
@tmp_keeper.add_fixtures(prepared_fixtures)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Defines a waiter which will be used for waiting until all HTTP
|
71
|
+
# interactions have finished.
|
72
|
+
#
|
73
|
+
# @param options [Hash, nil] Options which allows to change behavior of a waiter.
|
74
|
+
# @option options :eject_cassettes [Boolean] Whether or not to eject
|
75
|
+
# all cassettes from VCR once a waiter meets an expectation.
|
76
|
+
#
|
77
|
+
# @yield Block to be used as a waiter.
|
78
|
+
#
|
79
|
+
# @return [void]
|
80
|
+
#
|
81
|
+
# @api public
|
82
|
+
def waiter(waiter_options = nil, &block)
|
83
|
+
@options.waiter = block
|
84
|
+
@options.waiter_options = waiter_options
|
85
|
+
end
|
86
|
+
|
87
|
+
# Returns set of prepared fixtures.
|
88
|
+
#
|
89
|
+
# @return [SPV::Fixtures] A set of prepared fixtures.
|
90
|
+
#
|
91
|
+
# @api public
|
92
|
+
def prepared_fixtures
|
93
|
+
Fixtures.new(@tmp_keeper.fixtures)
|
94
|
+
end
|
95
|
+
end # class InitialAdjuster
|
96
|
+
end # module DSL
|
97
|
+
end # module SPV
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'delegate'
|
2
|
+
|
3
|
+
module SPV
|
4
|
+
# Extends a native Capybara element with new methods.
|
5
|
+
class Element < SimpleDelegator
|
6
|
+
def initialize(element, parent, &block)
|
7
|
+
super element
|
8
|
+
|
9
|
+
@applier = Applier.new(parent, &block)
|
10
|
+
end
|
11
|
+
|
12
|
+
def click_and_apply_vcr(&adjusting_block)
|
13
|
+
@applier.apply(adjusting_block) do
|
14
|
+
click
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module SPV
|
2
|
+
# Keeps a path to fixture and options which should be
|
3
|
+
# passed to Vcr while inserting a cassette
|
4
|
+
class Fixture
|
5
|
+
attr_accessor :name, :options
|
6
|
+
|
7
|
+
# TODO: may be it makes sense to separately keep path from the name of a fixture?
|
8
|
+
def initialize(name, vcr_options = {})
|
9
|
+
@name, @options = name, vcr_options
|
10
|
+
end
|
11
|
+
|
12
|
+
def add_path(path)
|
13
|
+
self.name = path + name
|
14
|
+
end
|
15
|
+
|
16
|
+
def set_home_path(home_path)
|
17
|
+
self.name = self.name.gsub(/\A\~\//, home_path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def has_link_to_home_path?
|
21
|
+
self.name[0..1] == '~/'
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns a name without a link to a home path
|
25
|
+
def clean_name
|
26
|
+
self.name[2..-1]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module SPV
|
2
|
+
# Converts raw fixtures into list of
|
3
|
+
# SPV::Fixture objects.
|
4
|
+
class Fixtures
|
5
|
+
class Converter
|
6
|
+
def self.convert_raw(raw_list)
|
7
|
+
raw_list.map do |item|
|
8
|
+
if item.kind_of?(String)
|
9
|
+
Fixture.new(item)
|
10
|
+
else
|
11
|
+
Fixture.new(item[:fixture], item[:options])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module SPV
|
2
|
+
class Fixtures
|
3
|
+
# Prepares incoming raw fixtures to be used for inserting
|
4
|
+
# into VCR
|
5
|
+
class Handler
|
6
|
+
def initialize(options, convertor = Converter)
|
7
|
+
@options = options
|
8
|
+
|
9
|
+
@converter = convertor
|
10
|
+
end
|
11
|
+
|
12
|
+
def handle_raw(raw_fixtures, modifiers)
|
13
|
+
converted_fixtures = @converter.convert_raw(raw_fixtures)
|
14
|
+
|
15
|
+
modifiers.map do |modifier|
|
16
|
+
converted_fixtures.each do |converted_fixture|
|
17
|
+
modifier.modify(converted_fixture)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
converted_fixtures
|
22
|
+
end
|
23
|
+
|
24
|
+
def handle_set_raws(*fixtures_set, modifiers)
|
25
|
+
fixtures_set.map do |fixtures_raw|
|
26
|
+
handle_raw fixtures_raw, modifiers
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module SPV
|
2
|
+
class Fixtures
|
3
|
+
# Takes cares about inserting and ejecting fixtures
|
4
|
+
# from Vcr.
|
5
|
+
class Manager
|
6
|
+
def initialize(options)
|
7
|
+
@options = options
|
8
|
+
end
|
9
|
+
|
10
|
+
# Injects given fixtures to Vcr.
|
11
|
+
#
|
12
|
+
# @param fixtures [Array<SPV::Fixture>] List of fixtures.
|
13
|
+
#
|
14
|
+
# @return [void]
|
15
|
+
#
|
16
|
+
# @raise [ArgumentError] If a list of fixtures is empty.
|
17
|
+
def inject(fixtures)
|
18
|
+
raise ArgumentError.new(
|
19
|
+
'No fixtures were specified to insert them into VCR'
|
20
|
+
) if fixtures.size == 0
|
21
|
+
|
22
|
+
fixtures.each do |fixture|
|
23
|
+
VCR.insert_cassette fixture.name, fixture.options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Ejects all fixtures from Vcr.
|
28
|
+
# Now it doesn't care which fixtures were inserted by
|
29
|
+
# an instance of this class. After calling this method
|
30
|
+
# Vcr will have no inserted fixtures at all.
|
31
|
+
#
|
32
|
+
# @return [void]
|
33
|
+
def eject
|
34
|
+
SPV::Helpers.eject_all_cassettes
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module SPV
|
2
|
+
class Fixtures
|
3
|
+
module Modifiers
|
4
|
+
# It takes a fixture and replaces "~/" with
|
5
|
+
# a defined home path
|
6
|
+
class HomePath
|
7
|
+
def initialize(options)
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
|
11
|
+
def modify(fixture)
|
12
|
+
if fixture.has_link_to_home_path?
|
13
|
+
if @options.home_path
|
14
|
+
fixture.set_home_path(@options.home_path)
|
15
|
+
else
|
16
|
+
raise ArgumentError.new(
|
17
|
+
"You are trying to use a home path for #{fixture.name} fixture. " \
|
18
|
+
"Home path cannot be used since it is not defined, please refer to the documentation " \
|
19
|
+
"to make sure you define the home path properly."
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module SPV
|
2
|
+
class Fixtures
|
3
|
+
module Modifiers
|
4
|
+
# It takes a fixture and adds a path to it
|
5
|
+
class Path
|
6
|
+
def initialize(options)
|
7
|
+
@options = options
|
8
|
+
end
|
9
|
+
|
10
|
+
def modify(fixture)
|
11
|
+
if fixture.has_link_to_home_path?
|
12
|
+
raise HomePathError.new(
|
13
|
+
"You cannot use the home path while listing fixtures in the 'path' method. " <<
|
14
|
+
"Please, use 'fixtures' method for '#{fixture.clean_name}' fixture or " <<
|
15
|
+
"you can additionally use the 'path' method where you will specify a home path as a path name." <<
|
16
|
+
"Example: path('~/', ['#{fixture.clean_name}'])"
|
17
|
+
)
|
18
|
+
else
|
19
|
+
path = @options.path
|
20
|
+
path = path + '/' unless path[-1, 1] == '/'
|
21
|
+
|
22
|
+
fixture.add_path(path)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class HomePathError < ArgumentError; end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module SPV
|
2
|
+
class Fixtures
|
3
|
+
# This class is responsible for keeping a list
|
4
|
+
# of prepared fixtures which will be inserted to Vcr.
|
5
|
+
class TmpKeeper
|
6
|
+
attr_reader :fixtures
|
7
|
+
|
8
|
+
def initialize(options)
|
9
|
+
@fixtures, @options = [], options
|
10
|
+
end
|
11
|
+
|
12
|
+
def clean_fixtures
|
13
|
+
@fixtures = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_fixtures(new_fixtures)
|
17
|
+
@fixtures.concat(new_fixtures)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module SPV
|
2
|
+
# This class is a container for keeping all prepared fixtures for inserting
|
3
|
+
# into VCR.
|
4
|
+
class Fixtures
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
def initialize(vals)
|
8
|
+
@container = vals.each_with_object({}) do |fixture, memo|
|
9
|
+
memo[fixture.name] = fixture
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def exchange(old_vals, new_vals)
|
14
|
+
new_list = self.each_with_object([]) do |item, memo|
|
15
|
+
memo << item unless old_vals.any? {|old_item| item.name == old_item.name }
|
16
|
+
end
|
17
|
+
|
18
|
+
self.class.new(new_list.concat(new_vals))
|
19
|
+
end
|
20
|
+
|
21
|
+
def replace(vals)
|
22
|
+
if vals.length > 0
|
23
|
+
self.class.new(vals)
|
24
|
+
else
|
25
|
+
self
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def union(vals)
|
30
|
+
self.class.new(@container.values.concat(vals))
|
31
|
+
end
|
32
|
+
|
33
|
+
def each(&block)
|
34
|
+
@container.values.each &block
|
35
|
+
end
|
36
|
+
|
37
|
+
def size
|
38
|
+
@container.values
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# TODO: should be this class immutable?
|
2
|
+
module SPV
|
3
|
+
class Options
|
4
|
+
attr_accessor :waiter, :waiter_options, :home_path
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
options.each do |key, val|
|
8
|
+
public_send("#{key}=", val)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def home_path=(val)
|
13
|
+
val << '/' unless val[-1, 1] == '/'
|
14
|
+
|
15
|
+
@home_path = val
|
16
|
+
end
|
17
|
+
|
18
|
+
def clone_options
|
19
|
+
dup
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module SitePrism::ElementContainer
|
2
|
+
def element_with_vcr(element_name, *args, &block)
|
3
|
+
element element_name, *args
|
4
|
+
|
5
|
+
origin_element_name = "origin_#{element_name}"
|
6
|
+
|
7
|
+
alias_method origin_element_name, element_name
|
8
|
+
|
9
|
+
define_method element_name.to_s do
|
10
|
+
elem = public_send(origin_element_name)
|
11
|
+
|
12
|
+
SPV::Element.new(elem, self, &block)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module SitePrism
|
2
|
+
class Page
|
3
|
+
# TODO: it should make sure this method does not a native method of SitePrism::Page class
|
4
|
+
def self.inherited(subclass)
|
5
|
+
# This code is required to allow subpages to inherit
|
6
|
+
# a defined adjuster block. Otherwise, that block should be
|
7
|
+
# duplicated in a subpage as well.
|
8
|
+
subclass.instance_variable_set(:@vcr_adjuster, @vcr_adjuster)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.vcr_options_for_load(&block)
|
12
|
+
@vcr_adjuster = block
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.vcr_adjuster
|
16
|
+
@vcr_adjuster
|
17
|
+
end
|
18
|
+
|
19
|
+
def apply_vcr(*args, action_block, &adjusting_block)
|
20
|
+
applier = SPV::Applier.new(
|
21
|
+
self,
|
22
|
+
&self.class.vcr_adjuster
|
23
|
+
)
|
24
|
+
|
25
|
+
applier.apply(
|
26
|
+
adjusting_block
|
27
|
+
) do
|
28
|
+
action_block.call
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def load_and_apply_vcr(*args, &adjusting_block)
|
33
|
+
action_block = proc { load(*args) }
|
34
|
+
|
35
|
+
apply_vcr(
|
36
|
+
action_block,
|
37
|
+
&adjusting_block
|
38
|
+
)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module SPV
|
2
|
+
module Helpers
|
3
|
+
# Ejects all cassettes from Vcr.
|
4
|
+
#
|
5
|
+
# It can be useful when you don't define a waiter while describing
|
6
|
+
# cassettes which will be applied on an action (click,
|
7
|
+
# page loading actions or any other). If you don't define a waiter
|
8
|
+
# this method should be used to avoid data mixing which can lead you to wrong
|
9
|
+
# behavior in your acceptance tests.
|
10
|
+
#
|
11
|
+
# @return [void]
|
12
|
+
# @api public
|
13
|
+
def self.eject_all_cassettes
|
14
|
+
while VCR.eject_cassette
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module SPV
|
2
|
+
class Waiter
|
3
|
+
def initialize(node, fixtures_manager, options)
|
4
|
+
@node, @waiter_method = node, options.waiter
|
5
|
+
@fixtures_manager = fixtures_manager
|
6
|
+
@options = options.waiter_options || {}
|
7
|
+
end
|
8
|
+
|
9
|
+
def wait
|
10
|
+
if @waiter_method
|
11
|
+
@node.instance_eval &@waiter_method
|
12
|
+
|
13
|
+
if @options.fetch(:eject_cassettes, true)
|
14
|
+
@fixtures_manager.eject
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def with_new_options(options)
|
20
|
+
self.class.new(@node, @fixtures_manager, options)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
require 'capybara'
|
3
|
+
require 'site_prism'
|
4
|
+
require 'webmock'
|
5
|
+
|
6
|
+
require 'site_prism_vcr/version'
|
7
|
+
require 'site_prism_vcr/element'
|
8
|
+
require 'site_prism_vcr/applier'
|
9
|
+
require 'site_prism_vcr/fixture'
|
10
|
+
require 'site_prism_vcr/fixtures'
|
11
|
+
require 'site_prism_vcr/fixtures/tmp_keeper'
|
12
|
+
require 'site_prism_vcr/fixtures/converter'
|
13
|
+
require 'site_prism_vcr/fixtures/manager'
|
14
|
+
require 'site_prism_vcr/fixtures/handler'
|
15
|
+
require 'site_prism_vcr/fixtures/modifiers/path'
|
16
|
+
require 'site_prism_vcr/fixtures/modifiers/home_path'
|
17
|
+
require 'site_prism_vcr/options'
|
18
|
+
require 'site_prism_vcr/options_with_path'
|
19
|
+
require 'site_prism_vcr/dsl/initial_adjuster'
|
20
|
+
require 'site_prism_vcr/dsl/adjuster'
|
21
|
+
require 'site_prism_vcr/waiter'
|
22
|
+
require 'site_prism_vcr/vcr_helpers'
|
23
|
+
require 'site_prism_vcr/patches/page'
|
24
|
+
require 'site_prism_vcr/patches/element_container'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'site_prism_vcr/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'site_prism.vcr'
|
8
|
+
spec.version = SPV::VERSION
|
9
|
+
spec.authors = ['Dmitriy Nesteryuk']
|
10
|
+
spec.email = ['nesterukd@gmail.com']
|
11
|
+
spec.description = 'This gem integrates VCR library into SitePrism'
|
12
|
+
spec.summary = 'VCR and SitePrism are awesome libraries. But, it is a bit difficult to work with them without some bridge between them. This gem combines these 2 libraries to provide a better way for stubbing external API request which your application is doing. This gem will be very helpful for developers which have an application working with an external API.'
|
13
|
+
spec.homepage = 'https://github.com/nestd/site_prism.vcr'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'site_prism', '~> 2.4'
|
22
|
+
spec.add_dependency 'vcr', '~> 2.6.0'
|
23
|
+
spec.add_dependency 'webmock'
|
24
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.github.com/users/max/orgs
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- GitHub.com
|
17
|
+
Date:
|
18
|
+
- Mon, 18 Mar 2013 21:29:04 GMT
|
19
|
+
Content-Type:
|
20
|
+
- application/json; charset=utf-8
|
21
|
+
Connection:
|
22
|
+
- keep-alive
|
23
|
+
Status:
|
24
|
+
- 200 OK
|
25
|
+
X-Ratelimit-Limit:
|
26
|
+
- '60'
|
27
|
+
X-Ratelimit-Remaining:
|
28
|
+
- '54'
|
29
|
+
X-Github-Media-Type:
|
30
|
+
- github.beta
|
31
|
+
X-Content-Type-Options:
|
32
|
+
- nosniff
|
33
|
+
Content-Length:
|
34
|
+
- '2'
|
35
|
+
Etag:
|
36
|
+
- '"d751713988987e9331980363e24189ce"'
|
37
|
+
Cache-Control:
|
38
|
+
- max-age=0, private, must-revalidate
|
39
|
+
body:
|
40
|
+
encoding: ASCII-8BIT
|
41
|
+
string: '{"cat_owner":"Arya Stark","cat_name":"Max"}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Thu, 23 May 2013 19:43:53 GMT
|
44
|
+
recorded_with: VCR 2.5.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.github.com/users/max/orgs
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- GitHub.com
|
17
|
+
Date:
|
18
|
+
- Mon, 18 Mar 2013 21:29:04 GMT
|
19
|
+
Content-Type:
|
20
|
+
- application/json; charset=utf-8
|
21
|
+
Connection:
|
22
|
+
- keep-alive
|
23
|
+
Status:
|
24
|
+
- 200 OK
|
25
|
+
X-Ratelimit-Limit:
|
26
|
+
- "60"
|
27
|
+
X-Ratelimit-Remaining:
|
28
|
+
- "54"
|
29
|
+
X-Github-Media-Type:
|
30
|
+
- github.beta
|
31
|
+
X-Content-Type-Options:
|
32
|
+
- nosniff
|
33
|
+
Content-Length:
|
34
|
+
- '2'
|
35
|
+
Etag:
|
36
|
+
- '"d751713988987e9331980363e24189ce"'
|
37
|
+
Cache-Control:
|
38
|
+
- max-age=0, private, must-revalidate
|
39
|
+
body:
|
40
|
+
encoding: ASCII-8BIT
|
41
|
+
string: '{"cat_owner":"<%= cat_owner %>","cat_name":"Max"}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Mon, 18 Mar 2013 21:29:05 GMT
|
44
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.github.com/users/max/orgs
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Server:
|
16
|
+
- GitHub.com
|
17
|
+
Date:
|
18
|
+
- Mon, 18 Mar 2013 21:29:04 GMT
|
19
|
+
Content-Type:
|
20
|
+
- application/json; charset=utf-8
|
21
|
+
Connection:
|
22
|
+
- keep-alive
|
23
|
+
Status:
|
24
|
+
- 200 OK
|
25
|
+
X-Ratelimit-Limit:
|
26
|
+
- "60"
|
27
|
+
X-Ratelimit-Remaining:
|
28
|
+
- "54"
|
29
|
+
X-Github-Media-Type:
|
30
|
+
- github.beta
|
31
|
+
X-Content-Type-Options:
|
32
|
+
- nosniff
|
33
|
+
Content-Length:
|
34
|
+
- '2'
|
35
|
+
Etag:
|
36
|
+
- '"d751713988987e9331980363e24189ce"'
|
37
|
+
Cache-Control:
|
38
|
+
- max-age=0, private, must-revalidate
|
39
|
+
body:
|
40
|
+
encoding: ASCII-8BIT
|
41
|
+
string: '{"cat_owner":"Bran Stark","cat_name":"Max"}'
|
42
|
+
http_version:
|
43
|
+
recorded_at: Tue, 18 May 2013 23:31:55 GMT
|
44
|
+
recorded_with: VCR 2.4.0
|