Sha256: a86ff3ab3ec5c91408265970cfa50881ff6175653040238566862ee5241147d0

Contents?: true

Size: 1.25 KB

Versions: 10

Compression:

Stored size: 1.25 KB

Contents

require "helper"
require "spring/commands"

class CommandsTest < ActiveSupport::TestCase
  test 'console command sets rails environment from command-line option' do
    command = Spring::Commands::RailsConsole.new
    assert_equal 'test', command.env(['test'])
  end

  test 'console command ignores first argument if it is a flag' do
    command = Spring::Commands::RailsConsole.new
    assert_nil command.env(['--sandbox'])
  end

  test 'Runner#env sets rails environment from command-line option' do
    command = Spring::Commands::RailsRunner.new
    assert_equal 'test', command.env(['-e', 'test', 'puts 1+1'])
  end

  test 'RailsRunner#env sets rails environment from long form of command-line option' do
    command = Spring::Commands::RailsRunner.new
    assert_equal 'test', command.env(['--environment=test', 'puts 1+1'])
  end

  test 'RailsRunner#env ignores insignificant arguments' do
    command = Spring::Commands::RailsRunner.new
    assert_nil command.env(['puts 1+1'])
  end

  test "rake command has configurable environments" do
    command = Spring::Commands::Rake.new
    assert_nil command.env(["foo"])
    assert_equal "test", command.env(["test"])
    assert_equal "test", command.env(["test:models"])
    assert_nil command.env(["test_foo"])
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spring-1.1.2 test/unit/commands_test.rb
spring-1.1.1 test/unit/commands_test.rb
spring-1.1.0 test/unit/commands_test.rb
spring-1.1.0.beta4 test/unit/commands_test.rb
spring-1.1.0.beta3 test/unit/commands_test.rb
spring-1.1.0.beta2 test/unit/commands_test.rb
spring-1.1.0.beta1 test/unit/commands_test.rb
spring-1.0.0 test/unit/commands_test.rb
spring-0.9.2 test/unit/commands_test.rb
spring-0.9.1 test/unit/commands_test.rb