site_prism.vcr 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +5 -13
  2. data/.travis.yml +5 -0
  3. data/CHANGELOG.md +51 -4
  4. data/Gemfile +3 -4
  5. data/README.md +88 -10
  6. data/TODO.md +29 -31
  7. data/lib/site_prism_vcr/applier.rb +51 -13
  8. data/lib/site_prism_vcr/dsl/adjuster.rb +1 -1
  9. data/lib/site_prism_vcr/dsl/initial_adjuster.rb +26 -6
  10. data/lib/site_prism_vcr/fixture.rb +7 -4
  11. data/lib/site_prism_vcr/fixtures/manager.rb +30 -11
  12. data/lib/site_prism_vcr/fixtures/modifiers/path.rb +6 -6
  13. data/lib/site_prism_vcr/fixtures/modifiers/shortcut_path.rb +25 -0
  14. data/lib/site_prism_vcr/mixins/element.rb +23 -0
  15. data/lib/site_prism_vcr/mixins/page.rb +63 -0
  16. data/lib/site_prism_vcr/options.rb +20 -6
  17. data/lib/site_prism_vcr/patches/element.rb +4 -0
  18. data/lib/site_prism_vcr/patches/page.rb +2 -38
  19. data/lib/site_prism_vcr/version.rb +1 -1
  20. data/lib/site_prism_vcr.rb +2 -2
  21. data/spec/integration/elements/apply_spec.rb +4 -0
  22. data/spec/integration/pages/custom_event_spec.rb +1 -1
  23. data/spec/integration/pages/load_spec.rb +11 -0
  24. data/spec/spec_helper.rb +3 -2
  25. data/spec/spec_integration_helper.rb +0 -3
  26. data/spec/support/shared/integration/home_path.rb +1 -1
  27. data/spec/support/shared/integration/shortcut_path.rb +13 -0
  28. data/spec/support/site_prism/pages/page_load/subpage_with_fixtures.rb +14 -0
  29. data/spec/unit/applier_spec.rb +97 -43
  30. data/spec/unit/dsl/adjuster_spec.rb +7 -7
  31. data/spec/unit/dsl/initial_adjuster_spec.rb +29 -13
  32. data/spec/unit/element_spec.rb +3 -3
  33. data/spec/unit/fixture_spec.rb +47 -17
  34. data/spec/unit/fixtures/converter_spec.rb +1 -1
  35. data/spec/unit/fixtures/handler_spec.rb +3 -3
  36. data/spec/unit/fixtures/manager_spec.rb +76 -29
  37. data/spec/unit/fixtures/modifiers/path_spec.rb +10 -10
  38. data/spec/unit/fixtures/modifiers/relative_path_spec.rb +1 -1
  39. data/spec/unit/fixtures/modifiers/shortcut_path_spec.rb +61 -0
  40. data/spec/unit/{patches/element_container_spec.rb → mixins/element_spec.rb} +2 -2
  41. data/spec/unit/mixins/page_spec.rb +105 -0
  42. data/spec/unit/options_spec.rb +6 -6
  43. data/spec/unit/waiter_spec.rb +3 -3
  44. metadata +28 -22
  45. data/lib/site_prism_vcr/fixtures/modifiers/home_path.rb +0 -25
  46. data/lib/site_prism_vcr/patches/element_container.rb +0 -19
  47. data/spec/unit/fixtures/modifiers/home_path_spec.rb +0 -58
  48. data/spec/unit/patches/page_spec.rb +0 -50
