Sha256: 485d61a00571749c2ce71fdb58ff0836f90b269feb8c49ff68394bd3396a63c9

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'rails_helper'

feature 'search for events', js: true do
  background do
    create :event, title: 'Ruby Future', start_time: today + 1.day
    create :event, title: 'Python Past', start_time: today - 1.day
    create :event, title: 'Ruby Part 2 Past', start_time: today - 2.days
    create :event, title: 'Ruby Part 1 Past', start_time: today - 3.days
  end

  scenario 'User searches for an event by name' do
    visit '/'

    # We're using send_keys here instead of fill_in in order to trigger the
    # correct events for JavaScript autocompletion.
    #
    # https://github.com/calagator/calagator/pull/448#issuecomment-129621567
    find_field('Search Events').native.send_keys "Ruby\n"

    within('#current') do
      expect(page).to have_content 'Viewing 1 current event'
      expect(page).to have_content 'Ruby Future'
    end

    within('#past') do
      expect(page).to have_content 'Viewing 2 past events'
      expect(page).to have_content 'Ruby Part 2 Past'
      expect(page).to have_content 'Ruby Part 1 Past'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
calagator-1.1.0 spec/features/search_event_spec.rb