config/application.rb # Custom directories with classes and modules you want to be autoloadable. config.autoload_paths += %W(#{config.root}/lib) Let’s try something different!
{ patient.extend TweetingPatient } describe ‘#bmi_twitter_message’ do let(:tweet) { patient.bmi_twitter_message } it ‘crafts a lovely tweet’ do expect(tweet).to include ‘Today my BMI is...’ end end end
{ patient.extend TweetingPatient } describe ‘#bmi_twitter_message’ do let(:tweet) { patient.bmi_twitter_message } it ‘crafts a lovely tweet’ do expect(tweet).to include ‘Today my BMI is...’ end end end
{ patient.extend TweetingPatient } describe ‘#bmi_twitter_message’ do let(:tweet) { patient.bmi_twitter_message } it ‘crafts a lovely tweet’ do expect(tweet).to include ‘Today my BMI is...’ end end end
{ patient.extend TweetingPatient } describe ‘#bmi_twitter_message’ do let(:tweet) { patient.bmi_twitter_message } it ‘crafts a lovely tweet’ do expect(tweet).to include ‘Today my BMI is...’ end end end
mock() } let(:update) { BMITwitterUpdate.new(patient) } before { Queue.stubs(:push) } it ‘extends TweetingPatient’ do update.call expect(patient).to have_received(:extend).with TweetingPatient end it ‘queues the twitter message’ do update.call expect(Queue).to have_received(:push).with patient.bmi_twitter_message end end end
mock() } let(:update) { BMITwitterUpdate.new(patient) } before { Queue.stubs(:push) } it ‘extends TweetingPatient’ do update.call expect(patient).to have_received(:extend).with TweetingPatient end it ‘queues the twitter message’ do update.call expect(Queue).to have_received(:push).with patient.bmi_twitter_message end end end
mock() } let(:update) { BMITwitterUpdate.new(patient) } before { Queue.stubs(:push) } it ‘extends TweetingPatient’ do update.call expect(patient).to have_received(:extend).with TweetingPatient end it ‘queues the twitter message’ do update.call expect(Queue).to have_received(:push).with patient.bmi_twitter_message end end end
mock() } let(:update) { BMITwitterUpdate.new(patient) } before { Queue.stubs(:push) } it ‘extends TweetingPatient’ do update.call expect(patient).to have_received(:extend).with TweetingPatient end it ‘queues the twitter message’ do update.call expect(Queue).to have_received(:push).with patient.bmi_twitter_message end end end
mock() } let(:update) { BMITwitterUpdate.new(patient) } before { Queue.stubs(:push) } it ‘extends TweetingPatient’ do update.call expect(patient).to have_received(:extend).with TweetingPatient end it ‘queues the twitter message’ do update.call expect(Queue).to have_received(:push).with patient.bmi_twitter_message end end end
mock() } let(:update) { BMITwitterUpdate.new(patient) } before { Queue.stubs(:push) } it ‘extends TweetingPatient’ do update.call expect(patient).to have_received(:extend).with TweetingPatient end it ‘queues the twitter message’ do update.call expect(Queue).to have_received(:push).with patient.bmi_twitter_message end end end
patient.bmis.create(:bmi) Resque.enqueue :bmi_twitter_update_job, patient.id respond_with bmi end private def patient @patient ||= current_user.patients.find(:patient_id) end end