@@ -0,0 +1,25 @@
1
+ require_relative 'base'
2
+
3
+ module SPV
4
+ class Fixtures
5
+ module Modifiers
6
+ # It takes a fixture and replaces a shortcut path with
7
+ # a full path to it.
8
+ class ShortcutPath < Base
9
+ def modify(fixture)
10
+ if shortcut = fixture.shortcut_path
11
+ if path = @options.shortcut_path(shortcut)
12
+ fixture.set_home_path(path)
13
+ else
14
+ raise ArgumentError.new(
15
+ "You are trying to use the '#{shortcut}' shortcut path for #{fixture.name} fixture. " \
16
+ "This shortcut path cannot be used since it is not defined, please refer to the documentation " \
17
+ "to make sure you properly define the shortcut path."
18
+ )
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,23 @@
1
+ module SPV
2
+ module Mixins
3
+ module Element
4
+ def element_with_vcr(element_name, *args, &block)
5
+ element element_name, *args
6
+
7
+ link_vcr_with_element(element_name, &block)
8
+ end
9
+
10
+ def link_vcr_with_element(element_name, &block)
11
+ origin_element_name = "origin_#{element_name}"
12
+
13
+ alias_method origin_element_name, element_name
14
+
15
+ define_method element_name.to_s do
16
+ elem = public_send(origin_element_name)
17
+
18
+ SPV::Element.new(elem, self, &block)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,63 @@
1
+ require 'forwardable'
2
+
3
+ module SPV
4
+ module Mixins
5
+ module Page
6
+ def self.included(klass)
7
+ klass.extend(ClassMethods)
8
+ klass.send(:include, InstanceMethods)
9
+ klass.instance_variable_set(:@vcr_child_adjusters, [])
10
+ end
11
+
12
+ module ClassMethods
13
+ attr_reader :vcr_adjuster, :vcr_child_adjusters
14
+
15
+ def inherited(subclass)
16
+ # This code is required to allow subpages to inherit
17
+ # a defined adjuster block. Otherwise, that block should be
18
+ # duplicated in a subpage as well.
19
+ subclass.instance_variable_set(:@vcr_adjuster, @vcr_adjuster)
20
+ subclass.instance_variable_set(:@vcr_child_adjusters, @vcr_child_adjusters.dup)
21
+ end
22
+
23
+ def vcr_options_for_load(&block)
24
+ @vcr_adjuster = block
25
+ end
26
+
27
+ def adjust_parent_vcr_options(&block)
28
+ raise ArgumentError.new(
29
+ 'There is not any Vcr options defined for the parent class'
30
+ ) unless self.vcr_adjuster
31
+
32
+ self.vcr_child_adjusters << block
33
+ end
34
+ end
35
+
36
+ module InstanceMethods
37
+ def load_and_apply_vcr(*args, &block)
38
+ shift_event { load(*args) }.apply_vcr(&block)
39
+ end
40
+
41
+ def shift_event(&block)
42
+ vcr_applier.shift_event(&block)
43
+ end
44
+
45
+ private
46
+ def vcr_applier
47
+ @vcr_applier ||= begin
48
+ applier = SPV::Applier.new(
49
+ self,
50
+ &self.class.vcr_adjuster
51
+ )
52
+
53
+ self.class.vcr_child_adjusters.each do |block|
54
+ applier.alter_fixtures(&block)
55
+ end
56
+
57
+ applier
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -3,25 +3,39 @@ module SPV
3
3
  # and options for a waiter which holds execution until expectation
4
4
  # has been met.
5
5
  class Options
6
- attr_accessor :waiter, :waiter_options, :home_path
6
+ attr_accessor :waiter, :waiter_options, :shortcut_paths
7
7
 
8
8
  def initialize(options = {})
9
+ @shortcut_paths = {}
10
+
9
11
  options.each do |key, val|
10
12
  public_send("#{key}=", val)
11
13
  end
12
14
  end
13
15
 
14
- # Defines path to fixtures.
16
+ # Defines shortcut path to fixtures.
15
17
  #
16
- # @param val [String] Path to fixtures.
18
+ # @param shortcut [String]
19
+ # @param path [String] Path to fixtures.
17
20
  #
18
21
  # @return [void]
19
22
  #
20
23
  # @api private
21
- def home_path=(val)
22
- val << '/' unless val[-1, 1] == '/'
24
+ def add_shortcut_path(shortcut, path)
25
+ path << '/' unless path[-1, 1] == '/'
26
+
27
+ self.shortcut_paths[shortcut] = path
28
+ end
23
29
 
24
- @home_path = val
30
+ # Returns a full path associated with a shortcut.
31
+ #
32
+ # @param shortcut [String]
33
+ #
34
+ # @return [String]
35
+ #
36
+ # @api private
37
+ def shortcut_path(shortcut)
38
+ self.shortcut_paths[shortcut]
25
39
  end
26
40
 
27
41
  # Returns a copy of itself.
