Skip to content

Commit

Permalink
Monkey patch ammeter to fix issue with changes to delegate from Rails 4
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed Apr 16, 2012
1 parent e8f60bb commit 839ac01
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/support/ammeter.rb
@@ -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

0 comments on commit 839ac01

Please sign in to comment.