Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Monkey patch ammeter to fix issue with changes to delegate from Rails 4

  • Loading branch information...
commit 839ac018dd2103c097162d5029219ba4d0eec9b0 1 parent e8f60bb
@twalpole twalpole authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 spec/support/ammeter.rb
View
19 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
Please sign in to comment.
Something went wrong with that request. Please try again.