summaryrefslogtreecommitdiff
path: root/spec/commands/newgem_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/commands/newgem_spec.rb')
-rw-r--r--spec/commands/newgem_spec.rb106
1 files changed, 100 insertions, 6 deletions
diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb
index 67a99c8748..aa185dc1c3 100644
--- a/spec/commands/newgem_spec.rb
+++ b/spec/commands/newgem_spec.rb
@@ -558,6 +558,94 @@ RSpec.describe "bundle gem" do
end
end
+ context "--ci with no arugment" do
+ it "does not generate any CI config" do
+ bundle "gem #{gem_name}"
+
+ expect(bundled_app("#{gem_name}/.github/workflows/main.yml")).to_not exist
+ expect(bundled_app("#{gem_name}/.travis.yml")).to_not exist
+ expect(bundled_app("#{gem_name}/.gitlab-ci.yml")).to_not exist
+ expect(bundled_app("#{gem_name}/.circleci/config.yml")).to_not exist
+ end
+ end
+
+ context "--ci set to github" do
+ it "generates a Github Actions config file" do
+ bundle "gem #{gem_name} --ci=github"
+
+ expect(bundled_app("#{gem_name}/.github/workflows/main.yml")).to exist
+ end
+ end
+
+ context "--ci set to gitlab" do
+ it "generates a Gitlab Ci config file" do
+ bundle "gem #{gem_name} --ci=gitlab"
+
+ expect(bundled_app("#{gem_name}/.gitlab-ci.yml")).to exist
+ end
+ end
+
+ context "--ci set to circle" do
+ it "generates a Circle Ci config file" do
+ bundle "gem #{gem_name} --ci=circle"
+
+ expect(bundled_app("#{gem_name}/.circleci/config.yml")).to exist
+ end
+ end
+
+ context "--ci set to travis" do
+ it "generates a Travis Ci config file" do
+ bundle "gem #{gem_name} --ci=travis"
+
+ expect(bundled_app("#{gem_name}/.travis.yml")).to exist
+ end
+ end
+
+ context "gem.ci setting set to none" do
+ it "doesnt generate any CI config" do
+ expect(bundled_app("#{gem_name}/.github/workflows/main.yml")).to_not exist
+ expect(bundled_app("#{gem_name}/.travis.yml")).to_not exist
+ expect(bundled_app("#{gem_name}/.gitlab-ci.yml")).to_not exist
+ expect(bundled_app("#{gem_name}/.circleci/config.yml")).to_not exist
+ end
+ end
+
+ context "gem.ci setting set to github" do
+ it "generates a Github Actions config file" do
+ bundle "config set gem.ci github"
+ bundle "gem #{gem_name}"
+
+ expect(bundled_app("#{gem_name}/.github/workflows/main.yml")).to exist
+ end
+ end
+
+ context "gem.ci setting set to travis" do
+ it "generates a Travis config file" do
+ bundle "config set gem.ci travis"
+ bundle "gem #{gem_name}"
+
+ expect(bundled_app("#{gem_name}/.travis.yml")).to exist
+ end
+ end
+
+ context "gem.ci setting set to gitlab" do
+ it "generates a Gitlab config file" do
+ bundle "config set gem.ci gitlab"
+ bundle "gem #{gem_name}"
+
+ expect(bundled_app("#{gem_name}/.gitlab-ci.yml")).to exist
+ end
+ end
+
+ context "gem.ci setting set to circleci" do
+ it "generates a CircleCI config file" do
+ bundle "config set gem.ci circle"
+ bundle "gem #{gem_name}"
+
+ expect(bundled_app("#{gem_name}/.circleci/config.yml")).to exist
+ end
+ end
+
context "gem.test setting set to test-unit" do
before do
bundle "config set gem.test test-unit"
@@ -591,10 +679,6 @@ RSpec.describe "bundle gem" do
expect(bundled_app("#{gem_name}/spec/spec_helper.rb")).to exist
expect(bundled_app("#{gem_name}/test/test_helper.rb")).to_not exist
end
-
- it "creates a .travis.yml file to test the library against the current Ruby version on Travis CI" do
- expect(bundled_app("#{gem_name}/.travis.yml").read).to match(/- #{RUBY_VERSION}/)
- end
end
context "--edit option" do
@@ -806,8 +890,18 @@ Usage: "bundle gem NAME [OPTIONS]"
expect(bundled_app("foobar/Gemfile").read).to include('gem "rspec"')
end
+ it "asks about CI service" do
+ global_config "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__COC" => "false", "BUNDLE_GEM__RUBOCOP" => "false"
+
+ bundle! "gem foobar" do |input, _, _|
+ input.puts "github"
+ end
+
+ expect(bundled_app("foobar/.github/workflows/main.yml")).to exist
+ end
+
it "asks about MIT license" do
- global_config "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false"
+ global_config "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false", "BUNDLE_GEM__CI" => "false", "BUNDLE_GEM__RUBOCOP" => "false"
bundle "config list"
@@ -819,7 +913,7 @@ Usage: "bundle gem NAME [OPTIONS]"
end
it "asks about CoC" do
- global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false"
+ global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__CI" => "false", "BUNDLE_GEM__RUBOCOP" => "false"
bundle! "gem foobar" do |input, _, _|
input.puts "yes"