@@ -0,0 +1,4 @@
1
+ require_relative '../mixins/element'
2
+
3
+ SitePrism::Page.extend(SPV::Mixins::Element)
4
+ SitePrism::Section.extend(SPV::Mixins::Element)
@@ -1,39 +1,3 @@
1
- require 'forwardable'
1
+ require_relative '../mixins/page'
2
2
 
3
- module SitePrism
4
- class Page
5
- extend Forwardable
6
-
7
- def_delegator :@applier, :shift_event
8
-
9
- class << self
10
- def inherited(subclass)
11
- # This code is required to allow subpages to inherit
12
- # a defined adjuster block. Otherwise, that block should be
13
- # duplicated in a subpage as well.
14
- subclass.instance_variable_set(:@vcr_adjuster, @vcr_adjuster)
15
- end
16
-
17
- def vcr_options_for_load(&block)
18
- @vcr_adjuster = block
19
- end
20
-
21
- def vcr_adjuster
22
- @vcr_adjuster
23
- end
24
- end
25
-
26
- def initialize(*args)
27
- super
28
-
29
- @applier = SPV::Applier.new(
30
- self,
31
- &self.class.vcr_adjuster
32
- )
33
- end
34
-
35
- def load_and_apply_vcr(*args, &block)
36
- shift_event { load(*args) }.apply_vcr(&block)
37
- end
38
- end
39
- end
3
+ SitePrism::Page.send(:include, SPV::Mixins::Page)
@@ -1,3 +1,3 @@
1
1
  module SPV
2
- VERSION = '0.1.2'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -13,7 +13,7 @@ require 'site_prism_vcr/fixtures/converter'
13
13
  require 'site_prism_vcr/fixtures/manager'
14
14
  require 'site_prism_vcr/fixtures/handler'
15
15
  require 'site_prism_vcr/fixtures/modifiers/path'
16
- require 'site_prism_vcr/fixtures/modifiers/home_path'
16
+ require 'site_prism_vcr/fixtures/modifiers/shortcut_path'
17
17
  require 'site_prism_vcr/fixtures/modifiers/relative_path'
18
18
  require 'site_prism_vcr/options'
19
19
  require 'site_prism_vcr/options_with_path'
@@ -22,4 +22,4 @@ require 'site_prism_vcr/dsl/adjuster'
22
22
  require 'site_prism_vcr/waiter'
23
23
  require 'site_prism_vcr/vcr_helpers'
24
24
  require 'site_prism_vcr/patches/page'
25
- require 'site_prism_vcr/patches/element_container'
25
+ require 'site_prism_vcr/patches/element'
@@ -93,6 +93,10 @@ feature 'Elements > Apply Vcr' do
93
93
  let(:actor_without_home_path) { shift_click_event_to(:link_with_one_request) }
94
94
  end
95
95
 
96
+ it_behaves_like 'when a shorcut path is define' do
97
+ let(:actor) { shift_click_event_to(:link_with_one_request) }
98
+ end
99
+
96
100
  it_behaves_like 'when a default fixture is exchanged' do
97
101
  let(:actor_with_home_path) { shift_click_event_to(:link_with_home_path) }
98
102
  let(:actor_without_home_path) { shift_click_event_to(:link_with_2_requests) }
@@ -13,7 +13,7 @@ feature 'Pages > Load > Custom event' do
13
13
  end
14
14
 
15
15
  it 'loads fixtures on opening a page by click on a link' do
16
- expect(one_request_page.displayed?).to be_true
16
+ expect(one_request_page.displayed?).to be_truthy
17
17
 
18
18
  expect(one_request_page).to have_content('Ned Stark')
19
19
  end
@@ -27,6 +27,17 @@ feature 'Pages > Load' do
27
27
 
28
28
  expect(cat_owner).to have_content('Ned Stark')
29
29
  end
30
+
31
+ context 'when a subpage defines own fixtures' do
32
+ let(:test_app_page) { PageLoad::SubPageWithFixtures.new }
33
+
34
+ it 'subpage uses fixtures from the parent page and own fixtures' do
35
+ test_app_page.load_and_apply_vcr
36
+
37
+ expect(cat_owner).to have_content('Ned Stark')
38
+ expect(cat_owner).to have_content('Robb Stark')
39
+ end
40
+ end
30
41
  end
31
42
 
