From 34de314baa8c7b5b9daf5759b54fe3bfe14eded7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20B=C3=B6ttger?= Date: Sun, 14 Dec 2014 14:53:57 +0100 Subject: [PATCH] using RSpec 2.99 now (preparing RSpec 3) --- aasm.gemspec | 2 +- spec/unit/complex_example_spec.rb | 18 +++++++++--------- spec/unit/event_spec.rb | 12 ++++++------ spec/unit/inspection_spec.rb | 4 ++-- .../active_record_persistence_spec.rb | 16 ++++++++-------- spec/unit/subclassing_spec.rb | 2 +- spec/unit/transition_spec.rb | 10 +++++----- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/aasm.gemspec b/aasm.gemspec index ddef72a..84fe294 100644 --- a/aasm.gemspec +++ b/aasm.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'rake' s.add_development_dependency 'sdoc' - s.add_development_dependency 'rspec', '>= 2.14', '< 2.99' + s.add_development_dependency 'rspec', '2.99' # debugging # s.add_development_dependency 'debugger' diff --git a/spec/unit/complex_example_spec.rb b/spec/unit/complex_example_spec.rb index 6b7a2c6..7ed9b3d 100644 --- a/spec/unit/complex_example_spec.rb +++ b/spec/unit/complex_example_spec.rb @@ -8,7 +8,7 @@ describe 'on initialization' do end it 'should have an activation code' do - expect(auth.has_activation_code?).to be_true + expect(auth.has_activation_code?).to be_truthy expect(auth.activation_code).not_to be_nil end end @@ -19,24 +19,24 @@ describe 'when being unsuspended' do it 'should be able to be unsuspended' do auth.activate! auth.suspend! - expect(auth.may_unsuspend?).to be_true + expect(auth.may_unsuspend?).to be_truthy end it 'should not be able to be unsuspended into active' do auth.suspend! - expect(auth.may_unsuspend?(:active)).not_to be_true + expect(auth.may_unsuspend?(:active)).not_to be_truthy end it 'should be able to be unsuspended into active if polite' do auth.suspend! - expect(auth.may_wait?(:waiting, :please)).to be_true + expect(auth.may_wait?(:waiting, :please)).to be_truthy auth.wait!(nil, :please) end it 'should not be able to be unsuspended into active if not polite' do auth.suspend! - expect(auth.may_wait?(:waiting)).not_to be_true - expect(auth.may_wait?(:waiting, :rude)).not_to be_true + expect(auth.may_wait?(:waiting)).not_to be_truthy + expect(auth.may_wait?(:waiting, :rude)).not_to be_truthy expect {auth.wait!(nil, :rude)}.to raise_error(AASM::InvalidTransition) expect {auth.wait!}.to raise_error(AASM::InvalidTransition) end @@ -46,7 +46,7 @@ describe 'when being unsuspended' do auth.suspend! auth.unsuspend! - expect(auth.may_unpassify?).not_to be_true + expect(auth.may_unpassify?).not_to be_truthy expect {auth.unpassify!}.to raise_error(AASM::InvalidTransition) end @@ -74,11 +74,11 @@ describe 'when being unsuspended' do end it "should be able to fire known events" do - expect(auth.aasm.may_fire_event?(:activate)).to be_true + expect(auth.aasm.may_fire_event?(:activate)).to be_truthy end it "should not be able to fire unknown events" do - expect(auth.aasm.may_fire_event?(:unknown)).to be_false + expect(auth.aasm.may_fire_event?(:unknown)).to be_falsey end end diff --git a/spec/unit/event_spec.rb b/spec/unit/event_spec.rb index 091fcf8..fb0bc24 100644 --- a/spec/unit/event_spec.rb +++ b/spec/unit/event_spec.rb @@ -43,18 +43,18 @@ describe 'transition inspection' do it 'should support inspecting transitions from other states' do expect(event.transitions_from_state(:sleeping).map(&:to)).to eq([:running]) - expect(event.transitions_from_state?(:sleeping)).to be_true + expect(event.transitions_from_state?(:sleeping)).to be_truthy expect(event.transitions_from_state(:cleaning).map(&:to)).to eq([]) - expect(event.transitions_from_state?(:cleaning)).to be_false + expect(event.transitions_from_state?(:cleaning)).to be_falsey end it 'should support inspecting transitions to other states' do expect(event.transitions_to_state(:running).map(&:from)).to eq([:sleeping]) - expect(event.transitions_to_state?(:running)).to be_true + expect(event.transitions_to_state?(:running)).to be_truthy expect(event.transitions_to_state(:cleaning).map(&:to)).to eq([]) - expect(event.transitions_to_state?(:cleaning)).to be_false + expect(event.transitions_to_state?(:cleaning)).to be_falsey end end @@ -67,10 +67,10 @@ describe 'transition inspection without from' do it 'should support inspecting transitions from other states' do expect(event.transitions_from_state(:sleeping).map(&:to)).to eq([:running]) - expect(event.transitions_from_state?(:sleeping)).to be_true + expect(event.transitions_from_state?(:sleeping)).to be_truthy expect(event.transitions_from_state(:cleaning).map(&:to)).to eq([:running]) - expect(event.transitions_from_state?(:cleaning)).to be_true + expect(event.transitions_from_state?(:cleaning)).to be_truthy end end diff --git a/spec/unit/inspection_spec.rb b/spec/unit/inspection_spec.rb index 8acf973..815e296 100644 --- a/spec/unit/inspection_spec.rb +++ b/spec/unit/inspection_spec.rb @@ -67,11 +67,11 @@ describe "special cases" do expect(Argument.aasm.states).to include(:valid) argument = Argument.new - expect(argument.invalid?).to be_true + expect(argument.invalid?).to be_truthy expect(argument.aasm.current_state).to eq(:invalid) argument.valid! - expect(argument.valid?).to be_true + expect(argument.valid?).to be_truthy expect(argument.aasm.current_state).to eq(:valid) end end diff --git a/spec/unit/persistence/active_record_persistence_spec.rb b/spec/unit/persistence/active_record_persistence_spec.rb index 9fc9f8a..38abd49 100644 --- a/spec/unit/persistence/active_record_persistence_spec.rb +++ b/spec/unit/persistence/active_record_persistence_spec.rb @@ -38,7 +38,7 @@ describe "instance methods" do let(:column) { double(Object, type: :integer) } it "returns true" do - expect(subject.call).to be_true + expect(subject.call).to be_truthy end end @@ -46,7 +46,7 @@ describe "instance methods" do let(:column) { double(Object, type: :string) } it "returns false" do - expect(subject.call).to be_false + expect(subject.call).to be_falsey end end end @@ -299,7 +299,7 @@ describe "named scopes with the new DSL" do context "Does not already respond_to? the scope name" do it "should add a scope" do expect(SimpleNewDsl).to respond_to(:unknown_scope) - expect(SimpleNewDsl.unknown_scope.is_a?(ActiveRecord::Relation)).to be_true + expect(SimpleNewDsl.unknown_scope.is_a?(ActiveRecord::Relation)).to be_truthy end end @@ -358,7 +358,7 @@ describe 'transitions with persistence' do validator.name = nil expect(validator).not_to be_valid - expect(validator.run!).to be_false + expect(validator.run!).to be_falsey expect(validator).to be_sleeping validator.reload @@ -367,7 +367,7 @@ describe 'transitions with persistence' do validator.name = 'another name' expect(validator).to be_valid - expect(validator.run!).to be_true + expect(validator.run!).to be_truthy expect(validator).to be_running validator.reload @@ -382,7 +382,7 @@ describe 'transitions with persistence' do persistor.name = nil expect(persistor).not_to be_valid - expect(persistor.run!).to be_true + expect(persistor.run!).to be_truthy expect(persistor).to be_running persistor = InvalidPersistor.find(persistor.id) @@ -487,7 +487,7 @@ describe "invalid states with persistence" do it "should not store states" do validator = Validator.create(:name => 'name') validator.status = 'invalid_state' - expect(validator.save).to be_false + expect(validator.save).to be_falsey expect {validator.save!}.to raise_error(ActiveRecord::RecordInvalid) validator.reload @@ -497,7 +497,7 @@ describe "invalid states with persistence" do it "should store invalid states if configured" do persistor = InvalidPersistor.create(:name => 'name') persistor.status = 'invalid_state' - expect(persistor.save).to be_true + expect(persistor.save).to be_truthy persistor.reload expect(persistor.status).to eq('invalid_state') diff --git a/spec/unit/subclassing_spec.rb b/spec/unit/subclassing_spec.rb index 356e5a0..18c0095 100644 --- a/spec/unit/subclassing_spec.rb +++ b/spec/unit/subclassing_spec.rb @@ -19,7 +19,7 @@ describe 'subclassing' do end it 'should know how to respond to `may_add_details?`' do - expect(son.may_add_details?).to be_true + expect(son.may_add_details?).to be_truthy end it 'should not break if I call Son#update_state' do diff --git a/spec/unit/transition_spec.rb b/spec/unit/transition_spec.rb index 61f17d7..d885146 100644 --- a/spec/unit/transition_spec.rb +++ b/spec/unit/transition_spec.rb @@ -10,19 +10,19 @@ describe 'transitions' do it 'should not raise an exception when not whiny' do silencer = Silencer.new - expect(silencer.smile!).to be_false + expect(silencer.smile!).to be_falsey expect(silencer).to be_silent end it 'should not raise an exception when superclass not whiny' do sub = SubClassing.new - expect(sub.smile!).to be_false + expect(sub.smile!).to be_falsey expect(sub).to be_silent end it 'should not raise an exception when from is nil even if whiny' do silencer = Silencer.new - expect(silencer.smile_any!).to be_true + expect(silencer.smile_any!).to be_truthy expect(silencer).to be_smiling end @@ -43,7 +43,7 @@ describe 'transitions' do silencer.smile! do success = true end - }.not_to change { success }.to(true) + }.not_to change { success } end end @@ -124,7 +124,7 @@ describe AASM::Core::Transition, '- when performing guard checks' do opts = {:from => 'foo', :to => 'bar'} st = AASM::Core::Transition.new(opts) - expect(st.allowed?(nil)).to be_true + expect(st.allowed?(nil)).to be_truthy end it 'should call the method on the object if guard is a symbol' do