Sha256: a4d63b0c239025c25e5f6c45106cd4c44f4e095a50e6663cc550db38a6a1a14a

Contents?: true

Size: 895 Bytes

Versions: 14

Compression:

Stored size: 895 Bytes

Contents

require 'spec_helper'

feature 'Contact form' do
  scenario 'submitting the form' do
    submit_contact_form
    expect(page).to have_content('Your message has been sent')
  end

  scenario 'with a missing field' do
    submit_contact_form(:name => '')
    expect(page).to have_content('All fields are required')
  end

  scenario 'with an invalid email' do
    submit_contact_form(:email => 'blah')
    expect(page).to have_content('Invalid email address')
  end

  def submit_contact_form(fields={})
    fields.reverse_merge!(
      :name => 'Joe',
      :email => 'joe@example.com',
      :subject => 'Testing',
      :message => 'Hi there',
    )

    visit '/contact'

    fill_in 'Name', :with => fields[:name]
    fill_in 'Email', :with => fields[:email]
    fill_in 'Subject', :with => fields[:subject]
    fill_in 'Message', :with => fields[:message]

    click_button 'Send'
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
dugway-1.1.0 spec/features/contact_form_spec.rb
dugway-1.0.14 spec/features/contact_form_spec.rb
dugway-1.0.13 spec/features/contact_form_spec.rb
dugway-1.0.12 spec/features/contact_form_spec.rb
dugway-1.0.10 spec/features/contact_form_spec.rb
dugway-1.0.9 spec/features/contact_form_spec.rb
dugway-1.0.8 spec/features/contact_form_spec.rb
dugway-1.0.7 spec/features/contact_form_spec.rb
dugway-1.0.6 spec/features/contact_form_spec.rb
dugway-1.0.5 spec/features/contact_form_spec.rb
dugway-1.0.4 spec/features/contact_form_spec.rb
dugway-1.0.3 spec/features/contact_form_spec.rb
dugway-1.0.2 spec/features/contact_form_spec.rb
dugway-1.0.1 spec/features/contact_form_spec.rb