Sha256: b31b99db86e9b1eb912e25140e0212cd6a3cc96bd5e71e02c0451804a26ac0db

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

require "assert"
require "osheet/style_set"

module Osheet
  class StyleSetTest < Assert::Context
    desc "Osheet::StyleSet"
    before { @set = StyleSet.new }
    subject { @set }

    should "be an Array" do
      assert_kind_of ::Array, subject
    end

    should have_reader :for

    should "verify Template objs" do
      assert_raises ArgumentError do
        subject.send(:verify, {})
      end
      assert_nothing_raised do
        subject.send(:verify, Style.new('.awesome') {})
      end
    end

    should "be able to lookup styles by class" do
      subject << (a = Style.new('.awesome') {})
      subject << (at = Style.new('.awesome.thing') {})
      subject << (b = Style.new('.boring') {})
      subject << (bt = Style.new('.boring.thing') {})
      subject << (a_b = Style.new('.awesome', '.boring') {})
      subject << (t = Style.new('.thing') {})
      subject << (s = Style.new('.stupid') {})

      { 'awesome' => [a, a_b],
        'boring' => [b, a_b],
        'thing' => [t],
        'awesome thing' => [a, at, a_b, t],
        'thing awesome' => [a, at, a_b, t],
        'other' => []
      }.each do |style_class, styles_set|
        assert_equal styles_set, subject.for(style_class)
      end
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

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