Sha256: 5bdae896007673db1a5b1ead98d6716e94c80a2432c44b591752f89bd567d616

Contents?: true

Size: 1.43 KB

Versions: 8

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'
module Alf
  describe "Renderer#initialize" do
    
    subject{ Renderer.new(*args) }
    
    describe "with full args" do
      let(:args){[
        [], Environment.examples, {:opts => true}
      ]}
      specify {
        subject.input.should eq([])
        subject.environment.should be_a(Environment)
        subject.options.should eq(:opts => true)
      }
    end
    
    describe "with only options" do
      let(:args){[
        {:opts => true}
      ]}
      specify {
        subject.input.should be_nil
        subject.environment.should be_nil
        subject.options.should eq(:opts => true)
      }
    end

    describe "on a subclass" do
      class FooRenderer < Renderer
        DEFAULT_OPTIONS = {:from => :subclass}
      end
      subject{ FooRenderer.new(*args) }
        
      describe "without option overriding" do
        let(:args){[
          {:opts => true}
        ]}
        specify {
          subject.input.should be_nil
          subject.environment.should be_nil
          subject.options.should eq(:opts => true, :from => :subclass)
        }
      end
      
      describe "with option overriding" do
        let(:args){[
          {:opts => true, :from => :overrided}
        ]}
        specify {
          subject.input.should be_nil
          subject.environment.should be_nil
          subject.options.should eq(:opts => true, :from => :overrided)
        }
      end
      
    end
    
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
alf-0.12.2 spec/unit/alf-core/renderer/test_initialize.rb
alf-0.12.1 spec/unit/alf-core/renderer/test_initialize.rb
alf-0.12.0 spec/unit/alf-core/renderer/test_initialize.rb
alf-0.11.1 spec/unit/alf-core/renderer/test_initialize.rb
alf-0.11.0 spec/unit/alf-core/renderer/test_initialize.rb
alf-0.10.1 spec/unit/renderer/test_initialize.rb
alf-0.10.0 spec/unit/renderer/test_initialize.rb
alf-0.9.3 spec/unit/renderer/test_initialize.rb