Skip to content

Commit

Permalink
Merge e980a74 into 753c5c6
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschright committed Dec 14, 2018
2 parents 753c5c6 + e980a74 commit 4c052c5
Show file tree
Hide file tree
Showing 14 changed files with 60 additions and 41 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
@@ -1,4 +1,5 @@
sudo: false
add_ons:
chrome: stable
language: ruby

rvm:
Expand Down Expand Up @@ -29,12 +30,16 @@ matrix:
- rvm: rbx-2
gemfile: gemfiles/rails_4_1.gemfile

before_install:
- sudo apt-get install chromium-chromedriver
- google-chrome-stable --headless --disable-gpu

before_script:
- "export PATH=$PATH:/usr/lib/chromium-browser/"
- bundle exec bin/calagator new spec/dummy --dummy --database=$DB --postgres-username=postgres
- travis_retry bundle exec rake app:db:migrate app:db:seed
- travis_retry bundle exec rake app:sunspot:solr:start_with_waiting

script:
- bundle exec rake spec --trace
cache: bundler

2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -20,4 +20,4 @@ gem "byebug", platform: "mri"
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

gem "launchy"
2 changes: 1 addition & 1 deletion calagator.gemspec
Expand Up @@ -58,11 +58,11 @@ Gem::Specification.new do |s|
s.add_development_dependency "factory_girl_rails", "~> 4.5"
s.add_development_dependency "faker", "~> 1.4"
s.add_development_dependency "gem-release", "~> 0.7"
s.add_development_dependency "poltergeist", "~> 1.6"
s.add_development_dependency "rspec-activemodel-mocks", "~> 1.0.2"
s.add_development_dependency "rspec-collection_matchers", "~> 1.1"
s.add_development_dependency "rspec-its", "~> 1.1"
s.add_development_dependency "rspec-rails", "~> 3.2"
s.add_development_dependency "selenium-webdriver"
s.add_development_dependency "simplecov", "~> 0.10.0"
s.add_development_dependency "sqlite3", "~> 1.3"
s.add_development_dependency "sunspot_solr", "~> 2.1"
Expand Down
24 changes: 14 additions & 10 deletions spec/features/add_event_spec.rb
@@ -1,20 +1,27 @@
require 'rails_helper'

feature 'Event Creation' do
scenario 'User adds an event at an existing venue' do
feature 'Event Creation', js: true do
before do
create :venue, title: 'Empire State Building'
create :venue, title: 'New Relic'
create :venue, title: 'Urban Airship'
end

visit '/'
click_on 'Add an event'
scenario 'User adds an event at an existing venue' do
# visit '/'
# click_on 'Add an event'
visit '/events/new'

fill_in 'Event Name', with: 'Ruby Newbies'
find_field('Venue').native.send_keys 'Empire State'
find_field('Venue').native.send_keys 'empire'
expect(page).to have_text('Empire State Building')

click_on 'Empire State Building'

fill_in 'start_date', with: '2014-08-05'
fill_in 'start_time', with: '06:00 PM'
fill_in 'end_time', with: '11:00 PM'
fill_in 'end_date', with: '2014-08-06'
fill_in 'end_time', with: '11:00 PM'
fill_in 'Website', with: 'www.rubynewbies.com'
fill_in 'Description', with: 'An event for beginners'
fill_in 'Venue details', with: 'On the third floor'
Expand Down Expand Up @@ -51,7 +58,7 @@

expect(page).to have_content 'Event was successfully saved'
expect(page).to have_content "Please tell us more about where it's being held."
expect(page).to have_content 'Version Editing: Portland Zoo'
expect(page).to have_content(/Version [\d\D]+ Editing: Portland Zoo/)

expect(find_field('Venue Name').value).to have_content 'Portland Zoo'

Expand Down Expand Up @@ -87,9 +94,6 @@
end

scenario 'User begins typing a venue name' do
create :venue, title: 'New Relic'
create :venue, title: 'Urban Airship'

visit '/events/new'
find_field('Venue').native.send_keys 'urban'

Expand Down
4 changes: 2 additions & 2 deletions spec/features/admin_auth_spec.rb
Expand Up @@ -7,13 +7,13 @@
'/venues/duplicates'
].each do |path|
scenario "Users are not permitted in #{path}" do
page.driver.basic_authorize 'nope', 'nada'
page.driver.browser.basic_authorize 'nope', 'nada'
visit path
expect(page.status_code).to eq 401
end

scenario "Authenticated users are permitted in #{path}" do
page.driver.basic_authorize Calagator.admin_username, Calagator.admin_password
page.driver.browser.basic_authorize Calagator.admin_username, Calagator.admin_password
visit path
expect([200, 304]).to include page.status_code
end
Expand Down
6 changes: 4 additions & 2 deletions spec/features/admin_lock_event_spec.rb
@@ -1,12 +1,14 @@
require 'rails_helper'

feature 'Event locking' do
# Disabled pending a way to both set up the full event page size so that the editing sidebar is accessible
# and also that will handle basic auth
xfeature 'Event locking' do
background do
create :venue, title: 'Empire State Building'
create :event, title: 'Ruby Newbies', start_time: Time.zone.now
create :event, title: 'Ruby Privateers', start_time: Time.zone.now, locked: true

page.driver.basic_authorize Calagator.admin_username, Calagator.admin_password
page.driver.browser.basic_authorize Calagator.admin_username, Calagator.admin_password

