Sha256: f79884ded85cc9fe326ccf52da98a5e9bbf92943c7348bae3970c8ecfdc6a421

Contents?: true

Size: 1.54 KB

Versions: 5

Compression:

Stored size: 1.54 KB

Contents

require File.dirname(__FILE__) + '/test_helper'

class RakeTest < Test::Unit::TestCase
  CURRENT_PATH = File.expand_path(File.dirname(__FILE__))

  def test_should_run_rake_task
    using 'astrovan.local', :password => ENV['PASSWORD'], :current_path => CURRENT_PATH, :rakefile => 'rake_test.rake' do
      rake 'succeed'
    end
  end

  def test_should_fail_when_rake_task_fails
    assert_raise(RuntimeError) do
      using 'astrovan.local', :password => ENV['PASSWORD'], :current_path => CURRENT_PATH, :rakefile => 'rake_test.rake' do
        rake 'fail'
      end
    end
  end

  def test_should_fail_when_rake_task_not_defined
    assert_raise(RuntimeError) do
      using 'astrovan.local', :password => ENV['PASSWORD'], :current_path => CURRENT_PATH, :rakefile => 'rake_test.rake' do
        rake 'undefined'
      end
    end
  end

  def test_should_define_methods_to_run_rake_task
    using 'astrovan.local', :password => ENV['PASSWORD'] do
      raise "succeed method should not be defined" if methods.include?('succeed')
      raise "fail method should not be defined" if methods.include?('fail')
      surrogates :succeed => 'success', :fail => 'failure'
      raise "succeed method should be defined" unless methods.include?('succeed')
      raise "fail method should be defined" unless methods.include?('fail')
    end
  end

  def test_should_fail_to_define_method_if_already_defined
    assert_raise(ArgumentError) do
      using 'astrovan.local', :password => ENV['PASSWORD'] do
        surrogate :freeze => 'rails:freeze:edge'
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sbfaulkner-astrovan-0.5.6 test/rake_test.rb
sbfaulkner-astrovan-0.5.7 test/rake_test.rb
sbfaulkner-astrovan-0.5.8 test/rake_test.rb
sbfaulkner-astrovan-0.5.9 test/rake_test.rb
sbfaulkner-astrovan-0.6.0 test/rake_test.rb