diff options
author | Thiago Pinto <tapgyn@gmail.com> | 2015-10-27 03:34:07 -0200 |
---|---|---|
committer | Thiago Pinto <tapgyn@gmail.com> | 2015-10-31 01:16:38 -0200 |
commit | a9f9e1dd98cc2dd161d51d6902aac90b275fee05 (patch) | |
tree | 54d5ca9b8eb1f4c447ae692e7665d279a4942ccf /railties/test | |
parent | e76c38ef1047ad3ffb25c1c639c38432a9228796 (diff) | |
download | rails-a9f9e1dd98cc2dd161d51d6902aac90b275fee05.tar.gz rails-a9f9e1dd98cc2dd161d51d6902aac90b275fee05.tar.bz2 rails-a9f9e1dd98cc2dd161d51d6902aac90b275fee05.zip |
Route generator should be idempotent - closes #22082
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/actions_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index fabba555ef..b4fbea4af4 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -235,6 +235,21 @@ class ActionsTest < Rails::Generators::TestCase assert_file 'config/routes.rb', /#{Regexp.escape(route_command)}/ end + def test_route_should_be_idempotent + run_generator + route_path = File.expand_path('config/routes.rb', destination_root) + + # runs first time, not asserting + action :route, "root 'welcome#index'" + content_1 = File.read(route_path) + + # runs second time + action :route, "root 'welcome#index'" + content_2 = File.read(route_path) + + assert_equal content_1, content_2 + end + def test_route_should_add_data_with_an_new_line run_generator action :route, "root 'welcome#index'" |