Sha256: e481a8f646dac6271617df759dfc6d32a6c4f1f8eb82600c11ba2ed060a5732f

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'
module Alf
  describe Renderer do
    
    subject{ Renderer }
    it { should respond_to(:rash) }
    it { should respond_to(:text) }

    describe 'renderer' do
      subject{ Renderer.renderer(:rash) } 
      it{ should be_a(Renderer) }
    end
      
    describe 'rash' do
      subject{ Renderer.rash(input) } 
      let(:input){ [{:a => 1}] }
      let(:output){ "" }
      let(:expected){ "{:a => 1}\n" }
      specify{ 
        subject.should be_a(Renderer)
        subject.execute(output).should == expected
      }
    end

    describe 'rash --pretty' do
      subject{ Renderer.rash(input, {:pretty => true}) } 
      let(:input){ [{:a => 1}] }
      let(:output){ "" }
      let(:expected){ "{\n  :a => 1\n}\n" }
      specify{ 
        subject.should be_a(Renderer)
        subject.execute(output).should == expected
      }
    end
    
    describe 'text' do
      subject{ Renderer.text(input) } 
      let(:input){ [{:a => 1}] }
      let(:output){ "" }
      let(:expected){ "+----+\n"\
                      "| :a |\n"\
                      "+----+\n"\
                      "|  1 |\n"\
                      "+----+\n"
      }
      specify{ 
        subject.should be_a(Renderer)
        subject.execute(output).should == expected
      }
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
alf-0.12.2 spec/unit/alf-core/test_renderer.rb
alf-0.12.1 spec/unit/alf-core/test_renderer.rb
alf-0.12.0 spec/unit/alf-core/test_renderer.rb
alf-0.11.1 spec/unit/alf-core/test_renderer.rb
alf-0.11.0 spec/unit/alf-core/test_renderer.rb
alf-0.10.1 spec/unit/test_renderer.rb