From 2c3d69dffa8808467cb35eff0fe372e1182414ee Mon Sep 17 00:00:00 2001 From: "Jesse C. Fisher" Date: Sat, 30 Jan 2016 15:55:47 -0800 Subject: [PATCH] Play now for visitors --- config/routes.rb | 2 +- spec/features/visitors/navigation_spec.rb | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 9502527d..5bd9be85 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,7 +13,7 @@ Rails.application.routes.draw do mount Upmin::Engine => '/admin' root to: 'visitors#index' - get '/quick-play', to: 'games#play_now', as: 'play_now' + get '/play-now', to: 'games#play_now', as: 'play_now' devise_for :users, controllers: { registrations: "users/registrations" } resources :users get '/loaderio-456644f4db1fcd1e8578be882d2fc476.txt', to: redirect('/assets/loaderio-456644f4db1fcd1e8578be882d2fc476.txt') diff --git a/spec/features/visitors/navigation_spec.rb b/spec/features/visitors/navigation_spec.rb index b6d61a73..0454fbb8 100644 --- a/spec/features/visitors/navigation_spec.rb +++ b/spec/features/visitors/navigation_spec.rb @@ -12,4 +12,25 @@ feature 'Navigation links', :devise do expect(page).to have_content 'Sign in' expect(page).to have_content 'Sign up' end + + # Scenario: Follow navigation links + # Given I am a visitor + # When I click a navigation link + # Then I see the proper web page + scenario 'follow navigation links', js: :true do + visit root_path + @links = { + 'Play Now': '"/games/1"', + 'Browse Tables': 'tables_path', + #'Tutorial': 'tutorial_path' + } + @links.each do |link| + click_link link[0] + #TODO: Remove race condition + sleep 1 + expect(page.current_path).to eq(eval(link[1])) + visit root_path + end + end + end