Commit Graph

26 Commits

Author SHA1 Message Date
Elliot Winkler a9c3e9d0f2 Always use doc formatter for RSpec by default
Prior to this commit we only told RSpec to use the doc formatter if we
were running one test file. When a test file is being run using Zeus,
`unit_spec_helper` (and thus `spec_helper`) are loaded ahead of time.
This means that from RSpec's perspective, no files are being run, and so
the documentation formatter is not chosen, which means that the default
progress reporter is used.

This guard was added primarily to ensure that when tests are run on CI,
the progress reporter is used instead of the documentation formatter.
This happens anyway, though, because we pass that manually to RSpec
within the Rakefile. So we don't need this guard.
2016-01-07 11:50:04 -07:00
Elliot Winkler 878e9582e1 Extract a common spec helper
In order to write tests for the `word_wrap` method we have, we need a
spec helper that we can require. We don't need anything fancy. The
doublespeak_spec_helper is doing most of what we want except for the
Doublespeak require.
2015-10-07 23:32:51 -06:00
Elliot Winkler bbdf8a807e Reorganize unit tests, part I
* Move spec/shoulda to spec/unit_tests/shoulda
* Move spec/support/*.rb to spec/support/unit_tests/{helpers,matchers}
* Move spec_helper.rb to unit_spec_helper.rb
2014-11-04 14:43:59 -07:00
Elliot Winkler 2d32a715de Remove warning from RSpec
RSpec 3 will no longer infer the spec type from the file location, so
2.99 prints this warning:

    --------------------------------------------------------------------------------
    rspec-rails 3 will no longer automatically infer an example group's spec type
    from the file location. You can explicitly opt-in to this feature using this
    snippet:

    RSpec.configure do |config|
      config.infer_spec_type_from_file_location!
    end

    If you wish to manually label spec types via metadata you can safely ignore
    this warning and continue upgrading to RSpec 3 without addressing it.
    --------------------------------------------------------------------------------

So this commit merely adds the snippet to get rid of that warning.
2014-10-17 12:27:53 -06:00
Pedro Nascimento 1f24f04da3 Using RSpec 3 for development. 2014-08-14 12:16:54 -04:00
Elliot Winkler 12cc7aaace Remove all Ruby-emitted warnings
Run RSpec tests with warnings enabled so we stay on top of this better
in the future.
2014-07-18 18:00:08 -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
Elliot Winkler ce9c9b8d5b Set I18n.enforce_available_locales correctly
This setting is only available for I18n v0.6.9, so setting it for all
versions of Rails or I18n versions may not work.
2014-01-21 11:34:45 -07:00
Elliot Winkler d597ea89f3 Fix I18n.enforce_available_locales warning
The warning message was:

  [deprecated] I18n.enforce_available_locales will default to true in
  the future. If you really want to skip validation of your locale you
  can set I18n.enforce_available_locales = false to avoid this message.
2014-01-20 11:24:00 -07:00
Elliot Winkler 4e74ba8e48 Convert to RSpec expect syntax 2014-01-20 11:17:32 -07:00
Elliot Winkler 8a0bf45d0f Refactor spec_helper
The code that sets up the blank Rails application we use for testing is
a little messy. Let's use an object to encapsulate this and then refer
to this object every time we access Rails.application.
2013-12-03 11:09:06 -05:00
Elliot Winkler 4440445baf Auto-retry `bundle install` when Travis runs tests
`bundle install` doesn't always work -- sometimes it runs into errors
making HTTP requests, for whatever reason. This will cause Travis to
fail which is pretty annoying.

* Travis supplies an executable called `travis_retry` which will
  automatically retry the command up to 3 times before really failing.
  Tell Travis to use this when it runs `bundle install` before it
  runs tests.
* In spec_helper, we create a Rails app and use this within the
  test suite. This will also run `bundle install`. Unfortunately we
  can't use `travis_retry` for this as it's a function and is not
  available to us in Ruby-land, so use our own retry logic.
2013-12-03 11:09:01 -05:00
Melissa Xie 6b105ba7cd Remove 'have_sent_email' matcher
* See issue #252
2013-04-03 13:08:27 -04:00
Jason Draper and George Brocklehurst 7b15429ebe Add a StrongParametersMatcher 2013-01-25 11:07:48 +01:00
Gabe Berke-Williams af8f9a7bff Use current thoughtbot style in specs 2012-12-26 22:45:54 -05:00
Gabe Berke-Williams 4574f51692 Rearrange requires such that tests pass. 2012-03-25 16:32:26 -04:00
Gabe Berke-Williams 1c517d2795 Rearrange requires. 2012-03-23 21:00:36 -04:00
Gabe Berke-Williams bd524833ff We don't use autorun. 2012-03-23 20:59:35 -04:00
Gabe Berke-Williams e70e1bf9a5 Require bourne. 2012-03-23 20:00:09 -04:00
Gabe Berke-Williams f1a3dca5b9 Update to modern thoughtbot style. 2012-03-16 12:15:23 -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 3170294b44 Generate new Rails application every time we run RSpec 2011-05-25 15:36:13 -04:00
Joe Ferris 56b0a0439e Move into the Matchers namespace 2010-12-15 17:34:19 -05:00
Joe Ferris 2037e969dc Removed the Matchers namespace 2010-12-14 18:51:39 -05:00
Joe Ferris 4ee78bfe99 Fixes for Rails 3.0.3 and RSpec 2.3 2010-12-14 18:35:12 -05:00
Joe Ferris 6aca71765a Extracted the context framework, switched to rspec 2010-12-14 17:02:03 -05:00