Skip to content

Commit 4259863

Browse files
committed
Added simple spec for rabl method
1 parent 25d5ff6 commit 4259863

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

spec/gon/gon_spec.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,16 @@
4040
lambda { Gon.all_variables = 123 }.should raise_error
4141
end
4242

43+
it 'render json from rabl template' do
44+
Gon.clear
45+
controller = ActionController::Base.new
46+
objects = [1,2]
47+
controller.instance_variable_set('@objects', objects)
48+
Gon.rabl 'spec/test_data/sample.rabl', :controller => controller
49+
Gon.objects.length.should == 2
50+
end
51+
4352
def request
4453
@request ||= double 'request', :env => {}
4554
end
46-
end
55+
end

spec/test_data/sample.rabl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
collection @objects => 'objects'
2+
attributes :id

0 commit comments

Comments
 (0)