require File.join(File.dirname(__FILE__), '../../../_lib.rb') class MoSQL::Test::SchemaTest < MoSQL::Test TEST_MAP = < "row 1", 'var' => 6}) assert_equal(["row 1", 6], out) end it 'Includes extra props' do out = @map.transform('db.with_extra_props', {'_id' => 7, 'var' => 6, 'other var' => {'key' => 'value'}}) assert_equal(2, out.length) assert_equal(7, out[0]) assert_equal({'var' => 6, 'other var' => {'key' => 'value'}}, JSON.parse(out[1])) end it 'gets all_columns right' do assert_equal(['_id', 'var'], @map.all_columns(@map.find_ns('db.collection'))) assert_equal(['_id', '_extra_props'], @map.all_columns(@map.find_ns('db.with_extra_props'))) end end describe 'when copying data' do it 'quotes special characters' do assert_equal(%q{\\\\}, @map.quote_copy(%q{\\})) assert_equal(%Q{\\\t}, @map.quote_copy( %Q{\t})) assert_equal(%Q{\\\n}, @map.quote_copy( %Q{\n})) assert_equal(%Q{some text}, @map.quote_copy(%Q{some text})) end end end