Sha256: 33f38a49072f1662d18916380f8ce7e5dc9ce8de996e0dd17665c8ed7e6ce493

Contents?: true

Size: 1.79 KB

Versions: 8

Compression:

Stored size: 1.79 KB

Contents

require 'spec_helper'

require 'ruby_app/elements'

describe RubyApp::Element do
  include_context 'request'

  describe 'positive' do

    before(:all) do

      class BaseElement < RubyApp::Element
        template_path(:all, File.dirname(__FILE__))
      end

      class DerivedElement < BaseElement
        template_path(:all, File.dirname(__FILE__))
      end

      class ContainerElement < RubyApp::Element

        template_path(:all, File.dirname(__FILE__))

        def initialize
          super

          @derived_element_1 = DerivedElement.new
          @derived_element_2 = DerivedElement.new

        end

      end

    end

    describe 'BaseElement' do

      describe 'render instance' do

        let(:base_element) { BaseElement.new }

        describe 'render html' do

          specify { base_element.render(:html).should include('BaseElement') }
          specify { base_element.render(:html).scan(/BaseElement/).length.should == 1 }

          it 'generates ouput' do
            puts '-' *80
            puts base_element.render(:html)
            puts '-' *80
          end

        end

      end

    end

    describe 'DerivedElement' do

      describe 'render instance' do

        let(:derived_element) { DerivedElement.new }

        describe 'render html' do

          it 'generates ouput' do
            puts '-' *80
            puts derived_element.render(:html)
            puts '-' *80
          end

        end

      end

    end

    describe 'ContainerElement' do

      describe 'render instance' do

        let(:container_element) { ContainerElement.new }

        describe 'render html' do

          it 'generates ouput' do
            puts '-' *80
            puts container_element.render(:html)
            puts '-' *80
          end

        end

      end

    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
RubyApp-0.2.7 spec/elements/element_spec.rb
RubyApp-0.2.6 spec/elements/element_spec.rb
RubyApp-0.2.5 spec/elements/element_spec.rb
RubyApp-0.2.4 spec/elements/element_spec.rb
RubyApp-0.2.3 spec/elements/element_spec.rb
RubyApp-0.2.2 spec/elements/element_spec.rb
RubyApp-0.2.1 spec/elements/element_spec.rb
RubyApp-0.2.0 spec/elements/element_spec.rb