Sha256: a8c2448cff9df8fb14bc855571ce69c7f52548d339edced123f27b9c361e5d20

Contents?: true

Size: 1.38 KB

Versions: 11

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe Alephant::Renderer do
  let(:config) { 
    {
      renderer_id: 'foo',
      view_path: File.join(File.dirname(__FILE__), 'fixtures/components'),
    }
  }
  let(:data) { {content: 'test'} } 

  describe '.create' do
    context 'using valid params' do
      let(:expected) { Alephant::Renderer::Renderer }

      specify { 
        expect(subject.create(config, data)).to be_instance_of expected
      } 
    end
  end

  describe Alephant::Renderer::Renderer do
    subject { Alephant::Renderer::Renderer.new(config, data) }

    describe '#config' do
      specify { expect(subject.config).to eql config }
    end

    describe '#data' do
      specify { expect(subject.data).to eql data }
    end

    describe '#views' do
      it 'returns a Hash' do
        expect(subject.views).to be_a Hash
      end

      context 'using three Models' do
        it 'returns three Views in Hash' do
          expect(subject.views.length).to eql 3
        end
      end

      context 'using `bar`, `foo`, `json` models' do
        it 'contains a View for `bar` model' do
          expect(subject.views.key? 'bar').to be
        end

        it 'contains a View for `foo` model' do
          expect(subject.views.key? 'foo').to be 
        end

        it 'contains a View for `json` model' do
          expect(subject.views.key? 'json').to be
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
alephant-renderer-2.0.1 spec/renderer_spec.rb
alephant-renderer-2.0.0 spec/renderer_spec.rb
alephant-renderer-1.0.5 spec/renderer_spec.rb
alephant-renderer-1.0.4 spec/renderer_spec.rb
alephant-renderer-1.0.3 spec/renderer_spec.rb
alephant-renderer-1.0.2 spec/renderer_spec.rb
alephant-renderer-1.0.1 spec/renderer_spec.rb
alephant-renderer-1.0.0 spec/renderer_spec.rb
alephant-renderer-0.3.0 spec/renderer_spec.rb
alephant-renderer-0.2.0 spec/renderer_spec.rb
alephant-renderer-0.1.0 spec/renderer_spec.rb