1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot_rails.git synced 2022-11-09 11:49:18 -05:00

Test against Rails 3.2, 4.0, 4.1

* Remove gemfiles from version control to match same testing style as
  Clearance and Suspenders.
* MiniTest does not need to be manually included as it is automatically
  included by Rails by default.
* Add spring for Rails 4.1.
* Disable Spring to get specs to pass on Rails 4.1.
* Add therubyrhino for JRuby.
* Remove old references to Rails 3.
* Fix JRuby test where output is "1 runs", not "1 tests".
* Remove Rails 3.0 reference to "turn".
This commit is contained in:
Dan Croak 2014-05-26 20:39:51 -07:00
parent e206e73698
commit 00cb2eabb1
14 changed files with 172 additions and 428 deletions

View file

@ -1,3 +1,5 @@
language: ruby
cache: bundler
rvm:
- 1.9.3
- 2.0.0
@ -9,8 +11,12 @@ before_install:
jdk:
- openjdk6
gemfile:
- gemfiles/rails3.1.gemfile
- gemfiles/rails3.2.gemfile
- gemfiles/rails4.0.gemfile
- gemfiles/rails4.1.gemfile
branches:
only:
- master
install:
- "travis_retry bundle install"
- "travis_retry bundle exec appraisal install"

View file

@ -1,25 +1,16 @@
appraise "rails3.1" do
gem "rails", "3.1.10"
gem "sass-rails"
gem "coffee-rails"
gem "uglifier"
gem "sqlite3", ">= 1.3.4", platforms: :mri
gem "activerecord-jdbcsqlite3-adapter", "~> 1.2.5", platforms: :jruby
gem "minitest-rails"
gem "therubyrhino"
gem "jquery-rails"
gem "rspec-rails"
# These are the versions of Rails we want to test against.
appraise 'rails3.2' do
gem 'rails', '~> 3.2.18'
gem 'sass-rails'
end
appraise "rails3.2" do
gem "rails", "3.2.11"
gem "sass-rails"
gem "coffee-rails"
gem "uglifier"
gem "sqlite3", ">= 1.3.4", platforms: :mri
gem "activerecord-jdbcsqlite3-adapter", "~> 1.2.5", platforms: :jruby
gem "minitest-rails"
gem "therubyrhino"
gem "jquery-rails"
gem "rspec-rails"
appraise 'rails4.0' do
gem 'rails', '~> 4.0.5'
gem 'sass-rails'
end
appraise 'rails4.1' do
gem 'rails', '~> 4.1.1'
gem 'sass-rails', '~> 4.0.3'
gem 'spring'
end

17
Gemfile
View file

@ -1,3 +1,20 @@
source "https://rubygems.org"
gemspec
gem 'appraisal'
gem 'aruba'
gem 'coffee-rails'
gem 'cucumber'
gem 'jquery-rails'
gem 'rake'
gem 'rspec-rails'
gem 'uglifier'
if RUBY_PLATFORM == 'java'
gem 'activerecord-jdbcsqlite3-adapter'
gem 'jdbc-sqlite3'
gem 'therubyrhino'
else
gem 'sqlite3'
end

111
Gemfile.lock Normal file
View file