visit '/admin'
click_on 'Lock events'
Expand Down
2 changes: 1 addition & 1 deletion spec/features/admin_search_event_spec.rb
Expand Up @@ -6,7 +6,7 @@
create :event, title: 'Ruby Newbies', start_time: Time.zone.now
create :event, title: 'Ruby Privateers', start_time: Time.zone.now, locked: true

page.driver.basic_authorize Calagator.admin_username, Calagator.admin_password
page.driver.browser.basic_authorize Calagator.admin_username, Calagator.admin_password

visit '/admin/events'
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/filter_venues_spec.rb
@@ -1,6 +1,6 @@
require 'rails_helper'

feature 'browse venue by tag' do
feature 'browse venue by tag', js: true do
background do
create :venue, title: 'Giant Stadium', tag_list: 'old'
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/import_events_from_feed_spec.rb
@@ -1,6 +1,6 @@
require 'rails_helper'

feature 'import events from a feed' do
feature 'import events from a feed', js: true do
background do
Timecop.travel('2010-01-01')
stub_request(:get, 'http://even.ts/feed').to_return(body: read_sample('ical_multiple_calendars.ics'))
Expand Down
11 changes: 7 additions & 4 deletions spec/features/managing_event_spec.rb
@@ -1,6 +1,6 @@
require 'rails_helper'

feature 'Event Editing' do
feature 'Event Editing', js: true do
background do
Timecop.travel('2014-10-09')
create :event, title: 'Ruby Future', start_time: Time.zone.now
Expand All @@ -19,6 +19,7 @@
end

click_on 'edit'
expect(page).to have_content 'Editing: Ruby Future'

expect(find_field('Event Name').value).to have_content 'Ruby Future'
fill_in 'Event Name', with: 'Ruby ABCs'
Expand Down Expand Up @@ -64,7 +65,7 @@
end
end

feature 'Event Cloning' do
feature 'Event Cloning', js: true do
background do
Timecop.travel('2014-10-09')
create :event, title: 'Ruby Event Part One', start_time: 4.days.from_now
Expand Down Expand Up @@ -107,7 +108,7 @@
end
end

feature 'Event Deletion' do
feature 'Event Deletion', js: true do
background do
create :event, title: 'Ruby and You', start_time: 1.day.from_now
end
Expand All @@ -119,7 +120,9 @@
click_on 'Ruby and You'
end

click_on 'delete'
accept_alert do
click_on 'delete'
end

expect(page).to have_content '"Ruby and You" has been deleted'

Expand Down
9 changes: 5 additions & 4 deletions spec/features/managing_venue_spec.rb
@@ -1,13 +1,12 @@
require 'rails_helper'

feature 'Venue Editing' do
feature 'Venue Editing', js: true do
let!(:venue) { create(:venue) }
let!(:event) { create(:event, venue: venue, start_time: Time.now.end_of_day - 1.hour) }
let!(:new_venue) { build(:venue) }
let!(:venue_with_tags) {create(:venue, :with_multiple_tags)}

scenario 'A user edits an existing venue' do

visit "/"
click_on venue.title
click_on 'edit'
Expand Down Expand Up @@ -69,7 +68,7 @@
end
end

feature 'Venue Deletion' do
feature 'Venue Deletion', js: true do
background do
create :venue, title: 'Test Venue'
end
Expand All @@ -82,7 +81,9 @@
click_on 'Test Venue'
end

click_on 'delete'
accept_alert do
click_on 'delete'
end

expect(page).to have_content %("Test Venue" has been deleted)

Expand Down
2 changes: 1 addition & 1 deletion spec/features/recent_changes_spec.rb
@@ -1,6 +1,6 @@
require 'rails_helper'

feature 'Recent Changes' do
feature 'Recent Changes', js: true do
let(:event_title) { 'The Newest Event' }

background do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/search_event_spec.rb
@@ -1,6 +1,6 @@
require 'rails_helper'

feature 'search for events' do
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
Expand Down
24 changes: 14 additions & 10 deletions spec/spec_helper.rb
Expand Up @@ -22,8 +22,9 @@
require "rspec/collection_matchers"
require "factory_girl_rails"
require "capybara"
require "capybara/rspec"
require "database_cleaner"
require "capybara/poltergeist"
require "selenium-webdriver"
require "timecop"
require "webmock"

Expand Down Expand Up @@ -53,21 +54,27 @@
config.before(:suite) do |example|
DatabaseCleaner.clean_with(:truncation)
end

config.before(:each) do |example|
DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction
DatabaseCleaner.start
end

config.after(:each) do
DatabaseCleaner.clean
end

require 'capybara/poltergeist'
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, timeout: 90)
Capybara.register_driver :chrome_headless do |app|
args = Selenium::WebDriver::Chrome::Options.new(args: %w[headless disable-gpu no-sandbox --window-size=1240,1400])
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
options: args
)
end
Capybara.javascript_driver = :poltergeist

# config.include(Capybara::Webkit::RspecMatchers, :type => :feature)
Capybara.default_driver = :rack_test
Capybara.javascript_driver = :chrome_headless

# These two settings work together to allow you to limit a spec run
# to individual examples or groups you care about by tagging them with
Expand Down Expand Up @@ -136,7 +143,4 @@
end

config.alias_example_to :fscenario, focus: true

# all features should run using the capybara js driver
config.alias_example_group_to :feature, capybara_feature: true, type: :feature, js: true
end
end

0 comments on commit 4c052c5

Please sign in to comment.