Sha256: 27564742c0b20adee71ed5ebce2087d01b45ce2d4404ed1f554d2d398dc6c237
Contents?: true
Size: 1.44 KB
Versions: 5
Compression:
Stored size: 1.44 KB
Contents
require 'spec_helper' describe FeedbackController do render_views describe "GET show" do it "should render the contact form" do get :show expect(response).to be_success expect(response.body).to have_selector("form[id='feedback_form']") end end describe "POST show" do describe "failure" do it "should display an error message for blank submission" do post :show expect(response.body).to have_selector("div[id='error_explanation']") expect(response).not_to redirect_to(feedback_complete_path) end it "should display an error message for invalid submission" do post :show, :name => '%^*)(', :email => 'thisnotvalid', :topic => 'whatever', :message => '%^*)(' expect(response.body).to have_selector("div[id='error_explanation']") expect(response).not_to redirect_to(feedback_complete_path) end end describe "success" do it "should redirect to the complete path" do post :show, :name => 'Testy McGee', :email => 'test@test.edu', :topic => 'whatever', :message => 'Test message' expect(response).to redirect_to(feedback_complete_path) end it "should create the email" do post :show, :name => 'Testy McGee', :email => 'test@test.edu', :topic => 'whatever', :message => 'Test message' expect(ActionMailer::Base.deliveries.last.body.encoded).to include('Test message') end end end end
Version data entries
5 entries across 5 versions & 1 rubygems