Skip to content

Commit c8fe78a

Browse files
committed
dev env changes - added turnip, selenium, configs
1 parent 1084599 commit c8fe78a

File tree

8 files changed

+33
-6
lines changed

8 files changed

+33
-6
lines changed

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
--require spec_helper
2+
--require turnip/rspec
23
--format Fuubar
34
--color
45
--profile

.rspec-local

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--require spec_helper
2+
--format documentation
3+
--color
4+
--no-profile

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,10 @@ group :test do
169169
# gem 'rspec-its'
170170
gem 'capybara'
171171
gem 'capybara-screenshot'
172+
gem 'turnip' # write rspec feature specs in cucumber style
172173
gem 'rack_session_access' # allows to set session from within Capybara
173174
gem 'poltergeist' # headless js driver for Capybara that uses phantomJs
175+
gem 'selenium-webdriver' # headfull js driver for Capybara
174176
gem 'codeclimate-test-reporter', require: false
175177
gem 'database_cleaner'
176178
gem 'fuubar', '2.0.0.rc1'

Gemfile.lock

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ GEM
137137
carrierwave (~> 0.5)
138138
celluloid (0.15.2)
139139
timers (~> 1.1.0)
140+
childprocess (0.5.5)
141+
ffi (~> 1.0, >= 1.0.11)
140142
choice (0.1.6)
141143
chronic (0.10.2)
142144
chunky_png (1.3.1)
@@ -277,6 +279,8 @@ GEM
277279
multi_json (~> 1.0)
278280
net-http-persistent (>= 2.7)
279281
net-http-pipeline
282+
gherkin (2.12.2)
283+
multi_json (~> 1.3)
280284
github-markdown (0.6.6)
281285
grackle (0.3.0)
282286
json
@@ -591,6 +595,7 @@ GEM
591595
ruby-progressbar (1.5.1)
592596
ruby_parser (3.6.2)
593597
sexp_processor (~> 4.1)
598+
rubyzip (1.1.6)
594599
safe_yaml (1.0.3)
595600
sanitize (3.0.0)
596601
crass (~> 0.2.0)
@@ -606,6 +611,11 @@ GEM
606611
faraday (~> 0.8, < 0.10)
607612
sax-machine (0.2.1)
608613
nokogiri (~> 1.6.0)
614+
selenium-webdriver (2.43.0)
615+
childprocess (~> 0.5)
616+
multi_json (~> 1.0)
617+
rubyzip (~> 1.0)
618+
websocket (~> 1.0)
609619
sexp_processor (4.4.4)
610620
shoulda-matchers (2.6.2)
611621
activesupport (>= 3.0.0)
@@ -686,6 +696,9 @@ GEM
686696
treetop (1.4.15)
687697
polyglot
688698
polyglot (>= 0.3.1)
699+
turnip (1.2.4)
700+
gherkin (>= 2.5)
701+
rspec (>= 2.14.0, < 4.0)
689702
tweet-button (0.1.0)
690703
twitter (5.5.1)
691704
addressable (~> 2.3)
@@ -813,6 +826,7 @@ DEPENDENCIES
813826
sanitize
814827
sass (~> 3.2.9)
815828
sass-rails (~> 3.2.6)
829+
selenium-webdriver
816830
shoulda-matchers
817831
sidekiq
818832
simple_form
@@ -829,6 +843,7 @@ DEPENDENCIES
829843
timecop
830844
tire
831845
travis
846+
turnip
832847
tweet-button
833848
twitter
834849
uglifier (>= 1.0.3)

app/controllers/application_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ class ApplicationController < ActionController::Base
2121
after_action :record_visit
2222
after_action :record_location
2323

24+
rescue_from ActiveRecord::RecordNotFound, with: :render_404 unless Rails.env.production?
25+
rescue_from ActionController::RoutingError, with: :render_404 unless Rails.env.production?
26+
2427
protected
2528

2629
def apply_flash_message
@@ -179,9 +182,6 @@ def not_on_achievements?
179182
params[:controller] != 'achievements'
180183
end
181184

182-
rescue_from ActiveRecord::RecordNotFound, with: :render_404
183-
rescue_from ActionController::RoutingError, with: :render_404
184-
185185
def render_404
186186
render template: 'error/not_found', status: :not_found
187187
end

config/environments/test.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313

1414
# Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
1515
config.assets.allow_debugging = true
16-
17-
config.middleware.use RackSessionAccess::Middleware # alloes to set session from within Capybara
16+
config.middleware.use RackSessionAccess::Middleware # allows to set session from within Capybara
1817

1918
Rails.logger = Logger.new(STDOUT)
20-
Rails.logger.level = Logger::DEBUG # provides more verbose output when testing with headless browsers in case of errors
19+
Rails.logger.level = Logger::DEBUG
2120
end

spec/rails_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
require 'spec_helper.rb'
22
require 'capybara/poltergeist'
3+
require 'capybara-screenshot/rspec'
34
require 'rack_session_access/capybara'
5+
require 'features/helpers/general_helpers.rb'
46

57
Capybara.javascript_driver = :poltergeist
68
Capybara.default_wait_time = 5

spec/turnip_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require 'rails_helper.rb'
2+
require 'turnip/capybara'
3+
4+
Dir.glob("spec/features/steps/**/*steps.rb") { |file| load file, true }

0 commit comments

Comments
 (0)