Skip to content

Commit

Permalink
using RSpec 2.99 now (preparing RSpec 3)
Browse files Browse the repository at this point in the history
  • Loading branch information
alto committed Dec 14, 2014
1 parent cdc3d5e commit 34de314
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion aasm.gemspec
Expand Up @@ -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'
Expand Down
18 changes: 9 additions & 9 deletions spec/unit/complex_example_spec.rb
Expand Up @@ -8,7 +8,7 @@
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
Expand All @@ -19,24 +19,24 @@
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
Expand All @@ -46,7 +46,7 @@
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

Expand Down Expand Up @@ -74,11 +74,11 @@
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
12 changes: 6 additions & 6 deletions spec/unit/event_spec.rb
Expand Up @@ -43,18 +43,18 @@

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

Expand All @@ -67,10 +67,10 @@

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
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/inspection_spec.rb
Expand Up @@ -67,11 +67,11 @@
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
Expand Down
16 changes: 8 additions & 8 deletions spec/unit/persistence/active_record_persistence_spec.rb
Expand Up @@ -38,15 +38,15 @@
let(:column) { double(Object, type: :integer) }

it "returns true" do
expect(subject.call).to be_true
expect(subject.call).to be_truthy
end
end

context "when AASM column has string type" 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
Expand Down Expand Up @@ -299,7 +299,7 @@
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

Expand Down Expand Up @@ -358,7 +358,7 @@

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
Expand All @@ -367,7 +367,7 @@

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
Expand All @@ -382,7 +382,7 @@

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)
Expand Down Expand Up @@ -487,7 +487,7 @@
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
Expand All @@ -497,7 +497,7 @@
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')
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/subclassing_spec.rb
Expand Up @@ -19,7 +19,7 @@
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
Expand Down
10 changes: 5 additions & 5 deletions spec/unit/transition_spec.rb
Expand Up @@ -10,19 +10,19 @@

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

Expand All @@ -43,7 +43,7 @@
silencer.smile! do
success = true
end
}.not_to change { success }.to(true)
}.not_to change { success }
end

end
Expand Down Expand Up @@ -124,7 +124,7 @@
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
Expand Down

0 comments on commit 34de314

Please sign in to comment.