Sha256: 33f7666921f881f2d38cbf6700bed2f63b5afecccdb7dd16a84855303d10f308
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
require 'spec_helper' module ActionView class TemplateHandler end module TemplateHandlers module Compilable end end class Template def self.register_template_handler(*args) end end end module Rails module VERSION def self.set(val) silence_warnings do const_set(:MAJOR, val) end end end end def set_rails(version) Rails::VERSION.set(version) if defined?(Serializable::XBuilder) Serializable.send(:remove_const, "XBuilder") xbuilder_path = $".detect { |lib| lib =~ /xbuilder/ } $".delete(xbuilder_path) end require 'serializable/xbuilder' end describe "XBuilder", 'when in Rails' do context 'and Rails is version 2' do it 'should inherit from ActionView::TemplateHandler' do set_rails(2) Serializable::XBuilder.ancestors.include?(ActionView::TemplateHandler).should be_true end it 'should include Compilable' do set_rails(2) Serializable::XBuilder.ancestors.include?(ActionView::TemplateHandlers::Compilable).should be_true end end context 'and Rails is version 3' do it 'should not inherit from ActionView::TemplateHandler' do set_rails(3) Serializable::XBuilder.ancestors.include?(ActionView::TemplateHandler).should be_false end it 'should not include Compilable' do set_rails(3) Serializable::XBuilder.ancestors.include?(ActionView::TemplateHandlers::Compilable).should be_false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
acts_as_serializable-0.3.0 | spec/xbuilder_spec.rb |