Skip to content

Commit

Permalink
Manually delegate prepare_destination due to changes in delegate for …
Browse files Browse the repository at this point in the history
…Rails 4
  • Loading branch information
twalpole committed Apr 16, 2012
1 parent 16af120 commit 36232fd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/ammeter/rspec/generator/example/generator_example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ module GeneratorExampleGroup
extend ActiveSupport::Concern
include ::RSpec::Rails::RailsExampleGroup

DELEGATED_METHODS = [:capture, :prepare_destination,
:destination_root, :current_path, :generator_class]
DELEGATED_METHODS = [:capture, :destination_root, :current_path, :generator_class]
module ClassMethods
mattr_accessor :test_unit_test_case_delegate
delegate :default_arguments, :to => :'self.test_unit_test_case_delegate'
Expand All @@ -23,6 +22,10 @@ module ClassMethods
end
delegate :destination, :arguments, :to => ::Rails::Generators::TestCase

def prepare_destination
self.test_unit_test_case_delegate.send :prepare_destination
end

def initialize_delegate
self.test_unit_test_case_delegate = ::Rails::Generators::TestCase.new 'pending'
self.test_unit_test_case_delegate.class.tests(describes)
Expand Down Expand Up @@ -50,6 +53,11 @@ def invoke_task name
DELEGATED_METHODS.each do |method|
delegate method, :to => :'self.class'
end

def prepare_destination
self.class.send :prepare_destination
end

::Rails::Generators::TestCase.destination File.expand_path('ammeter', Dir.tmpdir)
initialize_delegate

Expand Down

0 comments on commit 36232fd

Please sign in to comment.