Skip to content

Commit

Permalink
upgrade to rspec 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrogemann committed Jun 8, 2014
1 parent 8b5fd92 commit 80e1595
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion appointment.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.version = Core::VERSION

gem.add_development_dependency('rspec', '~> 2.14.1')
gem.add_development_dependency('rspec', '~> 3.0.0')
gem.add_development_dependency('cucumber', '~> 1.3.15')
gem.add_development_dependency('simplecov', '~> 0.8.2')
gem.add_development_dependency('metric_fu', '~> 4.11.1') unless ENV['TRAVIS'] == 'true'
Expand Down
8 changes: 4 additions & 4 deletions spec/core/alternatives_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module Core
.build
alternatives = Alternatives.new([dts])

alternatives.for_date('2012-11-09').should have(1).items
alternatives.for_date(Date.parse('2012-11-09')).should have(1).items
alternatives.for_date('2012-11-09').size.should eq(1)
alternatives.for_date(Date.parse('2012-11-09')).size.should eq(1)
end

it 'has alternatives for given date and duration' do
Expand All @@ -21,8 +21,8 @@ module Core
.build
alternatives = Alternatives.new([dts])

alternatives.for_date_and_duration('2012-11-09', 30).should have(1).items
alternatives.for_date_and_duration(Date.parse('2012-11-09'), 30).should have(1).items
alternatives.for_date_and_duration('2012-11-09', 30).size.should eq(1)
alternatives.for_date_and_duration(Date.parse('2012-11-09'), 30).size.should eq(1)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/core/appointment_maker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Core
context 'perfect match' do
it 'should return an Appointment' do
worker = double('worker')
worker.stub(:appointments).and_return []
expect(worker).to receive(:appointments).and_return []
activity = double('activity')
dts = DateTimeSpanBuilder.new
.starting('2012-11-09T15:30:00+01:00')
Expand All @@ -19,14 +19,14 @@ module Core
context 'alternatives' do
it 'should return alternatives if worker is appointed at desired time', :type => 'integration' do
worker = double('worker')
worker.stub(:appointments).and_return []
expect(worker).to receive(:appointments).and_return []
activity = double('activity')
dts = DateTimeSpanBuilder.new
.starting('2012-11-09T15:30:00+01:00')
.until('2012-11-09T15:50:00+01:00')
.build
fixed_appointment = AppointmentMaker.new.request(activity, dts, worker)
worker.stub(:appointments).and_return [fixed_appointment]
expect(worker).to receive(:appointments).and_return [fixed_appointment]
alternatives = AppointmentMaker.new.request(activity, dts, worker)
alternatives.should be_a(Alternatives)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/core/appointment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Core
describe '#initialize' do
it 'creates an Appointment (happy path)' do
worker = double('worker')
worker.stub(:appointments).and_return []
expect(worker).to receive(:appointments).and_return []
activity = double('activity')
dts = DateTimeSpanBuilder.new
.starting('2012-11-09T15:30:00+01:00')
Expand Down
26 changes: 13 additions & 13 deletions spec/core/date_time_span_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module Core
.starting('2012-11-09T14:20:00+01:00')
.until('2012-11-09T15:10:00+01:00')
.build
dts1.overlaps?(dts2).should be_true
dts1.overlaps?(dts2).should be_truthy
end

# ---- ----
Expand All @@ -77,7 +77,7 @@ module Core
.starting('2012-11-09T14:20:00+01:00')
.until('2012-11-09T15:00:00+01:00')
.build
dts1.overlaps?(dts2).should be_true
dts1.overlaps?(dts2).should be_truthy
end

# ----
Expand All @@ -88,7 +88,7 @@ module Core
.starting('2012-11-09T14:30:00+01:00')
.until('2012-11-09T15:10:00+01:00')
.build
dts1.overlaps?(dts2).should be_true
dts1.overlaps?(dts2).should be_truthy
end

