Skip to content

Commit

Permalink
Fixes Rails 3.2 ActiveSupport::Concern deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerian committed Jan 26, 2012
1 parent 43295db commit 91df301
Showing 1 changed file with 38 additions and 40 deletions.
78 changes: 38 additions & 40 deletions lib/apotomo/test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,54 +34,52 @@ class TestCase < Cell::TestCase # TODO: re-arrange modules in Cell::TestCase and
module TestMethods
extend ActiveSupport::Concern

module InstanceMethods
include Cell::TestCase::CommonTestMethods
include Cell::TestCase::CommonTestMethods

attr_reader :view_assigns

def setup
super # defined in Cell::TestCase::CommonTestMethods.

attr_reader :view_assigns

def setup
super # defined in Cell::TestCase::CommonTestMethods.

@controller.instance_eval do
def controller_path
'barn'
end
@controller.instance_eval do
def controller_path
'barn'
end
@controller.extend Apotomo::Rails::ControllerMethods
end

# Renders the widget +name+.
def render_widget(*args)
@view_assigns = extract_state_ivars_for(root[args.first]) do
@last_invoke = root.render_widget(*args)
end

@last_invoke
@controller.extend Apotomo::Rails::ControllerMethods
end

# Renders the widget +name+.
def render_widget(*args)
@view_assigns = extract_state_ivars_for(root[args.first]) do
@last_invoke = root.render_widget(*args)
end

@last_invoke
end

# Triggers an event of +type+. You have to pass the +source+ as second options.
#
# Example:
#
# trigger :submit, :comments
def trigger(type, source, options={})
source = root.find_widget(source)
source.fire(type, options)
root.page_updates
end
# Triggers an event of +type+. You have to pass the +source+ as second options.
#
# Example:
#
# trigger :submit, :comments
def trigger(type, source, options={})
source = root.find_widget(source)
source.fire(type, options)
root.page_updates
end

# Returns the widget tree from TestCase.has_widgets.
def root
blk = self.class.has_widgets_blocks or raise "Please setup a widget tree using has_widgets()"
@root ||= Apotomo::Widget.new(parent_controller, "root").tap do |root|
self.instance_exec(root, &blk)
end
end

def parent_controller
@controller
# Returns the widget tree from TestCase.has_widgets.
def root
blk = self.class.has_widgets_blocks or raise "Please setup a widget tree using has_widgets()"
@root ||= Apotomo::Widget.new(parent_controller, "root").tap do |root|
self.instance_exec(root, &blk)
end
end

def parent_controller
@controller
end

module ClassMethods
def has_widgets_blocks
Expand Down

0 comments on commit 91df301

Please sign in to comment.