Sha256: baa39d46b471c1395fa7004608660c3bf8346c0c7e85a336697d13cdd6c0e39d

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

require "assert"
require "osheet/template"

module Osheet

  class TemplateTest < Assert::Context
    desc "Osheet::Template"
    before do
      @tmpl = Template.new('column', :thing) {}
    end
    subject { @tmpl }

    should "define what elements it is valid for" do
      assert_equal ['worksheet', 'column', 'row', 'cell'], Template::ELEMENTS
    end

    should have_accessor :element

    should "be a Partial" do
      assert_kind_of Partial, subject
    end

    should "convert the element ars to string and store off" do
      assert_equal 'column', subject.element
    end

  end

  class TemplateElementTest < TemplateTest
    desc "a template"

    should "verify the element argument" do
      assert_raises ArgumentError do
        Template.new({}, :poo) {}
      end
      assert_raises ArgumentError do
        Template.new('workbook', :poo) {}
      end
      Template::ELEMENTS.each do |elem|
        assert_nothing_raised do
          Template.new(elem, :poo) {}
        end
      end
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
osheet-0.10.0 test/template_test.rb
osheet-0.9.2 test/template_test.rb
osheet-0.9.1 test/template_test.rb
osheet-0.9.0 test/template_test.rb
osheet-0.8.0 test/template_test.rb