32
43
  it_behaves_like 'when a custom fixture is applied' do
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'bundler/setup'
2
2
 
3
3
  require 'rspec'
4
- require 'rspec/fire'
5
4
  require 'coveralls'
6
5
 
7
6
  require 'site_prism.vcr'
@@ -13,7 +12,9 @@ RSpec.configure do |config|
13
12
  c.syntax = :expect
14
13
  end
15
14
 
16
- config.include(RSpec::Fire)
15
+ config.mock_with :rspec do |mocks|
16
+ mocks.verify_doubled_constant_names = true
17
+ end
17
18
  end
18
19
 
19
20
  VCR.configure do |c|
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  require 'capybara/rspec'
4
- require 'capybara/firebug'
5
4
 
6
5
  require 'support/test_app/test_app'
7
6
  require 'support/server'
@@ -13,8 +12,6 @@ Capybara.app = TestApp
13
12
  Capybara.default_driver = :selenium
14
13
  HTTPI.log = false
15
14
 
16
- Selenium::WebDriver::Firefox::Profile.firebug_version = '1.11.0'
17
-
18
15
  Capybara.server_port = Server.find_available_port
19
16
 
20
17
  VCR.configure do |c|
@@ -61,7 +61,7 @@ shared_examples 'when a home path is define' do
61
61
  end
62
62
  end
63
63
 
64
- context 'when a home path is used to point to a cessette in a sub directory', mytest: true do
64
+ context 'when a home path is used to point to a cassette in a sub directory' do
65
65
  before do
66
66
  actor_without_home_path.public_send(action_method) do
67
67
  home_path 'custom'
@@ -0,0 +1,13 @@
1
+ shared_examples 'when a shorcut path is define' do
2
+ before do
3
+ actor.public_send(action_method) do
4
+ shortcut_path 'c', 'custom'
5
+
6
+ fixtures [':c/bran_stark']
7
+ end
8
+ end
9
+
10
+ it 'applies a stored fixture in the directory defined in the shorcut path' do
11
+ expect(cat_owner).to have_content('Bran Stark')
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ require_relative './one_request'
2
+
3
+ module PageLoad
4
+ class SubPageWithFixtures < OneRequestPage
5
+ set_url '/immediate-http-interactions/two-requests'
6
+
7
+ adjust_parent_vcr_options do
8
+ fixtures ['robb_stark']
9
+ waiter &:wait_for_ned_stark_and_robb_stark
10
+
11
+ union
12
+ end
13
+ end
14
+ end
@@ -1,9 +1,31 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe SPV::Applier do
4
+ shared_examples 'adjusting fixtures' do
5
+ it 'initializes the fixtures adjuster with proper options' do
6
+ expect(SPV::DSL::Adjuster).to receive(:new).with(
7
+ proper_options,
8
+ fixtures
9
+ )
10
+
11
+ do_action
12
+ end
13
+
14
+ it 'calls a given block within the context of the adjuster' do
15
+ expect(adjuster).to receive(:fixtures)
16
+
17
+ do_action
18
+ end
19
+
20
+ it 'receives the fixtures container' do
21
+ expect(adjuster).to receive(:prepare_fixtures)
22
+
23
+ do_action
24
+ end
25
+ end
26
+
4
27
  let(:node) { double('node of DOM') }
5
28
  let(:options) { instance_double('SPV::Options') }
6
- let(:fixtures_manager) { instance_double('SPV::Fixtures::Manager', inject: true) }
7
29
  let(:fixtures) { double('fixtures') }
8
30
  let(:initial_adjuster) do
