Skip to content

Commit b4ba5fd

Browse files
authored
Merge pull request #501 from gocardless/rspec-rails-tw-6.0
2 parents e895155 + 1e258af commit b4ba5fd

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

spec/statesman/adapters/active_record_queries_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def self.initial_state; end
254254
end
255255

256256
it "does not raise an error" do
257-
expect { check_missing_methods! }.to_not raise_exception(NotImplementedError)
257+
expect { check_missing_methods! }.to_not raise_exception
258258
end
259259
end
260260

spec/statesman/adapters/active_record_spec.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
end
113113

114114
describe "#create" do
115-
subject { -> { create } }
115+
subject(:transition) { create }
116116

117117
let!(:adapter) do
118118
described_class.new(MyActiveRecordModelTransition, model, observer)
@@ -173,19 +173,17 @@
173173
end
174174
end
175175

176-
it { is_expected.to raise_exception(ActiveRecord::RecordNotUnique) }
176+
it { expect { transition }.to raise_exception(ActiveRecord::RecordNotUnique) }
177177
end
178178

179179
context "other errors" do
180180
let(:error) { StandardError }
181181

182-
it { is_expected.to raise_exception(StandardError) }
182+
it { expect { transition }.to raise_exception(StandardError) }
183183
end
184184
end
185185

186186
describe "updating the most_recent column" do
187-
subject { create }
188-
189187
context "with no previous transition" do
190188
its(:most_recent) { is_expected.to eq(true) }
191189
end

spec/statesman/adapters/shared_examples.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
end
3131

3232
describe "#create" do
33-
subject { -> { create } }
33+
subject(:transition) { create }
3434

3535
let(:from) { :x }
3636
let(:to) { :y }
3737
let(:there) { :z }
3838
let(:create) { adapter.create(from, to) }
3939

40-
it { is_expected.to change(adapter.history, :count).by(1) }
40+
it { expect { transition }.to change(adapter.history, :count).by(1) }
4141

4242
context "the new transition" do
4343
subject(:instance) { create }

spec/statesman/machine_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
end
2929

3030
describe ".remove_state" do
31-
subject(:remove_state) { -> { machine.remove_state(:x) } }
31+
subject(:remove_state) { machine.remove_state(:x) }
3232

3333
before do
3434
machine.class_eval do
@@ -39,7 +39,7 @@
3939
end
4040

4141
it "removes the state" do
42-
expect(remove_state).
42+
expect { remove_state }.
4343
to change(machine, :states).
4444
from(match_array(%w[x y z])).
4545
to(%w[y z])
@@ -49,7 +49,7 @@
4949
before { machine.transition from: :x, to: :y }
5050

5151
it "removes the transition" do
52-
expect(remove_state).
52+
expect { remove_state }.
5353
to change(machine, :successors).
5454
from({ "x" => ["y"] }).
5555
to({})
@@ -59,7 +59,7 @@
5959
before { machine.transition from: :x, to: :z }
6060

6161
it "removes all transitions" do
62-
expect(remove_state).
62+
expect { remove_state }.
6363
to change(machine, :successors).
6464
from({ "x" => %w[y z] }).
6565
to({})
@@ -71,7 +71,7 @@
7171
before { machine.transition from: :y, to: :x }
7272

7373
it "removes the transition" do
74-
expect(remove_state).
74+
expect { remove_state }.
7575
to change(machine, :successors).
7676
from({ "y" => ["x"] }).
7777
to({})
@@ -81,7 +81,7 @@
8181
before { machine.transition from: :z, to: :x }
8282

8383
it "removes all transitions" do
84-
expect(remove_state).
84+
expect { remove_state }.
8585
to change(machine, :successors).
8686
from({ "y" => ["x"], "z" => ["x"] }).
8787
to({})
@@ -104,7 +104,7 @@
104104
end
105105

106106
it "removes the guard" do
107-
expect(remove_state).
107+
expect { remove_state }.
108108
to change(machine, :callbacks).
109109
from(a_hash_including(guards: match_array(guards))).
110110
to(a_hash_including(guards: []))
@@ -125,7 +125,7 @@
125125
end
126126

127127
it "removes the guard" do
128-
expect(remove_state).
128+
expect { remove_state }.
129129
to change(machine, :callbacks).
130130
from(a_hash_including(guards: match_array(guards))).
131131
to(a_hash_including(guards: []))

statesman.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
3232
spec.add_development_dependency "rspec", "~> 3.1"
3333
spec.add_development_dependency "rspec-github", "~> 2.4.0"
3434
spec.add_development_dependency "rspec-its", "~> 1.1"
35-
spec.add_development_dependency "rspec-rails", "~> 3.1"
35+
spec.add_development_dependency "rspec-rails", "~> 6.0"
3636
spec.add_development_dependency "sqlite3", "~> 1.6.1"
3737
spec.add_development_dependency "timecop", "~> 0.9.1"
3838

0 commit comments

Comments
 (0)