3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/plug_test/app/config/initializers/plug_test.rb', line 3
def pt_helper(text = nil, &block)
@controller.plug_test_block = block
@controller.plug_test_text = text
class <<@controller
def overwrite_me
if @plug_test_text
@plug_test_answer = render_to_string(:inline => "<%=" + @plug_test_text + "%>")
elsif @plug_test_block
@plug_test_answer = @template.instance_eval(&@plug_test_block)
else
raise 'You win -- Did you call this method directly?'
end
render :text => @plug_test_answer
end
end
get :test_action
assert_response :success
@controller.plug_test_answer
end
|