spec/gon/jbuilder_spec.rb in gon-5.2.1 vs spec/gon/jbuilder_spec.rb in gon-5.2.2
- old
+ new
@@ -30,19 +30,19 @@
Gon.jbuilder 'spec/test_data/sample_with_helpers.json.jbuilder', :controller => controller
expect(Gon.date).to eq('about 6 hours')
end
it 'render json from jbuilder template with controller methods' do
- pending
- controller.instance_eval {
+ class << controller
def private_controller_method
- puts 'gon test helper works'
+ 'gon test helper works'
end
+ helper_method :private_controller_method
private :private_controller_method
- }
+ end
Gon.jbuilder 'spec/test_data/sample_with_controller_method.json.jbuilder', :controller => controller
- expect(Gon.date).to eq('about 6 hours')
+ expect(Gon.data_from_method).to eq('gon test helper works')
end
it 'render json from jbuilder template with a partial' do
controller.view_paths << 'spec/test_data'
Gon.jbuilder 'spec/test_data/sample_with_partial.json.jbuilder', :controller => controller