Skip to content

Commit

Permalink
Deprecate old-style Rails plugin
Browse files Browse the repository at this point in the history
Apparently Rails plugins in the original sense (i.e. installed into
`vendor/plugins`) were deprecated in Rails v3 and removed entirely in
Rails v4 [1]. The concept of Rails plugins still exists, but they are
simply installed as gems.

I decided to use Kernel#warn directly rather than
Mocha::Deprecation.warning, because I was uncertain how the load path
worked in the old-style Rails plugin.

Fixes #403.

[1]: https://guides.rubyonrails.org/4_0_release_notes.html#railties-deprecations
  • Loading branch information
floehopper committed Nov 23, 2019
1 parent a34e1a8 commit 2df7713
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,6 @@ end

Note: There is no need to use a require statement to setup Mocha; RSpec does this itself.

#### Rails Plugin

Install the Rails plugin...

$ rails plugin install git://github.com/freerange/mocha.git

Note: As of version 0.9.8, the Mocha plugin is not automatically setup at plugin load time. Instead it must be manually setup e.g. at the bottom of your `test_helper.rb`.

##### MiniTest

```ruby
Expand All @@ -118,7 +110,6 @@ require 'mocha/minitest'
* 0.13.x versions cause a harmless, but annoying, deprecation warning when used with Rails 3.2.0-3.2.12, 3.1.0-3.1.10 & 3.0.0-3.0.19.
* 0.11.x versions don't work with Rails 3.2.13 (`TypeError: superclass mismatch for class ExpectationError`). See #115.
* Versions 0.10.2, 0.10.3 & 0.11.0 of the Mocha gem were broken. Please do not use these versions.
* Versions 0.9.6 & 0.9.7 of the Mocha Rails plugin were broken. Please do not use these versions.

### Usage

Expand Down
4 changes: 1 addition & 3 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
# Mocha should no longer be loaded at plugin load time
# You should explicitly load Mocha *after* Test::Unit or MiniTest have been loaded
# e.g. by adding "require 'mocha'" at the bottom of test/test_helper.rb
warn 'Mocha deprecation warning: The old-style Rails plugin will not be supported in future versions of Mocha.'

0 comments on commit 2df7713

Please sign in to comment.