Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 9710d3f

Browse files
committed
Setup Appraisal to test multiple reactjs build provided by “react-rails” gem
1. Use `bundle exec appraisal install` to lock separate gem files 2. Use `bundle exec appraisal react-13 rake` to run separate gemfile , or `bundle exec appraisal rake` to run all variants.
1 parent cdc751d commit 9710d3f

File tree

9 files changed

+62
-2
lines changed

9 files changed

+62
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ node_modules
3131

3232
spec/test_app
3333
Gemfile.lock
34+
35+
/gemfiles/*.lock

Appraisals

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
appraise "react-13" do
2+
gem 'react-rails', '~> 1.3.3', require: false
3+
end
4+
5+
appraise "react-14" do
6+
gem 'react-rails', '~> 1.6.2', require: false
7+
end
8+
9+
appraise "react-15" do
10+
gem 'react-rails', '~> 1.8.2', require: false
11+
end

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
source 'https://rubygems.org'
22
gemspec
3+
4+
group :development do
5+
gem "appraisal"
6+
end

Rakefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@ Bundler::GemHelper.install_tasks
66
require 'rspec/core/rake_task'
77
require 'opal/rspec/rake_task'
88

9+
begin
10+
require "react-rails"
11+
rescue NameError
12+
end
13+
914
RSpec::Core::RakeTask.new('ruby:rspec')
15+
1016
Opal::RSpec::RakeTask.new('opal:rspec') do |s|
17+
s.append_path React::Rails::AssetVariant.new(addons: true).react_directory
1118
s.append_path 'spec/vendor'
1219
s.index_path = 'spec/index.html.erb'
1320
end

gemfiles/react_13.gemfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "react-rails", "~> 1.3.3", :require => false
6+
7+
group :development do
8+
gem "appraisal"
9+
end
10+
11+
gemspec :path => "../"

gemfiles/react_14.gemfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "react-rails", "~> 1.6.2", :require => false
6+
7+
group :development do
8+
gem "appraisal"
9+
end
10+
11+
gemspec :path => "../"

gemfiles/react_15.gemfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "react-rails", "~> 1.8.2", :require => false
6+
7+
group :development do
8+
gem "appraisal"
9+
end
10+
11+
gemspec :path => "../"

spec/spec_helper.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ def ruby?
1515

1616
if RUBY_ENGINE == 'opal'
1717
require File.expand_path('../vendor/jquery-2.2.4.min', __FILE__)
18-
require 'react-latest'
18+
require 'react.js'
19+
require "react-server.js"
1920
require 'reactive-ruby'
2021
require 'react/test/rspec'
21-
22+
2223
require File.expand_path('../support/react/spec_helpers', __FILE__)
2324

2425
module Opal

spec/vendor/react-server.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// A placeholder file to prevent file not found error of requireing
2+
// `react-server` in spec_helper.rb.

0 commit comments

Comments
 (0)