Sha256: 44cc1a75a8e54153ea7407eb0d522bfecb5b230da4236f932cf05fab460f6731

Contents?: true

Size: 807 Bytes

Versions: 12

Compression:

Stored size: 807 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 =~ /^WARNING: 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

12 entries across 12 versions & 1 rubygems

Version Path
capistrano-3.9.1 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.9.0 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.8.2 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.8.1 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.8.0 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.7.2 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.7.1 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.7.0 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.7.0.beta1 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.6.1 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.6.0 spec/lib/capistrano/immutable_task_spec.rb
capistrano-3.5.0 spec/lib/capistrano/immutable_task_spec.rb