Sha256: 9fed97724d0eeb3adc9763746275f13429f451f60c13febcc29472be53aac455

Contents?: true

Size: 805 Bytes

Versions: 25

Compression:

Stored size: 805 Bytes

Contents

require "spec_helper"
require "rake"
require "capistrano/immutable_task"

module Capistrano
  describe ImmutableTask do
    after do
      # Ensure that any tasks we create in these tests don't pollute other tests
      Rake::Task.clear
    end

    it "prints warning and raises when task is enhanced" do
      extend(Rake::DSL)

      load_defaults = Rake::Task.define_task("load:defaults")
      load_defaults.extend(Capistrano::ImmutableTask)

      $stderr.expects(:puts).with do |message|
        message =~ /^ERROR: load:defaults has already been invoked/
      end

      expect do
        namespace :load do
          task :defaults do
            # Never reached since load_defaults is frozen and can't be enhanced
          end
        end
      end.to raise_error(/frozen/i)
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
capistrano-3.11.1 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.11.0 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.10.2 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.10.1 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.10.0 spec/lib/capistrano/immutable_task_spec.rb