spec/models/naf/historical_job_spec.rb in naf-2.0.4 vs spec/models/naf/historical_job_spec.rb in naf-2.1.0

- old
+ new

@@ -9,10 +9,11 @@ let!(:historical_job) { FactoryGirl.create(:job) } # Mass-assignment [:application_id, + :application_schedule_id, :application_type_id, :command, :application_run_group_restriction_id, :application_run_group_name, :application_run_group_limit, @@ -38,10 +39,11 @@ #--------------------- # *** Associations *** #+++++++++++++++++++++ + it { should belong_to(:application_schedule) } it { should belong_to(:application_type) } it { should belong_to(:started_on_machine) } it { should belong_to(:marked_dead_by_machine) } it { should belong_to(:application) } it { should belong_to(:application_run_group_restriction) } @@ -101,16 +103,16 @@ end end describe "#application_last_runs" do before do - historical_job.update_attributes!(application_id: FactoryGirl.create(:application).id) + historical_job.update_attributes!(application_schedule_id: FactoryGirl.create(:scheduled_application).id) end it "return job when it finished running" do historical_job.finished_at = Time.zone.now historical_job.save! - ::Naf::HistoricalJob.application_last_runs.first.application.should == historical_job.application + ::Naf::HistoricalJob.application_last_runs.first.application_schedule.should == historical_job.application_schedule end it "return nil when job has not finished running" do ::Naf::HistoricalJob.application_last_runs.should == [] end