diff --git a/spec/resque_spec/matchers_spec.rb b/spec/resque_spec/matchers_spec.rb index 9d6141a..43092e6 100644 --- a/spec/resque_spec/matchers_spec.rb +++ b/spec/resque_spec/matchers_spec.rb @@ -459,20 +459,32 @@ let(:interval) { 10 * 60 } let(:scheduled_at) { Time.now + 30 * 60 } - before(:each) do - if [true, false].sample + context "scheduling with #enqueu_in" do + before(:each) do Resque.enqueue_in(interval, Person, first_name, last_name) - else - Resque.enqueue_at(scheduled_at, Person, first_name, last_name) end - end - it "returns true if arguments, timestamp or interval matches positive expectation" do - Person.should have_scheduled(first_name, last_name).at_or_in(scheduled_at, interval) + it "returns true if arguments, timestamp or interval matches positive expectation" do + Person.should have_scheduled(first_name, last_name).at_or_in(scheduled_at, interval) + end + + it "returns true if arguments, timestamp, and interval matches negative expectation" do + Person.should_not have_scheduled(first_name, last_name).at_or_in(Time.now + 60 * 60, 100 * 60) + end end - it "returns true if arguments, timestamp, and interval matches negative expectation" do - Person.should_not have_scheduled(first_name, last_name).at_or_in(Time.now + 60 * 60, 100 * 60) + context "scheduling with #enqueu_at" do + before(:each) do + Resque.enqueue_at(scheduled_at, Person, first_name, last_name) + end + + it "returns true if arguments, timestamp or interval matches positive expectation" do + Person.should have_scheduled(first_name, last_name).at_or_in(scheduled_at, interval) + end + + it "returns true if arguments, timestamp, and interval matches negative expectation" do + Person.should_not have_scheduled(first_name, last_name).at_or_in(Time.now + 60 * 60, 100 * 60) + end end end