Commit Graph

30 Commits

Author SHA1 Message Date
Elliot Winkler 72f60fae94 Add support for Postgres
When running tests, you can now switch between running them against a
SQLite or PostgreSQL database. This is accomplished by modifying the
unit and acceptance tests so that when they generate and load the test
Rails application, database.yml is replaced with content that will
configure the database appropriately.
2015-02-12 16:01:00 -07:00
Elliot Winkler 56ded0548d Add support for Ruby 2.2
Secondary author: Luciano Sousa <ls@lucianosousa.net>

Also, upgrade to rspec-rails 3.2.0 explicitly. (See
b7fe87ae91 for an explanation of why 3.2.0
is necessary here.)
2015-02-09 11:46:25 -07:00
Elliot Winkler a4045a1f9b Remove Rails 3.x, Ruby 1.9.2, Ruby 1.9.3
Ruby 1.9.3 will be end-of-lifed on February 23, 2015. We might as well
remove support for it now.
2015-02-09 10:52:22 -07:00
Elliot Winkler 093268eac4 Clean up Gemfile
* Remove Aruba and Bourne since we don't use them anymore
* Remove Rails from main Gemfile as it's already a dependency in each of
  the appraisals
* Tighten dependency on Rake to 10.x
* Move dependencies shared among appraisals to Appraisals
2015-02-09 10:47:00 -07:00
Elliot Winkler b7fe87ae91 Test against RSpec 3 from now on
* Ruby 2.2 removed Minitest and Test::Unit from the standard library
  [[1]], [[2]]
* rspec-rails requires Test::Unit for Rails versions prior to 4.1 (which
  switched to Minitest)
* This doesn't work now, because we don't have Test::Unit present in the
  gem bundle
* RSpec 3.2.0 fixes this issue [[3]]

I don't really see this as a huge concern, since we were testing against
RSpec 2.99 for Rails < 4, and that has most of the changes that RSpec 3
has.

[1]: f8c6a5dc02
[2]: 96f552670d
[3]: 999ebb7c5c (diff-08d960c572ac094640dd183fa9641393R13)
2015-02-05 16:27:29 -07:00
Elliot Winkler d7f7f58637 Remove debugger, byebug, and web-console from 4.2
debugger and byebug cannot be present in Appraisals because they only
work on specific Ruby versions, and we test against a range of Ruby
versions. Hence, they can't be present in the Rails application that
gets generated in acceptance tests, either.

Also, we don't really need web-console to be there, it's just an extra
dependency.
2015-02-05 10:22:12 -07:00
Elliot Winkler 1e4555eaac Add Rails 4.2 to Travis 2015-01-23 09:43:08 -07:00
Elliot Winkler 5aed533412 Add Appraisal for Rails 4.2 2014-12-24 16:27:51 -05:00
Elliot Winkler db7723d925 Add minitest to Rails 3.x appraisals
The minitest dependency is necessary in order to write Cucumber tests
that depend on Minitest.
2014-10-08 01:04:20 -06:00
Elliot Winkler de7e550f7e Add Cucumber setup for testing standalone Ruby applications 2014-10-07 22:07:48 -06:00
Pedro Nascimento 1f24f04da3 Using RSpec 3 for development. 2014-08-14 12:16:54 -04:00
Elliot Winkler 12543ede2e Use same assertion class as Rails, if loaded
Given this scenario:

* Using Rails 4.1
* Gemfile has `gem 'shoulda-matchers', require: false`
* spec_helper has `require 'shoulda/matchers'` following
  `require 'rspec/rails'`
* Using Spring to run tests

matchers that delegate to assertions in Rails (e.g. `render_template`
and `route`) will fail in the wrong way if used. They fail because in
order to use these assertions, we expect that the assertions will
raise a specific exception, an exception that corresponds to whichever
test framework that Rails is using. For Rails versions that used
Test::Unit, this is Test::Unit::AssertionFailedError. For current Rails
versions, which now use Minitest, this exception is Minitest::Assertion.

The problem is that instead of asking Rails which exception class it's
using, we are trying to detect this exception class ourselves (for
cases in which Rails is not being used). This leads to the wrong class
being detected: when using a Rails version that uses Minitest, we choose
Test::Unit::AssertionFailedError as the class. This happens using the
exact scenario above because even though shoulda-matchers is loaded
after rspec-rails, rspec-rails itself defines
Test::Unit::AssertionFailedError.

Also add Cucumber tests that confirms this exact scenario works.
2014-06-27 14:06:47 -06:00
Elliot Winkler f13e069f09 Add missing test dependences to Appraisals
Since as of commit 2748b75087, we no
longer install dependencies inside of the Rails app that is generated
and used to run all of the tests, we have to require all of the
dependencies that the app would install inside of the appropriate
Appraisals.

