Skip to content

Updated spec/dummy to Rails 5 #752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ node_package/webpack.config.js
**/generated/**
**/app/assets/javascripts/application.js
**/coverage/**
**/cable.js
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ language: ruby
rvm:
# Ruby 2.0.0 fails due to newer Nokogir
# nokogiri-1.7.0.1 requires ruby version >= 2.1.0, which is incompatible with the current version, ruby 2.0.0p648
- 2.1.10
# Rails 5 requires 2.2
# - 2.1.10
- 2.2.6
- 2.3.1
services:
Expand All @@ -25,7 +26,6 @@ env:
- RAILS_ENV=test
- DRIVER=selenium_chrome
- CHROME_BIN=/usr/bin/google-chrome
- ENABLE_TURBOLINKS_5=TRUE
- USE_COVERALLS=TRUE

before_install:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ If you run `rspec` at the top level, you'll see this message: `require': cannot

After running a test, you can view the coverage results SimpleCov reports by opening `coverage/index.html`.

To test `spec/dummy` against Turbolinks 5, install the gem by running `ENABLE_TURBOLINKS_5=TRUE bundle install` in the `spec/dummy` directory before running `rake`.
To test `spec/dummy` against Turbolinks 2, install the gem by running `ENABLE_TURBOLINKS_2=TRUE bundle install` in the `spec/dummy` directory before running `rake`. Turbolinks 5 is the default.

Run `rake -T` or `rake -D` to see testing options.

Expand Down
9 changes: 5 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ gem "sdoc", "~> 0.4.0", group: :doc
gem "spring"
gem "sqlite3"
gem "mini_racer"
if ENV["ENABLE_TURBOLINKS_5"].nil? || ENV["ENABLE_TURBOLINKS_5"].strip.empty?
gem "turbolinks", "2.5.3"
else
if ENV["ENABLE_TURBOLINKS_2"].nil? || ENV["ENABLE_TURBOLINKS_2"].strip.empty?
gem "turbolinks", "~> 5.0"
else
gem "turbolinks", "2.5.3"
end
gem "uglifier", ">= 2.7.2"
gem "web-console", "~> 2.0", group: :development
Expand All @@ -35,7 +35,8 @@ gem "rspec-rails"
gem "rspec-retry"
gem "capybara"
gem "capybara-screenshot"
gem "capybara-webkit"
# Trouble installing on Sierra
# gem "capybara-webkit"
gem "chromedriver-helper"
gem "launchy"
gem "poltergeist"
Expand Down
4 changes: 2 additions & 2 deletions rakelib/dummy_apps.rake
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ namespace :dummy_apps do
sh_in_dir(dummy_app_dir, "yarn install --mutex network")
end

task :dummy_app_with_turbolinks_5 do
task :dummy_app_with_turbolinks_2 do
dummy_app_dir = File.join(gem_root, "spec/dummy")
bundle_install_with_turbolinks_5_in(dummy_app_dir)
bundle_install_with_turbolinks_2_in(dummy_app_dir)
sh_in_dir(dummy_app_dir, "yarn install --mutex network")
end

Expand Down
8 changes: 4 additions & 4 deletions rakelib/run_rspec.rake
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ namespace :run_rspec do
bundle_install_in(dummy_app_dir)
end

desc "Runs dummy respec with turbolinks 5"
task dummy_turbolinks_5: ["dummy_apps:dummy_app_with_turbolinks_5"] do
desc "Runs dummy respec with turbolinks 2"
task dummy_turbolinks_2: ["dummy_apps:dummy_app_with_turbolinks_2"] do
clean_gen_assets(spec_dummy_dir)
run_tests_in(spec_dummy_dir, env_vars:
"ENABLE_TURBOLINKS_5=TRUE BUNDLE_GEMFILE=#{dummy_app_dir}/Gemfile")
"ENABLE_TURBOLINKS_2=TRUE BUNDLE_GEMFILE=#{dummy_app_dir}/Gemfile")
end

# Dynamically define Rake tasks for each example app found in the examples directory
Expand All @@ -62,7 +62,7 @@ namespace :run_rspec do
end

desc "run all tests no examples"
task all_but_examples: [:gem, :dummy, :dummy_no_turbolinks, :dummy_turbolinks_5, :empty, :js_tests] do
task all_but_examples: [:gem, :dummy, :dummy_no_turbolinks, :dummy_turbolinks_2, :empty, :js_tests] do
puts "Completed all RSpec tests"
end

Expand Down
4 changes: 2 additions & 2 deletions rakelib/task_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def bundle_install_in_no_turbolinks(dir)
sh_in_dir(dir, "DISABLE_TURBOLINKS=TRUE bundle install")
end

def bundle_install_with_turbolinks_5_in(dir)
sh_in_dir(dir, "ENABLE_TURBOLINKS_5=TRUE BUNDLE_GEMFILE=#{dir}/Gemfile bundle install")
def bundle_install_with_turbolinks_2_in(dir)
sh_in_dir(dir, "ENABLE_TURBOLINKS_2=TRUE BUNDLE_GEMFILE=#{dir}/Gemfile bundle install")
end

# Runs bundle exec using that directory's Gemfile
Expand Down
18 changes: 10 additions & 8 deletions spec/dummy/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ source 'https://rubygems.org'
eval_gemfile File.expand_path("../../../react_on_rails.gemspec", __FILE__)

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.8'
gem 'rails'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
gem 'sass-rails'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 2.7.2'
gem 'uglifier'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
gem 'coffee-rails'

# Use jquery as the JavaScript library
gem 'jquery-rails'
Expand All @@ -20,10 +20,10 @@ gem 'puma'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
if ENV["DISABLE_TURBOLINKS"].nil? || ENV["DISABLE_TURBOLINKS"].strip.empty?
if ENV["ENABLE_TURBOLINKS_5"].nil? || ENV["ENABLE_TURBOLINKS_5"].strip.empty?
gem 'turbolinks', '2.5.3'
else
if ENV["ENABLE_TURBOLINKS_2"].nil? || ENV["ENABLE_TURBOLINKS_2"].strip.empty?
gem 'turbolinks', '~> 5.0'
else
gem 'turbolinks', '2.5.3'
end
end

Expand Down Expand Up @@ -66,7 +66,9 @@ group :test do
gem "coveralls", require: false
gem "capybara"
gem "capybara-screenshot"
gem "capybara-webkit"
gem "rails-controller-testing"
# install trouble with updated
# gem "capybara-webkit"
gem "chromedriver-helper"
gem "generator_spec"
gem "launchy"
Expand Down
Loading