aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/commands
diff options
context:
space:
mode:
authorMykola Kyryk <mykola.kyryk@onapp.com>2012-12-27 17:04:54 +0200
committerMykola Kyryk <mykola.kyryk@onapp.com>2013-01-04 17:05:49 +0200
commit4fa6088b428e8a8a567cde1f660a209113f04dc3 (patch)
tree705229b16967c5c415037b15713fc3e4b255be9e /railties/test/commands
parentc9402c0258e85f125ce7cdc292381eb8b9dcbbe0 (diff)
downloadrails-4fa6088b428e8a8a567cde1f660a209113f04dc3.tar.gz
rails-4fa6088b428e8a8a567cde1f660a209113f04dc3.tar.bz2
rails-4fa6088b428e8a8a567cde1f660a209113f04dc3.zip
This commit fixes issue #8628
Allow environment name to start with a substring of the default environment names. For example: tes, pro, prod, dev, devel, etc. Fixing identation. Adding test for Rails::Console.parse_arguments method. Fix issue 8628 for Rails::DBConsole.
Diffstat (limited to 'railties/test/commands')
-rw-r--r--railties/test/commands/console_test.rb6
-rw-r--r--railties/test/commands/dbconsole_test.rb12
2 files changed, 18 insertions, 0 deletions
diff --git a/railties/test/commands/console_test.rb b/railties/test/commands/console_test.rb
index 9e449856f4..6be4a5fe89 100644
--- a/railties/test/commands/console_test.rb
+++ b/railties/test/commands/console_test.rb
@@ -111,6 +111,12 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
assert_match(/\sdevelopment\s/, output)
end
+ def test_rails_env_is_dev_when_argument_is_dev_and_dev_env_is_present
+ Rails::Console.stubs(:available_environments).returns(['dev'])
+ options = Rails::Console.parse_arguments(['dev'])
+ assert_match('dev', options[:environment])
+ end
+
private
attr_reader :output
diff --git a/railties/test/commands/dbconsole_test.rb b/railties/test/commands/dbconsole_test.rb
index 6316584825..38fe8ca544 100644
--- a/railties/test/commands/dbconsole_test.rb
+++ b/railties/test/commands/dbconsole_test.rb
@@ -45,6 +45,18 @@ class Rails::DBConsoleTest < ActiveSupport::TestCase
ENV['RAILS_ENV'] = "test"
end
+ def test_rails_env_is_development_when_argument_is_dev
+ Rails::DBConsole.stubs(:available_environments).returns(['development', 'test'])
+ options = Rails::DBConsole.new.send(:parse_arguments, ['dev'])
+ assert_match('development', options[:environment])
+ end
+
+ def test_rails_env_is_dev_when_argument_is_dev_and_dev_env_is_present
+ Rails::DBConsole.stubs(:available_environments).returns(['dev'])
+ options = Rails::DBConsole.new.send(:parse_arguments, ['dev'])
+ assert_match('dev', options[:environment])
+ end
+
def test_mysql
dbconsole.expects(:find_cmd_and_exec).with(%w[mysql mysql5], 'db')
start(adapter: 'mysql', database: 'db')