Module: Cell::TestCase::CommonTestMethods
- Included in:
- TestMethods
- Defined in:
- lib/cell/test_case.rb
Instance Method Summary collapse
-
#extract_state_ivars_for(cell) ⇒ Object
Runs the block while computing the instance variables diff from before and after.
- #setup ⇒ Object
Instance Method Details
#extract_state_ivars_for(cell) ⇒ Object
Runs the block while computing the instance variables diff from before and after.
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/cell/test_case.rb', line 73 def extract_state_ivars_for(cell) before = cell.instance_variables yield after = cell.instance_variables Hash[(after - before).collect do |var| next if var =~ /^@_/ [var[1, var.length].to_sym, cell.instance_variable_get(var)] end.compact] end |
#setup ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/cell/test_case.rb', line 63 def setup @controller ||= Class.new(ActionController::Base).new @request ||= ::ActionController::TestRequest.new @response = ::ActionController::TestResponse.new @controller.request = @request @controller.response = @response @controller.params = {} end |