9
31
  instance_double(
@@ -13,14 +35,12 @@ describe SPV::Applier do
13
35
  end
14
36
 
15
37
  before do
16
- SPV::Options.stub(:new).and_return(options)
17
- SPV::DSL::InitialAdjuster.stub(:new).and_return(initial_adjuster)
18
-
19
- SPV::Fixtures::Manager.stub(:new).and_return(fixtures_manager)
38
+ allow(SPV::Options).to receive(:new).and_return(options)
39
+ allow(SPV::DSL::InitialAdjuster).to receive(:new).and_return(initial_adjuster)
20
40
  end
21
41
 
22
42
  before do
23
- SPV::DSL::InitialAdjuster.stub(:new).and_return(initial_adjuster)
43
+ allow(SPV::DSL::InitialAdjuster).to receive(:new).and_return(initial_adjuster)
24
44
  end
25
45
 
26
46
  describe '.new' do
@@ -42,9 +62,9 @@ describe SPV::Applier do
42
62
 
43
63
  context 'when a block is given' do
44
64
  it 'calls a given block within the context of the adjuster' do
45
- expect(initial_adjuster).to receive(:mymeth)
65
+ expect(initial_adjuster).to receive(:home_path)
46
66
 
47
- described_class.new(node) { mymeth }
67
+ described_class.new(node) { home_path 'test' }
48
68
  end
49
69
  end
50
70
 
@@ -59,61 +79,95 @@ describe SPV::Applier do
59
79
 
60
80
  subject
61
81
  end
82
+ end
62
83
 
63
- it 'initializes the fixtures manager' do
64
- expect(SPV::Fixtures::Manager).to receive(:new).with(
65
- options
66
- ).and_return(fixtures_manager)
84
+ describe '#alter_fixtures' do
85
+ let(:prepared_fixtures) { 'prepared_fixtures by adjuster' }
67
86
 
68
- subject
87
+ let(:adjuster) do
88
+ instance_double(
89
+ 'SPV::DSL::Adjuster',
90
+ fixtures: true,
91
+ prepare_fixtures: prepared_fixtures
92
+ )
93
+ end
94
+
95
+ let(:do_action) { applier.alter_fixtures { fixtures [] } }
96
+
97
+ subject(:applier) { described_class.new(node) { } }
98
+
99
+ before do
100
+ allow(SPV::DSL::Adjuster).to receive(:new).and_return(adjuster)
101
+ end
102
+
103
+ it_behaves_like 'adjusting fixtures' do
104
+ let(:proper_options) { options }
69
105
  end
70
106
  end
71
107
 
72
108
  describe '#apply_vcr' do
73
- let(:node) { double('node of DOM', click: true) }
109
+ let(:node) { double('node of DOM', click: true) }
110
+ let(:cloned_options) { 'cloned options' }
111
+ let(:options) { instance_double('SPV::Options', clone_options: cloned_options) }
112
+
113
+ let(:fixtures_manager) { instance_double('SPV::Fixtures::Manager', inject: true) }
114
+
74
115
  subject(:applier) { described_class.new(node) { } }
75
116
 
76
117
  context 'when an event is shifted' do
77
- let(:cloned_options) { 'cloned options' }
78
- let(:options) { instance_double('SPV::Options', clone_options: cloned_options) }
79
- let(:prepared_fixtures) { 'prepared_fixtures by adjuster' }
80
-
81
- let(:adjuster) do
82
- instance_double(
83
- 'DSL::Adjuster',
84
- fixtures: true,
85
- prepare_fixtures: prepared_fixtures
86
- )
87
- end
88
-
89
118
  before do
90
- SPV::DSL::Adjuster.stub(:new).and_return(adjuster)
91
- SPV::Waiter.stub(:wait)
119
+ allow(SPV::Fixtures::Manager).to receive(:inject).and_return(fixtures_manager)
120
+ allow(SPV::Waiter).to receive(:wait)
92
121
 
93
122
  applier.shift_event { node.click }
94
123
  end
95
124
 
96
- it 'initializes the fixtures adjuster with a new instance of options' do
97
- expect(SPV::DSL::Adjuster).to receive(:new).with(
98
- cloned_options,
99
- fixtures
100
- )
125
+ context 'when the adjusting block is given' do
126
+ let(:prepared_fixtures) { 'prepared_fixtures by adjuster' }
101
127
 
102
- applier.apply_vcr
103
- end
128
+ let(:adjuster) do
129
+ instance_double(
130
+ 'SPV::DSL::Adjuster',
131
+ fixtures: true,
132
+ prepare_fixtures: prepared_fixtures
133
+ )
134
+ end
104
135
 
105
- context 'when a block is given' do
106
- it 'calls a given block within the context of the adjuster' do
107
- expect(adjuster).to receive(:fixtures)
136
+ let(:do_action) { applier.apply_vcr { fixtures [] } }
108
137
 
109
- applier.apply_vcr { fixtures }
138
+ before do
139
+ allow(SPV::DSL::Adjuster).to receive(:new).and_return(adjuster)
140
+ end
141
+
142
+ it_behaves_like 'adjusting fixtures' do
143
+ let(:proper_options) { cloned_options }
144
+ end
145
+
146
+ it 'applies the adjusted fixtures' do
147
+ expect(SPV::Fixtures::Manager).to receive(:inject).with(
148
+ prepared_fixtures,
149
+ cloned_options
150
+ )
151
+
152
+ do_action
110
153
  end
111
154
  end
112
155
 
113
- it 'applies fixtures' do
114
- expect(fixtures_manager).to receive(:inject).with(prepared_fixtures)
156
+ context 'when the adjusting block is not given' do
157
+ it 'does not initialize the fixture adjuster' do
158
+ expect(SPV::DSL::Adjuster).to_not receive(:new)
115
159
 
116
- applier.apply_vcr
160
+ applier.apply_vcr
161
+ end
162
+
163
+ it 'applies the default fixtures' do
164
+ expect(SPV::Fixtures::Manager).to receive(:inject).with(
165
+ fixtures,
166
+ cloned_options
167
+ )
168
+
169
+ applier.apply_vcr
170
+ end
117
171
  end
118
172
 
119
173
  it 'does the click action over a node' do
@@ -137,7 +191,7 @@ describe SPV::Applier do
137
191
  it 'raises an error about no event' do
138
192
  expect{ subject.apply_vcr }.to raise_error(
139
193
  SPV::Applier::EventError,
140
- 'Event is not shifted, before applying Vcr you have to shift event with "shift_event" method'
194
+ 'Event is not shifted, before applying VCR you have to shift event with "shift_event" method'
141
195
  )
142
196
  end
143
197
  end
@@ -19,7 +19,7 @@ describe SPV::DSL::Adjuster do
19
19
  }
