Sha256: e0862545ba36fc64c690577734d17bff426a5340d733675e5c5a80fa7d626d53

Contents?: true

Size: 976 Bytes

Versions: 13

Compression:

Stored size: 976 Bytes

Contents

require 'spec_helper'

describe ContactUs::ContactsController do

  describe 'create' do

    it 'should redirect with success message if valid contact' do
      post :create, :contact_us_contact => { :email => 'test@test.com', :message => 'test' }
      assigns(:contact).valid?.should eql(true)
      flash[:notice].should eql('Contact email was successfully sent.')
      response.should redirect_to('/')
    end

    it 'should render new with error message if invalid contact' do
      post :create, :contact_us_contact => { :email => 'test@test.com', :message => '' }
      assigns(:contact).valid?.should eql(false)
      flash[:error].should eql('You must enter both fields.')
      response.should render_template('new')
    end

  end

  describe 'new' do

    it 'should assign contact for form and render page successfully' do
      get :new
      assigns(:contact).should be_an_instance_of(ContactUs::Contact)
      response.should be_success
    end

  end

end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
contact_us-0.4.0 spec/controllers/contact_us/contact_controller_spec.rb
contact_us_website-0.4.4.beta spec/controllers/contact_us/contact_controller_spec.rb
contact_us-0.4.0.beta spec/controllers/contact_us/contact_controller_spec.rb
contact_us-0.3.0 spec/controllers/contact_us/contact_controller_spec.rb
contact_us-0.2.1 spec/controllers/contact_us/contact_controller_spec.rb
contact_us-0.2.0 spec/controllers/contact_us/contact_controller_spec.rb
contact_us-0.1.5 spec/controllers/contact_us/contact_controller_spec.rb
contact_us-0.1.4 spec/controllers/contact_us/contact_controller_spec.rb
contact_us-0.1.3 spec/controllers/contact_us/contact_controller_spec.rb
contact_us-0.1.2 spec/controllers/contact_us/contact_controller_spec.rb
contact_us-0.1.1 spec/controllers/contact_us/contact_controller_spec.rb
contact_us-0.1.0 spec/controllers/contact_us/contact_controller_spec.rb
contact_us-0.0.8 spec/controllers/contact_us/contact_controller_spec.rb