# ----
Expand All @@ -100,7 +100,7 @@ module Core
.starting('2012-11-09T14:30:00+01:00')
.until('2012-11-09T15:00:00+01:00')
.build
dts1.overlaps?(dts2).should be_true
dts1.overlaps?(dts2).should be_truthy
end
end

Expand All @@ -113,7 +113,7 @@ module Core
.starting('2012-11-09T14:20:00+01:00')
.until('2012-11-09T15:20:00+01:00')
.build
dts1.overlaps?(dts2).should be_true
dts1.overlaps?(dts2).should be_truthy
end

# ----
Expand All @@ -124,7 +124,7 @@ module Core
.starting('2012-11-09T14:00:00+01:00')
.until('2012-11-09T15:10:00+01:00')
.build
dts1.overlaps?(dts2).should be_true
dts1.overlaps?(dts2).should be_truthy
end

# ----
Expand All @@ -136,7 +136,7 @@ module Core
.starting('2012-11-09T14:10:00+01:00')
.until('2012-11-09T15:20:00+01:00')
.build
dts1.overlaps?(dts2).should be_true
dts1.overlaps?(dts2).should be_truthy
end
end

Expand All @@ -150,7 +150,7 @@ module Core
.starting('2012-11-09T14:30:00+01:00')
.until('2012-11-09T15:20:00+01:00')
.build
dts1.overlaps?(dts2).should be_true
dts1.overlaps?(dts2).should be_truthy
end

# ----
Expand All @@ -162,7 +162,7 @@ module Core
.starting('2012-11-09T14:10:00+01:00')
.until('2012-11-09T15:00:00+01:00')
.build
dts1.overlaps?(dts2).should be_true
dts1.overlaps?(dts2).should be_truthy
end
end

Expand All @@ -175,7 +175,7 @@ module Core
.starting('2012-11-09T15:10:00+01:00')
.until('2012-11-09T15:30:00+01:00')
.build
dts1.overlaps?(dts2).should be_false
dts1.overlaps?(dts2).should be_falsey
end

# ----
Expand All @@ -186,7 +186,7 @@ module Core
.starting('2012-11-09T13:50:00+01:00')
.until('2012-11-09T14:20:00+01:00')
.build
dts1.overlaps?(dts2).should be_false
dts1.overlaps?(dts2).should be_falsey
end

# ----
Expand All @@ -198,7 +198,7 @@ module Core
.starting('2012-11-09T15:30:00+01:00')
.until('2012-11-09T15:50:00+01:00')
.build
dts1.overlaps?(dts2).should be_false
dts1.overlaps?(dts2).should be_falsey
end

# ----
Expand All @@ -210,7 +210,7 @@ module Core
.starting('2012-11-09T14:00:00+01:00')
.until('2012-11-09T14:10:00+01:00')
.build
dts1.overlaps?(dts2).should be_false
dts1.overlaps?(dts2).should be_falsey
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/core/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ module Core
it 'returns true if it can do given activity' do
worker = Worker.new([Activity.new(:activity_1, 60)])
activity = Activity.new(:activity_1, 60)
worker.can_do?(activity).should be_true
worker.can_do?(activity).should be_truthy
end

it 'returns false if it cannot do given activity' do
worker = Worker.new([Activity.new(:activity_1, 60)])
activity = Activity.new(:activity_2, 60)
worker.can_do?(activity).should be_false
worker.can_do?(activity).should be_falsey
end
end

Expand All @@ -24,7 +24,7 @@ module Core
.starting(tomorrow)
.lasting(60)
.build()
worker.available?(date_time_span).should be_true
worker.available?(date_time_span).should be_truthy
end
end

Expand Down
4 changes: 3 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
end

RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.expect_with :rspec do |c|
c.syntax = [:should, :expect]
end
config.run_all_when_everything_filtered = true
config.filter_run :focus
config.order = 'random'
Expand Down

0 comments on commit 80e1595

Please sign in to comment.