Skip to content

Commit

Permalink
Update rspec-rails requirement from ~> 3.1 to ~> 6.0
Browse files Browse the repository at this point in the history
Recreation of the PR from dependabot due to CI changes. Also fixes
errors and warnings from RSpec, either pre-existing or due to the
dependency bump
  • Loading branch information
Tabby committed Mar 20, 2023
1 parent e895155 commit 1e258af
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion spec/statesman/adapters/active_record_queries_spec.rb
Expand Up @@ -254,7 +254,7 @@ def self.initial_state; end
end

it "does not raise an error" do
expect { check_missing_methods! }.to_not raise_exception(NotImplementedError)
expect { check_missing_methods! }.to_not raise_exception
end
end

Expand Down
8 changes: 3 additions & 5 deletions spec/statesman/adapters/active_record_spec.rb
Expand Up @@ -112,7 +112,7 @@
end

describe "#create" do
subject { -> { create } }
subject(:transition) { create }

let!(:adapter) do
described_class.new(MyActiveRecordModelTransition, model, observer)
Expand Down Expand Up @@ -173,19 +173,17 @@
end
end

it { is_expected.to raise_exception(ActiveRecord::RecordNotUnique) }
it { expect { transition }.to raise_exception(ActiveRecord::RecordNotUnique) }
end

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

it { is_expected.to raise_exception(StandardError) }
it { expect { transition }.to raise_exception(StandardError) }
end
end

describe "updating the most_recent column" do
subject { create }

context "with no previous transition" do
its(:most_recent) { is_expected.to eq(true) }
end
Expand Down
4 changes: 2 additions & 2 deletions spec/statesman/adapters/shared_examples.rb
Expand Up @@ -30,14 +30,14 @@
end

describe "#create" do
subject { -> { create } }
subject(:transition) { create }

let(:from) { :x }
let(:to) { :y }
let(:there) { :z }
let(:create) { adapter.create(from, to) }

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

context "the new transition" do
subject(:instance) { create }
Expand Down
16 changes: 8 additions & 8 deletions spec/statesman/machine_spec.rb
Expand Up @@ -28,7 +28,7 @@
end

describe ".remove_state" do
subject(:remove_state) { -> { machine.remove_state(:x) } }
subject(:remove_state) { machine.remove_state(:x) }

before do
machine.class_eval do
Expand All @@ -39,7 +39,7 @@
end

it "removes the state" do
expect(remove_state).
expect { remove_state }.
to change(machine, :states).
from(match_array(%w[x y z])).
to(%w[y z])
Expand All @@ -49,7 +49,7 @@
before { machine.transition from: :x, to: :y }

it "removes the transition" do
expect(remove_state).
expect { remove_state }.
to change(machine, :successors).
from({ "x" => ["y"] }).
to({})
Expand All @@ -59,7 +59,7 @@
before { machine.transition from: :x, to: :z }

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

it "removes the transition" do
expect(remove_state).
expect { remove_state }.
to change(machine, :successors).
from({ "y" => ["x"] }).
to({})
Expand All @@ -81,7 +81,7 @@
before { machine.transition from: :z, to: :x }

it "removes all transitions" do
expect(remove_state).
expect { remove_state }.
to change(machine, :successors).
from({ "y" => ["x"], "z" => ["x"] }).
to({})
Expand All @@ -104,7 +104,7 @@
end

it "removes the guard" do
expect(remove_state).
expect { remove_state }.
to change(machine, :callbacks).
from(a_hash_including(guards: match_array(guards))).
to(a_hash_including(guards: []))
Expand All @@ -125,7 +125,7 @@
end

it "removes the guard" do
expect(remove_state).
expect { remove_state }.
to change(machine, :callbacks).
from(a_hash_including(guards: match_array(guards))).
to(a_hash_including(guards: []))
Expand Down
2 changes: 1 addition & 1 deletion statesman.gemspec
Expand Up @@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rspec", "~> 3.1"
spec.add_development_dependency "rspec-github", "~> 2.4.0"
spec.add_development_dependency "rspec-its", "~> 1.1"
spec.add_development_dependency "rspec-rails", "~> 3.1"
spec.add_development_dependency "rspec-rails", "~> 6.0"
spec.add_development_dependency "sqlite3", "~> 1.6.1"
spec.add_development_dependency "timecop", "~> 0.9.1"

Expand Down

0 comments on commit 1e258af

Please sign in to comment.