Skip to content

Commit

Permalink
Tag test framework hint specs and use out helper
Browse files Browse the repository at this point in the history
  • Loading branch information
FTLam11 committed May 24, 2020
1 parent 1d2292a commit 1db61b5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions bundler/spec/commands/newgem_spec.rb
Expand Up @@ -611,7 +611,7 @@ def create_temporary_dir(dir)
it_behaves_like "test framework is present"
end

context "gem.test set to rspec and --test with no arguments" do
context "gem.test set to rspec and --test with no arguments", :hint_text do
before do
bundle "config set gem.test rspec"
bundle! "gem #{gem_name} --test"
Expand All @@ -627,39 +627,42 @@ def create_temporary_dir(dir)
hint = "Bundler is configured to generate test files for rspec, "\
"so -t is not needed if you want to continue using it. " \
"This setting can be changed anytime with `bundle config gem.test`."
expect(last_command.stdout).to match(hint)
expect(out).to match(hint)
end

it_behaves_like "test framework is present"
end

context "gem.test setting set to false and --test with no arguments" do
context "gem.test setting set to false and --test with no arguments", :hint_text do
before do
bundle "config set gem.test false"
bundle! "gem #{gem_name} --test"
end

it "asks to generate test files" do
expect(last_command.stdout).to match("Do you want to generate tests with your gem?")
expect(out).to match("Do you want to generate tests with your gem?")
end

it "hints that the choice will only be applied to the current gem" do
hint = "Your choice will only be applied to this gem."
expect(last_command.stdout).to match(hint)
expect(out).to match("Your choice will only be applied to this gem.")
end

it_behaves_like "test framework is absent"
end

context "gem.test setting not set and --test with no arguments" do
context "gem.test setting not set and --test with no arguments", :hint_text do
before do
bundle! "gem #{gem_name} --test"
end

it "asks to generate test files" do
expect(out).to match("Do you want to generate tests with your gem?")
end

it "hints that the choice will be applied to future bundle gem calls" do
hint = "Future `bundle gem` calls will use your choice. " \
"This setting can be changed anytime with `bundle config gem.test`."
expect(last_command.stdout).to match(hint)
expect(out).to match(hint)
end

it_behaves_like "test framework is absent"
Expand Down

0 comments on commit 1db61b5

Please sign in to comment.