Sha256: 502894127c35850d903a4a20c0b977be18971547113c29527a26d6da2532078d

Contents?: true

Size: 1.25 KB

Versions: 8

Compression:

Stored size: 1.25 KB

Contents

require 'assert'
require 'dassets/engine'

class Dassets::Engine

  class BaseTests < Assert::Context
    desc "the base Dassets::Engine"
    setup do
      @engine = Dassets::Engine.new
    end
    subject{ @engine }

    should have_reader :opts
    should have_imeths :ext, :compile

    should "default the opts if none given" do
      exp_opts = {}
      assert_equal exp_opts, subject.opts
    end

    should "raise NotImplementedError on `ext` and `compile`" do
      assert_raises NotImplementedError do
        subject.ext('foo')
      end

      assert_raises NotImplementedError do
        subject.compile('some content')
      end
    end

  end

  class NullEngineTests < Assert::Context
    desc "the NullEngine"
    setup do
      @engine = Dassets::NullEngine.new('some' => 'opts')
    end
    subject{ @engine }

    should "be a Engine" do
      assert_kind_of Dassets::Engine, subject
    end

    should "know its opts" do
      exp_opts = {'some' => 'opts'}
      assert_equal exp_opts, subject.opts
    end

    should "return the given extension on `ext`" do
      assert_equal 'foo', subject.ext('foo')
    end

    should "return the given input on `compile" do
      assert_equal 'some content', subject.compile('some content')
    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dassets-0.7.0 test/unit/engine_tests.rb
dassets-0.6.2 test/unit/engine_tests.rb
dassets-0.6.1 test/unit/engine_tests.rb
dassets-0.6.0 test/unit/engine_tests.rb
dassets-0.5.0 test/unit/engine_tests.rb
dassets-0.4.1 test/unit/engine_tests.rb
dassets-0.4.0 test/unit/engine_tests.rb
dassets-0.3.0 test/unit/engine_tests.rb