Sha256: 603a547e3b1a0fd31cfb9d40d338177df6af689fa05261abda1062af0a80b347

Contents?: true

Size: 1.38 KB

Versions: 23

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

module Maid
  module Rake
    describe Task do

      before(:all) { ::Rake::TaskManager.record_task_metadata = true }

      subject(:define_task) { described_class.new *args, &instructions }
      let(:instructions)    { Proc.new {} }

      describe '#initialize' do
        before { ::Rake::Task.clear }

        describe 'task body' do
          let(:args) { :foobar }

          it 'sends given instructions to SingleRule' do
            expect(SingleRule)
              .to receive(:perform)
              .with('foobar', instructions)
            define_task && ::Rake::Task[:foobar].execute
          end
        end

        describe 'task description' do
          context 'given just the task name as argument' do
            let(:args) { [:foobar] }

            it 'defines a rake task with default description' do
              desc = described_class.const_get 'DEFAULT_DESCRIPTION'

              define_task
              expect(::Rake::Task[:foobar].comment).to eq(desc)
            end
          end

          context 'given a description argument' do
            let(:args) { [:foobar, description: 'Custom description'] }

            it 'defines a rake task with the description provided' do
              define_task
              expect(::Rake::Task[:foobar].comment).to eq('Custom description')
            end
          end
        end
      end

    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
maid-0.10.0.pre.alpha.1 spec/lib/maid/rake/task_spec.rb
maid-0.9.0.alpha.2 spec/lib/maid/rake/task_spec.rb
maid-0.9.0.alpha.1 spec/lib/maid/rake/task_spec.rb
maid-0.8.0.alpha.4 spec/lib/maid/rake/task_spec.rb
maid-0.8.0.alpha.3 spec/lib/maid/rake/task_spec.rb
maid-0.8.0.alpha.2 spec/lib/maid/rake/task_spec.rb
maid-0.8.0.alpha.1 spec/lib/maid/rake/task_spec.rb
maid-0.7.0 spec/lib/maid/rake/task_spec.rb
maid-0.7.0.beta.1 spec/lib/maid/rake/task_spec.rb
maid-0.7.0.alpha.4 spec/lib/maid/rake/task_spec.rb
maid-0.7.0.alpha.2 spec/lib/maid/rake/task_spec.rb
maid-0.7.0.alpha.1 spec/lib/maid/rake/task_spec.rb
maid-0.6.1 spec/lib/maid/rake/task_spec.rb
maid-0.6.1.alpha.1 spec/lib/maid/rake/task_spec.rb
maid-0.6.0 spec/lib/maid/rake/task_spec.rb
maid-0.6.0.beta.2 spec/lib/maid/rake/task_spec.rb
maid-0.6.0.beta.1 spec/lib/maid/rake/task_spec.rb
maid-0.6.0.alpha.6 spec/lib/maid/rake/task_spec.rb
maid-0.6.0.alpha.5 spec/lib/maid/rake/task_spec.rb
maid-0.6.0.alpha.4 spec/lib/maid/rake/task_spec.rb