Sha256: 176f8377cfbeb2f5a0baaa26504acd41fb08deb8b65d2d85573b654e941d2e9b

Contents?: true

Size: 833 Bytes

Versions: 5

Compression:

Stored size: 833 Bytes

Contents

require 'spec_helper'

describe Compositor::Leaf do
  let(:context) { Object.new }

  describe '#create' do
    it "defines #dsl_string method on the DSL class" do
      dsl = Compositor::DSL.create(context)
      dsl.should respond_to(:dsl_string)
    end

    it "allows calling defined methods via a block" do
      block_ran = false
      Compositor::DSL.create(context) do |dsl|
        dsl.dsl_string
        block_ran = true
      end
      block_ran.should be_true
    end

    it "returns last generator called via block" do
      dsl = Compositor::DSL.create(context) do |dsl|
        dsl.dsl_string
      end

      {a: "b"}.should == dsl.to_hash
    end

    it "returns an instance of subclass" do
      dsl = Compositor::DSL.create(context).dsl_string
      dsl.should be_kind_of(DslStringCompositor)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
compositor-2.0.0 spec/compositor/leaf_spec.rb
compositor-1.0.1 spec/compositor/leaf_spec.rb
compositor-1.0.0 spec/compositor/leaf_spec.rb
compositor-0.1.4 spec/compositor/leaf_spec.rb
compositor-0.1.3 spec/compositor/leaf_spec.rb