If is not supported, what is the right way to mock an object once before
all the examples ?
Here is what I tried to do and failed:
describe '#build_working_hour' do
context "for open status" do
before(:all) do
@schedule = double(MystoreMigration::StoreSchedule, am_start_time:
900, pm_end_time: 2030)
allow(@schedule).to receive(:has_divided_hours?).and_return(false)
allow(@schedule).to receive(:closed?).and_return(false)
@working_hour = store_migrator.build_working_hour(schedule)
end
it 'should init working hour with open status' do
expect(@working_hour.open?).to be_truthy
end
it 'should init working hour with open status times' do
expect(@working_hour.opens).to eq(32_400_000)
expect(@working_hour.closes).to eq(73_800_000)
expect(@working_hour.divided_opens).to be nil
expect(@working_hour.divided_closes).to be nil
end
end
end
What is wrong with the above approach ? I'd like to 1) check a status, 2)
the assigned values. Thank you!
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/e647b129-04a4-4e9e-9d9d-c6ba0d84a68e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.