aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorRobin Dupret <robin.dupret@gmail.com>2017-06-09 00:15:41 +0200
committerRobin Dupret <robin.dupret@gmail.com>2017-07-16 15:10:34 +0200
commit48b249927375465a7102acc71c2dfb8d49af8309 (patch)
tree9f4d2ec7e7dfe01eb67715945e4ccc4c0508375f /railties/test
parent1acd9a6464668d4d54ab30d016829f60b70dbbeb (diff)
downloadrails-48b249927375465a7102acc71c2dfb8d49af8309.tar.gz
rails-48b249927375465a7102acc71c2dfb8d49af8309.tar.bz2
rails-48b249927375465a7102acc71c2dfb8d49af8309.zip
Deprecate environment as an argument for dbconsole and console
People should rather rely on the `-e` or `--environment` options to specify in which environment they want to work. This will allow us to specify the connection to pick as a regular argument in the future.
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/commands/console_test.rb24
-rw-r--r--railties/test/commands/dbconsole_test.rb12
2 files changed, 24 insertions, 12 deletions
diff --git a/railties/test/commands/console_test.rb b/railties/test/commands/console_test.rb
index 4fc082e4ca..08c560146c 100644
--- a/railties/test/commands/console_test.rb
+++ b/railties/test/commands/console_test.rb
@@ -47,7 +47,7 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
end
def test_console_with_environment
- start ["-e production"]
+ start ["-e", "production"]
assert_match(/\sproduction\s/, output)
end
@@ -88,18 +88,24 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
end
def test_rails_env_is_production_when_first_argument_is_p
- start ["p"]
- assert_match(/\sproduction\s/, output)
+ assert_deprecated do
+ start ["p"]
+ assert_match(/\sproduction\s/, output)
+ end
end
def test_rails_env_is_test_when_first_argument_is_t
- start ["t"]
- assert_match(/\stest\s/, output)
+ assert_deprecated do
+ start ["t"]
+ assert_match(/\stest\s/, output)
+ end
end
def test_rails_env_is_development_when_argument_is_d
- start ["d"]
- assert_match(/\sdevelopment\s/, output)
+ assert_deprecated do
+ start ["d"]
+ assert_match(/\sdevelopment\s/, output)
+ end
end
def test_rails_env_is_dev_when_argument_is_dev_and_dev_env_is_present
@@ -111,7 +117,9 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
end
end
- assert_match("dev", parse_arguments(["dev"])[:environment])
+ assert_deprecated do
+ assert_match("dev", parse_arguments(["dev"])[:environment])
+ end
ensure
Rails::Command::ConsoleCommand.class_eval do
undef_method :available_environments
diff --git a/railties/test/commands/dbconsole_test.rb b/railties/test/commands/dbconsole_test.rb
index 94bfe3a652..e6a67c2c49 100644
--- a/railties/test/commands/dbconsole_test.rb
+++ b/railties/test/commands/dbconsole_test.rb
@@ -98,14 +98,18 @@ class Rails::DBConsoleTest < ActiveSupport::TestCase
end
def test_rails_env_is_development_when_argument_is_dev
- stub_available_environments([ "development", "test" ]) do
- assert_match("development", parse_arguments([ "dev" ])[:environment])
+ assert_deprecated do
+ stub_available_environments([ "development", "test" ]) do
+ assert_match("development", parse_arguments([ "dev" ])[:environment])
+ end
end
end
def test_rails_env_is_dev_when_argument_is_dev_and_dev_env_is_present
- stub_available_environments([ "dev" ]) do
- assert_match("dev", parse_arguments([ "dev" ])[:environment])
+ assert_deprecated do
+ stub_available_environments([ "dev" ]) do
+ assert_match("dev", parse_arguments([ "dev" ])[:environment])
+ end
end
end