-
Notifications
You must be signed in to change notification settings - Fork 630
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Monkey patch ammeter to fix issue with changes to delegate from Rails 4
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'ammeter' | ||
# Rails 4 changes the implementation of delegate to no longer use send. | ||
#Because of this it can no longer be used to delegate to a protected of another object as Ammeter attempts to do for prepare_destination | ||
#Monkey patch Ammeter to call send itself for perpare_destination when in Rails 4. | ||
#Needed until Ammeter fixes itself | ||
module Ammeter | ||
module RSpec | ||
module Rails | ||
# Delegates to Rails::Generators::TestCase to work with RSpec. | ||
module GeneratorExampleGroup | ||
module ClassMethods | ||
def prepare_destination | ||
self.test_unit_test_case_delegate.send :prepare_destination | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end if ::Rails::VERSION::MAJOR == 4 |