Sha256: da0410b515ef8912aacb658daaebd0b9c94f03103cf726d722cd98b68ab2c94d

Contents?: true

Size: 763 Bytes

Versions: 1

Compression:

Stored size: 763 Bytes

Contents

require 'spec_helper'

module RevealCK

  describe Builder, 'when subclassed' do

    it 'requires that subclasses implement #register_tasks' do
      class BadBuilder < Builder; end
      bad_builder = BadBuilder.new
      expect { bad_builder.register_tasks }.to raise_error
    end

    it 'invokes each registered task when it receives #build' do

      class TestBuilder < Builder

        attr_reader :value

        def initialize
          @value = 0
        end

        def register_tasks
          @tasks = []
          @value = 0
          add_task 'Set Value to 1' do
            @value = 1
          end
        end
      end

      test_builder = TestBuilder.new
      test_builder.build!
      expect(test_builder.value).to eq 1
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reveal-ck-0.1.6 spec/lib/reveal-ck/builder_spec.rb