This was mostly straightforward except for some workarounds with the
turn gem:

* Rails 3.1 requires two versions of turn depending on which Ruby
  version you're using. On 1.9.2, it uses turn 0.9.2; after 1.9.2, it
  uses ~> 0.9.3. To accommodate this we have to have two versions of the
  Rails 3.1 appraisal which declare the different turn versions.
* Rails 3.1 also loads the turn gem even if, in the Gemfile for the app,
  turn is declared with `require: false`. This causes a problem while
  running our tests because turn actually requires minitest/autorun,
  which adds a hook so when Ruby exits, Minitest tests are run. Because
  we're already using RSpec, Minitest will try to re-run the `rspec`
  command we ran within a Minitest environment. This will fail since we
  are using RSpec-specific command line options to run the tests.
  Unfortunately there's no way to shut off minitest/autorun after it's
  been required, so we have to monkey-patch Minitest's #run method so
it's a no-op.
2014-05-21 09:50:46 -06:00
Mauro George 714cf87d78 Add support to rails 4.1.0 2014-04-08 17:41:31 -03:00
Elliot Winkler e3c64779de Add Appraisal for Rails 4.0.1 2013-12-18 22:32:28 -07:00
Carsten Zimmermann bcd8173383 Fix regression with context-dependent validations in ActiveResource
As reported in #348, model#valid? is called with one argument while
ActiveResource::Validations only defines #valid? without an optional
argument.

The interface of ActiveResouce::Validations#valid? is the same for
A'resource in Rails 3.2 and the one extracted into a gem.

Rails 3.2 version:
https://github.com/rails/rails/blob/3-2-stable/activeresource/lib/active_resource/validations.rb#L123

Gem version:
https://github.com/rails/activeresource/blob/master/lib/active_resource/validations.rb#L160
2013-09-11 14:26:40 -06:00
Matt Daubert 5815d38fa0 Add have_secure_password matcher 2013-09-05 19:51:04 -06:00
Derek Prior 2e4e76ccfb Add Rails 4 Appraisal
Rails 4 includes strong parameters and removed attr_accessible
(protected attributes). I removed the strong_parameters development
dependency and added it to all non-4.0 appraisals. I also added the
'protected_attributes' gem to the 4.0 appraisal because the test suite
examples make heavy use of attr_accessible.
2013-08-16 15:32:06 -06:00
Derek Prior cd61fb6085 Ruby 2.0 Support
* Add Ruby 2.0 support to the Appraisals
* Update travis to test 2.0.0 with the 3.2 gemfile. Clean up the travis
  matrix to favor the include syntax over exclude.
* Edit gemfile.locks to point to relative paths.
2013-04-19 17:11:45 -04:00
Erik Michaels-Ober dfcf777f47 Update 3.2.gemfile.lock 2012-12-03 08:32:44 -08:00
Erik Michaels-Ober ac505cd16e Update 3.1.gemfile.lock 2012-12-03 08:31:45 -08:00
Erik Michaels-Ober 181efb3ea4 Update 3.0.gemfile.lock 2012-12-03 08:30:46 -08:00
Gabe Berke-Williams 04ce17726d Update appraisals to latest Rails versions. 2012-10-01 15:36:04 -04:00
Gabe Berke-Williams aff28245e7 Test against Rails 3.2. 2012-04-20 14:35:57 -04:00
Gabe Berke-Williams 65cb82b2eb Bump Rails versions for appraisal. 2012-04-13 09:59:10 -04:00
Blake Thomson 76600615dd Remove uglifier and coffee-rails from the 3.1 gemfile, and modify spec_helper.rb to respect a BUNDLE_GEMFILE set on the command line. 2011-11-02 08:36:01 -07:00
Prem Sichanugrist 6785f596b4 Update Gem configuration for Ruby 1.9.3 and JRuby 2011-09-18 21:39:18 +07:00
Prem Sichanugrist 78b5e5f436 Update testing dependencies 2011-09-12 17:23:22 +07:00
Prem Sichanugrist f1c8b80523 Go back and use `bundle install --local`, but specify additional dependencies in `Appraisal` file. 2011-05-30 16:14:06 -04:00
Prem Sichanugrist 44847c6a87 Add Appraisals to the project to handle testing against multiple Rails version
Note that we also bump RSpec to 2.6.1.beta1 because the incompatibility with Rails 3.1.0.rc1
2011-05-25 14:59:01 -04:00