Sha256: a7445f35044fa87a01657ab1fa3b47abdb4e687d7931695929b2a614cf7e64f0
Contents?: true
Size: 1.29 KB
Versions: 4
Compression:
Stored size: 1.29 KB
Contents
require File.expand_path('../teststrap', __FILE__) context 'Rabl::Configuration' do context 'defaults' do # multi_json compatibility TODO helper(:json_engine) { MultiJson.respond_to?(:adapter) ? MultiJson.adapter : MultiJson.engine } setup { Rabl.configuration } asserts(:include_json_root).equals true asserts(:include_child_root).equals true asserts(:include_xml_root).equals false asserts(:enable_json_callbacks).equals false asserts(:view_paths).equals [] asserts(:json_engine).equals { json_engine } asserts(:cache_engine).is_a?(Rabl::CacheEngine) end context 'custom JSON engine configured as Symbol' do setup do Rabl.configure do |c| c.json_engine = :yajl end end asserts('uses a custom JSON engine') { topic.json_engine.to_s =~ /MultiJson.*::Yajl/ } end # custom json, symbol context 'custom JSON engine configured as Class' do setup do Rabl.configure do |c| c.json_engine = ActiveSupport::JSON end end asserts('uses a custom JSON engine') { topic.json_engine.to_s == 'ActiveSupport::JSON' } end # custom JSON, class context 'invalid JSON engine configured' do asserts { Rabl.configure do |c| c.json_engine = Kernel end }.raises(RuntimeError) end # invalid end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rabl-0.7.5 | test/configuration_test.rb |
rabl-0.7.4 | test/configuration_test.rb |
rabl-0.7.3 | test/configuration_test.rb |
rabl-0.7.2 | test/configuration_test.rb |