You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sqm-dashboards/spec/lib/tasks/survey_rake_spec.rb

27 lines
921 B

require 'rails_helper'
describe "survey:attempt_qustions" do
include_context "rake"
let(:ready_recipient_schedule) { double('ready recipient schedule', attempt_question: nil) }
let(:recipient_schedules) { double("recipient schedules", ready: [ready_recipient_schedule]) }
let(:active_schedule) { double("active schedule", recipient_schedules: recipient_schedules) }
before do
# ReportGenerator.stubs(:generate)
# UsersReport.stubs(:new => report)
# User.stubs(:all => user_records)
end
it 'should have environment as a prerequisite' do
expect(subject.prerequisites).to include("environment")
end
it "finds all active schedules" do
expect(ready_recipient_schedule).to receive(:attempt_question)
expect(active_schedule).to receive(:recipient_schedules)
expect(Schedule).to receive(:active).and_return([active_schedule])
subject.invoke
end
end