@ -0,0 +1,111 @@
PATH
remote: .
specs:
factory_girl_rails (4.4.1)
factory_girl (~> 4.4.0)
railties (>= 3.0.0)
GEM
remote: https://rubygems.org/
specs:
actionpack (4.1.1)
actionview (= 4.1.1)
activesupport (= 4.1.1)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
actionview (4.1.1)
activesupport (= 4.1.1)
builder (~> 3.1)
erubis (~> 2.7.0)
activesupport (4.1.1)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
appraisal (1.0.0)
bundler
rake
thor (>= 0.14.0)
aruba (0.5.4)
childprocess (>= 0.3.6)
cucumber (>= 1.1.1)
rspec-expectations (>= 2.7.0)
builder (3.2.2)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.7.0)
cucumber (1.3.15)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.1)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (2.0.2)
factory_girl (4.4.0)
activesupport (>= 3.0.0)
ffi (1.9.3)
gherkin (2.12.2)
multi_json (~> 1.3)
i18n (0.6.9)
jquery-rails (3.1.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
minitest (5.3.4)
multi_json (1.10.1)
multi_test (0.1.1)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
railties (4.1.1)
actionpack (= 4.1.1)
activesupport (= 4.1.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.3.2)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.3)
rspec-rails (2.11.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.11.0)
sqlite3 (1.3.9)
thor (0.19.1)
thread_safe (0.3.3)
tzinfo (1.2.0)
thread_safe (~> 0.1)
uglifier (2.5.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
PLATFORMS
ruby
DEPENDENCIES
appraisal
aruba
coffee-rails
cucumber
factory_girl_rails!
jquery-rails
rake
rspec (~> 2.11.0)
rspec-rails
sqlite3
uglifier

View file

@ -10,11 +10,13 @@ inheritance.
Rails
-----
`factory_girl_rails` provides Rails integration for `factory_girl`. All
Rails-specific features are only compatible with Rails 3.
`factory_girl_rails` provides Rails integration for `factory_girl`.
Currently, automatic factory definition loading is the only Rails-specific feature.
Supported Rails versions are listed in [`Appraisals`](Appraisals). Supported
Ruby versions are listed in [`.travis.yml`](.travis.yml).
Download
--------
@ -84,4 +86,6 @@ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
License
-------
factory_girl is Copyright © 2008-2013 Joe Ferris and thoughtbot. It is free software, and may be redistributed under the terms specified in the LICENSE file.
factory_girl is Copyright © 2008-2014 Joe Ferris and thoughtbot. It is free
software, and may be redistributed under the terms specified in the LICENSE
file.

View file

@ -1,5 +1,5 @@
Feature:
In order to not have to manually configure factory girl as the testing fixture replacement by using the --fixture-replacement=factory_girl option as a Rails3 and Factory Girl user
In order to not have to manually configure Factory Girl as the Rails testing fixture replacement by using the --fixture-replacement=factory_girl option
I would like the Factory Girl Rails gem to configure Factory Girl as the fixture replacement.
Background:
@ -54,29 +54,22 @@ Feature:
But the following files should exist:
| custom/dir/users.rb |
Scenario: Using Factory Girl and Factory Girl Rails with MiniTest should generate a factory file
When I add "minitest" as a dependency
And I configure the testing framework to use MiniTest
And I run `bundle install` with a clean environment
Then the output should contain "minitest"
Scenario: Using Factory Girl Rails with MiniTest should generate a factory file
When I run `bundle install` with a clean environment
And I run `bundle exec rails generate model User name:string` with a clean environment
Then the following files should exist:
| test/factories/users.rb |
But the following files should not exist:
| spec/fixtures/users.yml |
Scenario: Using Factory Girl and Factory Girl Rails with MiniTest and a custom directory should generate a factory file
Scenario: Using Factory Girl Rails with MiniTest and a custom directory should generate a factory file
When I configure the factories directory as "custom/dir"
And I add "minitest" as a dependency
And I configure the testing framework to use MiniTest
And I run `bundle install` with a clean environment
Then the output should contain "minitest"
And I run `bundle exec rails generate model User name:string` with a clean environment
Then the following files should exist:
| custom/dir/users.rb |
But the following files should not exist:
| spec/fixtures/users.yml |
And the file "test/models/user_test.rb" should contain "MiniTest::Rails::ActiveSupport::TestCase"
Scenario: Disable Factory Girl generator
When I configure the factories as:

View file

@ -1,6 +1,6 @@
Feature:
In order to easily generate factory files instead of fixture files when generating models
As a user of Rails3 and factory_girl
As a user of Rails and Factory Girl
I would like to use factory_girl_rails generators.
Background:

View file

@ -4,7 +4,6 @@ Feature: automatically load step definitions
When I successfully run `bundle exec rails new testapp`
And I cd to "testapp"
And I add "factory_girl_rails" from this project as a dependency
And I comment out gem "turn" from my Gemfile
And I run `bundle install` with a clean environment
And I write to "db/migrate/1_create_users.rb" with:
"""
@ -23,7 +22,7 @@ Feature: automatically load step definitions
end
"""
Scenario: generate a rails 3 application and use factory definitions
Scenario: generate a Rails application and use factory definitions
When I write to "test/factories.rb" with:
"""
FactoryGirl.define do
@ -44,7 +43,7 @@ Feature: automatically load step definitions
end
"""
When I run `bundle exec rake test --trace` with a clean environment
Then the output should contain "1 tests, 1 assertions, 0 failures, 0 errors"
Then the output should contain "1 assertions, 0 failures, 0 errors"
Scenario: use factories advertised by railties/engines/3rd-party gems
When I append to "config/application.rb" with:
@ -82,4 +81,4 @@ Feature: automatically load step definitions
end
"""
When I run `bundle exec rake test --trace` with a clean environment
Then the output should contain "1 tests, 1 assertions, 0 failures, 0 errors"
Then the output should contain "1 assertions, 0 failures, 0 errors"

View file

@ -1,5 +1,5 @@
When /^I run `([^"]+)` with a clean environment$/ do |command|
step %{I successfully run `ruby -e 'system({"BUNDLE_GEMFILE" => nil}, "#{command}")'`}
step %{I successfully run `ruby -e 'system({"BUNDLE_GEMFILE" => nil, "DISABLE_SPRING" => "true"}, "#{command}")'`}
end
# system({'BUNDLE_GEMFILE' => nil}, "cd tmp/aruba/testapp && #{command} && cd -")

View file

@ -19,6 +19,14 @@ When /^I set the FactoryGirl :suffix option to "([^"]+)"$/ do |suffix|
end
When /^I print out "([^"]*)"$/ do |path|
in_current_dir do
File.open(path, 'r') do |f|
puts f.inspect
end
end
end
When /^I configure the factories as:$/ do |string|
append_to_file File.join('config', 'application.rb'), <<-END
class Testapp::Application
@ -37,19 +45,6 @@ end
END
end
When /^I configure the testing framework to use MiniTest$/ do
append_to_file('Gemfile', %{gem "minitest-rails", :group => [:development, :test]\n})
step %{I run `rails generate mini_test:install` with a clean environment}
append_to_file File.join('config', 'application.rb'), <<-END
class Testapp::Application
config.generators do |g|
g.test_framework :mini_test, :fixture => false, :fixture_replacement => :factory_girl
end
end
END
end
When /^I comment out gem "([^"]*)" from my Gemfile$/ do |gem_name|
in_current_dir do
content = File.read('Gemfile')

View file

@ -1,16 +0,0 @@
# This file was generated by Appraisal
source "https://rubygems.org"
gem "rails", "3.1.10"
gem "sass-rails"
gem "coffee-rails"
gem "uglifier"
gem "sqlite3", ">= 1.3.4", :platforms=>:mri
gem "activerecord-jdbcsqlite3-adapter", "~> 1.2.5", :platforms=>:jruby
gem "minitest-rails"
gem "therubyrhino"
gem "jquery-rails"
gem "rspec-rails"
gemspec :path=>"../"

View file

@ -1,171 +0,0 @@
PATH
remote: /Users/joshuaclayton/dev/gems/factory_girl_rails
specs:
factory_girl_rails (4.4.1)
factory_girl (~> 4.4.0)
railties (>= 3.0.0)
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.1.10)
actionpack (= 3.1.10)
mail (~> 2.3.3)
actionpack (3.1.10)
activemodel (= 3.1.10)
activesupport (= 3.1.10)
builder (~> 3.0.0)
erubis (~> 2.7.0)
i18n (~> 0.6)
rack (~> 1.3.6)
rack-cache (~> 1.2)
rack-mount (~> 0.8.2)
rack-test (~> 0.6.1)
sprockets (~> 2.0.4)
activemodel (3.1.10)
activesupport (= 3.1.10)
builder (~> 3.0.0)
i18n (~> 0.6)
activerecord (3.1.10)
activemodel (= 3.1.10)
activesupport (= 3.1.10)
arel (~> 2.2.3)
tzinfo (~> 0.3.29)
activeresource (3.1.10)
activemodel (= 3.1.10)
activesupport (= 3.1.10)
activesupport (3.1.10)
multi_json (>= 1.0, < 1.3)
appraisal (0.5.1)
bundler
rake
arel (2.2.3)
aruba (0.5.1)
childprocess (~> 0.3.6)
cucumber (>= 1.1.1)
rspec-expectations (>= 2.7.0)
builder (3.0.4)
childprocess (0.3.7)
ffi (~> 1.0, >= 1.0.6)
coffee-rails (3.1.1)
coffee-script (>= 2.2.0)
railties (~> 3.1.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.4.0)
cucumber (1.2.1)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.11.0)
json (>= 1.4.6)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
factory_girl (4.4.0)
activesupport (>= 3.0.0)
ffi (1.3.1)
gherkin (2.11.6)
json (>= 1.7.6)
hike (1.2.1)
i18n (0.6.1)
jquery-rails (2.2.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.7.6)
mail (2.3.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
minitest (4.4.0)
minitest-rails (0.3)
minitest (~> 4.0)
rails (~> 3.0)
multi_json (1.2.0)
polyglot (0.3.3)
rack (1.3.9)
rack-cache (1.2)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.1.10)
actionmailer (= 3.1.10)
actionpack (= 3.1.10)
activerecord (= 3.1.10)
activeresource (= 3.1.10)
activesupport (= 3.1.10)
bundler (~> 1.0)
railties (= 3.1.10)
railties (3.1.10)
actionpack (= 3.1.10)
activesupport (= 3.1.10)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (10.0.3)
rdoc (3.12)
json (~> 1.4)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.3)
rspec-rails (2.11.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.11.0)
sass (3.2.5)
sass-rails (3.1.7)
actionpack (~> 3.1.0)
railties (~> 3.1.0)
sass (>= 3.1.10)
tilt (~> 1.3.2)
sprockets (2.0.4)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.7)
therubyrhino (2.0.2)
therubyrhino_jar (>= 1.7.3)
therubyrhino_jar (1.7.4)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.35)
uglifier (1.3.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
PLATFORMS
ruby
DEPENDENCIES
activerecord-jdbcsqlite3-adapter (~> 1.2.5)
appraisal (~> 0.5.0)
aruba (~> 0.5.1)
coffee-rails
cucumber (~> 1.2.1)
factory_girl_rails!
jquery-rails
minitest-rails
rails (= 3.1.10)
rake
rspec (~> 2.11.0)
rspec-rails
sass-rails
sqlite3 (>= 1.3.4)
therubyrhino
uglifier

View file

@ -1,16 +0,0 @@
# This file was generated by Appraisal
source "https://rubygems.org"
gem "rails", "3.2.11"
gem "sass-rails"
gem "coffee-rails"
gem "uglifier"
gem "sqlite3", ">= 1.3.4", :platforms=>:mri
gem "activerecord-jdbcsqlite3-adapter", "~> 1.2.5", :platforms=>:jruby
gem "minitest-rails"
gem "therubyrhino"
gem "jquery-rails"
gem "rspec-rails"
gemspec :path=>"../"

View file

@ -1,169 +0,0 @@
PATH
remote: /Users/joshuaclayton/dev/gems/factory_girl_rails
specs:
factory_girl_rails (4.4.1)
factory_girl (~> 4.4.0)
railties (>= 3.0.0)
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.11)
actionpack (= 3.2.11)
mail (~> 2.4.4)
actionpack (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.11)
activesupport (= 3.2.11)
builder (~> 3.0.0)
activerecord (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.11)
activemodel (= 3.2.11)
activesupport (= 3.2.11)
activesupport (3.2.11)
i18n (~> 0.6)
multi_json (~> 1.0)
appraisal (0.5.1)
bundler
rake
arel (3.0.2)
aruba (0.5.1)
childprocess (~> 0.3.6)
cucumber (>= 1.1.1)
rspec-expectations (>= 2.7.0)
builder (3.0.4)
childprocess (0.3.7)
ffi (~> 1.0, >= 1.0.6)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.4.0)
cucumber (1.2.1)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.11.0)
json (>= 1.4.6)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
factory_girl (4.4.0)
activesupport (>= 3.0.0)
ffi (1.3.1)
gherkin (2.11.6)
json (>= 1.7.6)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.2.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.7.6)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.19)
minitest (4.4.0)
minitest-rails (0.3)
minitest (~> 4.0)
rails (~> 3.0)
multi_json (1.5.0)
polyglot (0.3.3)
rack (1.4.4)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.11)
actionmailer (= 3.2.11)
actionpack (= 3.2.11)
activerecord (= 3.2.11)
activeresource (= 3.2.11)
activesupport (= 3.2.11)
bundler (~> 1.0)
railties (= 3.2.11)
railties (3.2.11)
actionpack (= 3.2.11)
activesupport (= 3.2.11)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.3)
rdoc (3.12)
json (~> 1.4)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.3)
rspec-rails (2.11.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.11.0)
sass (3.2.5)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.7)
therubyrhino (2.0.2)
therubyrhino_jar (>= 1.7.3)
therubyrhino_jar (1.7.4)
thor (0.17.0)
tilt (1.3.3)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.35)
uglifier (1.3.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
PLATFORMS
ruby
DEPENDENCIES
activerecord-jdbcsqlite3-adapter (~> 1.2.5)
appraisal (~> 0.5.0)
aruba (~> 0.5.1)
coffee-rails
cucumber (~> 1.2.1)
factory_girl_rails!
jquery-rails
minitest-rails
rails (= 3.2.11)
rake
rspec (~> 2.11.0)
rspec-rails
sass-rails
sqlite3 (>= 1.3.4)
therubyrhino
uglifier