Sha256: d0b5958bf8730e3dd196c671599bf8909c1ef4c763b0333726ec4cba7eafc8d5

Contents?: true

Size: 1.16 KB

Versions: 9

Compression:

Stored size: 1.16 KB

Contents

require 'rails_helper'

RSpec.describe '/de/kontakt/anfrage', type: :feature do
  let(:resource_class) { Cmor::Contact::ContactRequest }
  let(:resource) { create(:cmor_contact_request) }

  let(:base_path) { "/de/kontakt/anfrage" }

  describe 'index/create' do
    let(:submit_button) { within('#new_contact_request') { find("input[type='submit']") } }

    before(:each) do
      visit(base_path)
    end

    describe 'success' do
      let(:after_success_path) { "/de/kontakt" }

      before(:each) do
        within('#new_contact_request') do
          fill_in "contact_request[name]", with: "Jane Doe"
          fill_in "contact_request[email]", with: "jane.doe@domain.local"
          fill_in "contact_request[phone]", with: "+49 123 4567890"
          fill_in "contact_request[message]", with: "This is the message!"
          check "contact_request[accept_terms_of_service]"
        end
      end

      it { expect(page.status_code).to eq(200) }
      it { expect(current_path).to eq(base_path) }
      it { expect{ submit_button.click }.to change{ resource_class.count }.by(1) }
      it { submit_button.click; expect(current_path).to eq(after_success_path) }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cmor_contact-0.0.51.pre spec/features/de/kontakt/anfrage_spec.rb
cmor_contact-0.0.50.pre spec/features/de/kontakt/anfrage_spec.rb
cmor_contact-0.0.49.pre spec/features/de/kontakt/anfrage_spec.rb
cmor_contact-0.0.48.pre spec/features/de/kontakt/anfrage_spec.rb
cmor_contact-0.0.45.pre spec/features/de/kontakt/anfrage_spec.rb
cmor_contact-0.0.44.pre spec/features/de/kontakt/anfrage_spec.rb
cmor_contact-0.0.43.pre spec/features/de/kontakt/anfrage_spec.rb
cmor_contact-0.0.42.pre spec/features/de/kontakt/anfrage_spec.rb
cmor_contact-0.0.41.pre spec/features/de/kontakt/anfrage_spec.rb