20
20
 
21
21
  before do
22
- SPV::Fixtures::TmpKeeper.stub(:new).and_return(tmp_keeper)
22
+ allow(SPV::Fixtures::TmpKeeper).to receive(:new).and_return(tmp_keeper)
23
23
  end
24
24
 
25
25
  subject { described_class.new(options, fixtures) }
@@ -57,17 +57,17 @@ describe SPV::DSL::Adjuster do
57
57
  let(:handled_new_fixtures) { ['old fixture'] }
58
58
 
59
59
  before do
60
- SPV::Fixtures::Handler.stub(:new).and_return(fixtures_handler)
61
- SPV::Fixtures::Modifiers::HomePath.stub(:new).and_return(home_path_modifier)
60
+ allow(SPV::Fixtures::Handler).to receive(:new).and_return(fixtures_handler)
61
+ allow(SPV::Fixtures::Modifiers::ShortcutPath).to receive(:new).and_return(home_path_modifier)
62
62
 
63
- fixtures_handler.stub(:handle_set_raws).and_return([
63
+ allow(fixtures_handler).to receive(:handle_set_raws).and_return([
64
64
  handled_old_fixtures,
65
65
  handled_new_fixtures
66
66
  ])
67
67
  end
68
68
 
69
69
  it 'initializes the home path modifier' do
70
- expect(SPV::Fixtures::Modifiers::HomePath).to receive(:new).with(options)
70
+ expect(SPV::Fixtures::Modifiers::ShortcutPath).to receive(:new).with(options)
71
71
 
72
72
  exchange
73
73
  end
@@ -108,7 +108,7 @@ describe SPV::DSL::Adjuster do
108
108
  let(:replaced_fixtures) { 'replaced fixtures' }
109
109
 
110
110
  before do
111
- fixtures.stub(:replace).and_return(replaced_fixtures)
111
+ allow(fixtures).to receive(:replace).and_return(replaced_fixtures)
112
112
 
113
113
  subject.replace
114
114
  end
@@ -128,7 +128,7 @@ describe SPV::DSL::Adjuster do
128
128
  let(:new_fixtures) { 'new fixtures' }
129
129
 
130
130
  before do
131
- fixtures.stub(:union).and_return(new_fixtures)
131
+ allow(fixtures).to receive(:union).and_return(new_fixtures)
132
132
  subject.union
133
133
  end
134
134