aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorBarry Allard <barry.allard@gmail.com>2018-08-28 20:20:29 -0700
committerBarry Allard <barry.allard@gmail.com>2018-08-30 16:22:32 -0700
commit20e3cacbaa1e86b76483fe1d94cfc42907a5727c (patch)
tree3d401a22349b289efa8803776c7ab355a41e40e2 /railties/test
parent28e5085070f95f32a6a909cce6d77fd460c73885 (diff)
downloadrails-20e3cacbaa1e86b76483fe1d94cfc42907a5727c.tar.gz
rails-20e3cacbaa1e86b76483fe1d94cfc42907a5727c.tar.bz2
rails-20e3cacbaa1e86b76483fe1d94cfc42907a5727c.zip
add github to template actions, light DSL refactor
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/generators/actions_test.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb
index a54a6dbc28..da52b6076a 100644
--- a/railties/test/generators/actions_test.rb
+++ b/railties/test/generators/actions_test.rb
@@ -144,6 +144,44 @@ class ActionsTest < Rails::Generators::TestCase
assert_file "Gemfile", /\ngroup :development, :test do\n gem 'rspec-rails'\nend\n\ngroup :test do\n gem 'fakeweb'\nend/
end
+ def test_github_should_create_an_indented_block
+ run_generator
+
+ action :github, "user/repo" do
+ gem "foo"
+ gem "bar"
+ gem "baz"
+ end
+
+ assert_file "Gemfile", /\ngithub 'user\/repo' do\n gem 'foo'\n gem 'bar'\n gem 'baz'\nend/
+ end
+
+ def test_github_should_create_an_indented_block_with_options
+ run_generator
+
+ action :github, "user/repo", a: "correct", other: true do
+ gem "foo"
+ gem "bar"
+ gem "baz"
+ end
+
+ assert_file "Gemfile", /\ngithub 'user\/repo', a: 'correct', other: true do\n gem 'foo'\n gem 'bar'\n gem 'baz'\nend/
+ end
+
+ def test_github_should_create_an_indented_block_within_a_group
+ run_generator
+
+ action :gem_group, :magic do
+ github "user/repo", a: "correct", other: true do
+ gem "foo"
+ gem "bar"
+ gem "baz"
+ end
+ end
+
+ assert_file "Gemfile", /\ngroup :magic do\n github 'user\/repo', a: 'correct', other: true do\n gem 'foo'\n gem 'bar'\n gem 'baz'\n end\nend\n/
+ end
+
def test_environment_should_include_data_in_environment_initializer_block
run_generator
autoload_paths = 'config.autoload_paths += %w["#{Rails.root}/app/extras"]'