Sha256: a765d39d7f0891d0a2faa0920c99af3eafb35c0276519fe6fbead555af3debe4

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'
module Alf
  class Renderer
    describe Text do

      context 'the class' do
        subject{ Text }

        it_should_behave_like "a Renderer class"
      end

      describe "execute on a Relation" do
        subject{ Text.new(input).execute("") }

        let(:input){ Relation(id: [1, 2]) }
        let(:expected){ "+-----+\n"\
                        "| :id |\n"\
                        "+-----+\n"\
                        "|   1 |\n"\
                        "|   2 |\n"\
                        "+-----+\n"
        }

        it 'outputs as expected' do
          subject.should eq(expected)
        end
      end

      describe "execute on a Hash" do
        subject{ Text.new(input).execute("") }

        let(:input){ {id: 1} }
        let(:expected){ "+-----+\n"\
                        "| :id |\n"\
                        "+-----+\n"\
                        "|   1 |\n"\
                        "+-----+\n"
        }

        it 'outputs as expected' do
          subject.should eq(expected)
        end
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-io/renderer/test_text.rb
alf-core-0.14.0 spec/unit/alf-io/renderer/test_text.rb
alf-core-0.13.1 spec/unit/alf-io/renderer/test_text.rb
alf-core-0.13.0 spec/unit/alf-io/renderer/test_text.rb