Sha256: 2f42b182878aecbbe73709d31c523a75c93cd3156e4880a081c08d567b9afd11
Contents?: true
Size: 1.11 KB
Versions: 18
Compression:
Stored size: 1.11 KB
Contents
require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + '/../spec_helper_tables' unless metaclass.class_variable_defined? :@@set_up_demo_tables describe "Sequel::Serializer" do describe "to_fos_json method" do it "adds :only=>[] to the options hash" do data = Trip.new mock(data).to_json({:only=>[], :methods=>[]}) data.to_fos_json(:methods=>[]) end it "handles single sequel model" do add_test_table_data({:id=>1, :'goofy name col' => 123}) data = TestTable.first data.to_fos_json(:methods=>[:'goofy name col']).should == "{\"goofy name col\":123}" end it "handles an array of sequel models" do add_test_table_data({:id=>1, :'goofy name col' => 123}) array = [TestTable.first] array.to_fos_json(:methods=>[:'goofy name col']).should=="[{\"goofy name col\":123}]" end it "shows methods which are dynamically delegated" do add_test_table_data({:id=>1, :'date_col' => 123}) data = TestTable.first data.to_fos_json(:methods=>[:date_col__round]).should == "{\"date_col__round\":123}" end end end
Version data entries
18 entries across 18 versions & 1 rubygems