Sha256: b557ca9b8c0984d30eb072a74c99830ef02d4e3a3e3ca727b142b1194fb785c2

Contents?: true

Size: 1.07 KB

Versions: 16

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'
include RequestHelpers

describe 'Using the event form', js: true do
  let!(:admin) { create(:admin) }

  before do
    login(admin)
  end

  context 'when doing everything right' do
    it 'should save the event' do
      visit new_event_path
      fill_in 'event[title]', with: 'My Test Event'

      # Manually testing the datepickers is outside the scope of this spec
      page.execute_script("$('#event_starts_at').val('#{Time.now}')")
      page.execute_script("$('#event_ends_at').val('#{Time.now + 1.hour}')")

      # Save it
      click_button 'Save'
      expect(page).to have_content('My Test Event')
      expect(page).to have_content('Event saved successfully.')
    end
  end

  context 'when doing something wrong' do
    it 'should not save the page' do
      visit new_event_path
      within('form#new_event') do
        click_button 'Save'
      end
      expect(page).to have_content("Title can't be blank")
      expect(page).to have_content("Starts at can't be blank")
      expect(page).to have_content("Ends at can't be blank")
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
tenon-1.0.15 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.14 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.13 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.12 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.11 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.10 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.9 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.8 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.7 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.6 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.5 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.4 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.3 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.2 spec/features/tenon/events/events_form_spec.rb
tenon-1.0.1 spec/features/tenon/events/events_form_spec.rb
tenon-1.0 spec/features/tenon/events/events_form_spec.rb