Skip to content

Commit fab1323

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Remove unnecessary nesting
ruby/rubygems@eac831a1b7
1 parent e7f11ec commit fab1323

File tree

1 file changed

+116
-136
lines changed

1 file changed

+116
-136
lines changed

spec/bundler/commands/newgem_spec.rb

Lines changed: 116 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,185 +1504,165 @@ def create_temporary_dir(dir)
15041504

15051505
include_examples "generating a gem"
15061506

1507-
context "testing --mit and --coc options against bundle config settings" do
1508-
let(:gem_name) { "test-gem" }
1509-
1510-
let(:require_path) { "test/gem" }
1511-
1512-
context "with mit option in bundle config settings set to true" do
1513-
before do
1514-
global_config "BUNDLE_GEM__MIT" => "true"
1515-
end
1516-
it_behaves_like "--mit flag"
1517-
it_behaves_like "--no-mit flag"
1507+
context "with mit option in bundle config settings set to true" do
1508+
before do
1509+
global_config "BUNDLE_GEM__MIT" => "true"
15181510
end
1511+
it_behaves_like "--mit flag"
1512+
it_behaves_like "--no-mit flag"
1513+
end
15191514

1520-
context "with mit option in bundle config settings set to false" do
1521-
before do
1522-
global_config "BUNDLE_GEM__MIT" => "false"
1523-
end
1524-
it_behaves_like "--mit flag"
1525-
it_behaves_like "--no-mit flag"
1515+
context "with mit option in bundle config settings set to false" do
1516+
before do
1517+
global_config "BUNDLE_GEM__MIT" => "false"
15261518
end
1519+
it_behaves_like "--mit flag"
1520+
it_behaves_like "--no-mit flag"
1521+
end
15271522

1528-
context "with coc option in bundle config settings set to true" do
1529-
before do
1530-
global_config "BUNDLE_GEM__COC" => "true"
1531-
end
1532-
it_behaves_like "--coc flag"
1533-
it_behaves_like "--no-coc flag"
1523+
context "with coc option in bundle config settings set to true" do
1524+
before do
1525+
global_config "BUNDLE_GEM__COC" => "true"
15341526
end
1527+
it_behaves_like "--coc flag"
1528+
it_behaves_like "--no-coc flag"
1529+
end
15351530

1536-
context "with coc option in bundle config settings set to false" do
1537-
before do
1538-
global_config "BUNDLE_GEM__COC" => "false"
1539-
end
1540-
it_behaves_like "--coc flag"
1541-
it_behaves_like "--no-coc flag"
1531+
context "with coc option in bundle config settings set to false" do
1532+
before do
1533+
global_config "BUNDLE_GEM__COC" => "false"
15421534
end
1535+
it_behaves_like "--coc flag"
1536+
it_behaves_like "--no-coc flag"
1537+
end
15431538

1544-
context "with rubocop option in bundle config settings set to true" do
1545-
before do
1546-
global_config "BUNDLE_GEM__RUBOCOP" => "true"
1547-
end
1548-
it_behaves_like "--linter=rubocop flag"
1549-
it_behaves_like "--linter=standard flag"
1550-
it_behaves_like "--no-linter flag"
1551-
it_behaves_like "--rubocop flag"
1552-
it_behaves_like "--no-rubocop flag"
1539+
context "with rubocop option in bundle config settings set to true" do
1540+
before do
1541+
global_config "BUNDLE_GEM__RUBOCOP" => "true"
15531542
end
1543+
it_behaves_like "--linter=rubocop flag"
1544+
it_behaves_like "--linter=standard flag"
1545+
it_behaves_like "--no-linter flag"
1546+
it_behaves_like "--rubocop flag"
1547+
it_behaves_like "--no-rubocop flag"
1548+
end
15541549

1555-
context "with rubocop option in bundle config settings set to false" do
1556-
before do
1557-
global_config "BUNDLE_GEM__RUBOCOP" => "false"
1558-
end
1559-
it_behaves_like "--linter=rubocop flag"
1560-
it_behaves_like "--linter=standard flag"
1561-
it_behaves_like "--no-linter flag"
1562-
it_behaves_like "--rubocop flag"
1563-
it_behaves_like "--no-rubocop flag"
1550+
context "with rubocop option in bundle config settings set to false" do
1551+
before do
1552+
global_config "BUNDLE_GEM__RUBOCOP" => "false"
15641553
end
1554+
it_behaves_like "--linter=rubocop flag"
1555+
it_behaves_like "--linter=standard flag"
1556+
it_behaves_like "--no-linter flag"
1557+
it_behaves_like "--rubocop flag"
1558+
it_behaves_like "--no-rubocop flag"
1559+
end
15651560

1566-
context "with linter option in bundle config settings set to rubocop" do
1567-
before do
1568-
global_config "BUNDLE_GEM__LINTER" => "rubocop"
1569-
end
1570-
it_behaves_like "--linter=rubocop flag"
1571-
it_behaves_like "--linter=standard flag"
1572-
it_behaves_like "--no-linter flag"
1561+
context "with linter option in bundle config settings set to rubocop" do
1562+
before do
1563+
global_config "BUNDLE_GEM__LINTER" => "rubocop"
15731564
end
1565+
it_behaves_like "--linter=rubocop flag"
1566+
it_behaves_like "--linter=standard flag"
1567+
it_behaves_like "--no-linter flag"
1568+
end
15741569

1575-
context "with linter option in bundle config settings set to standard" do
1576-
before do
1577-
global_config "BUNDLE_GEM__LINTER" => "standard"
1578-
end
1579-
it_behaves_like "--linter=rubocop flag"
1580-
it_behaves_like "--linter=standard flag"
1581-
it_behaves_like "--no-linter flag"
1570+
context "with linter option in bundle config settings set to standard" do
1571+
before do
1572+
global_config "BUNDLE_GEM__LINTER" => "standard"
15821573
end
1574+
it_behaves_like "--linter=rubocop flag"
1575+
it_behaves_like "--linter=standard flag"
1576+
it_behaves_like "--no-linter flag"
1577+
end
15831578

1584-
context "with linter option in bundle config settings set to false" do
1585-
before do
1586-
global_config "BUNDLE_GEM__LINTER" => "false"
1587-
end
1588-
it_behaves_like "--linter=rubocop flag"
1589-
it_behaves_like "--linter=standard flag"
1590-
it_behaves_like "--no-linter flag"
1579+
context "with linter option in bundle config settings set to false" do
1580+
before do
1581+
global_config "BUNDLE_GEM__LINTER" => "false"
15911582
end
1583+
it_behaves_like "--linter=rubocop flag"
1584+
it_behaves_like "--linter=standard flag"
1585+
it_behaves_like "--no-linter flag"
1586+
end
15921587

1593-
context "with changelog option in bundle config settings set to true" do
1594-
before do
1595-
global_config "BUNDLE_GEM__CHANGELOG" => "true"
1596-
end
1597-
it_behaves_like "--changelog flag"
1598-
it_behaves_like "--no-changelog flag"
1588+
context "with changelog option in bundle config settings set to true" do
1589+
before do
1590+
global_config "BUNDLE_GEM__CHANGELOG" => "true"
15991591
end
1592+
it_behaves_like "--changelog flag"
1593+
it_behaves_like "--no-changelog flag"
1594+
end
16001595

1601-
context "with changelog option in bundle config settings set to false" do
1602-
before do
1603-
global_config "BUNDLE_GEM__CHANGELOG" => "false"
1604-
end
1605-
it_behaves_like "--changelog flag"
1606-
it_behaves_like "--no-changelog flag"
1596+
context "with changelog option in bundle config settings set to false" do
1597+
before do
1598+
global_config "BUNDLE_GEM__CHANGELOG" => "false"
16071599
end
1600+
it_behaves_like "--changelog flag"
1601+
it_behaves_like "--no-changelog flag"
16081602
end
16091603

1610-
context "testing --bundle option against git and bundle config settings" do
1611-
context "with bundle option in bundle config settings set to true" do
1612-
before do
1613-
global_config "BUNDLE_GEM__BUNDLE" => "true"
1614-
end
1615-
it_behaves_like "--bundle flag"
1616-
it_behaves_like "--no-bundle flag"
1604+
context "with bundle option in bundle config settings set to true" do
1605+
before do
1606+
global_config "BUNDLE_GEM__BUNDLE" => "true"
1607+
end
1608+
it_behaves_like "--bundle flag"
1609+
it_behaves_like "--no-bundle flag"
16171610

1618-
it "runs bundle install" do
1619-
bundle "gem #{gem_name}"
1620-
expect(out).to include("Running bundle install in the new gem directory.")
1621-
end
1611+
it "runs bundle install" do
1612+
bundle "gem #{gem_name}"
1613+
expect(out).to include("Running bundle install in the new gem directory.")
16221614
end
1615+
end
16231616

1624-
context "with bundle option in bundle config settings set to false" do
1625-
before do
1626-
global_config "BUNDLE_GEM__BUNDLE" => "false"
1627-
end
1628-
it_behaves_like "--bundle flag"
1629-
it_behaves_like "--no-bundle flag"
1617+
context "with bundle option in bundle config settings set to false" do
1618+
before do
1619+
global_config "BUNDLE_GEM__BUNDLE" => "false"
1620+
end
1621+
it_behaves_like "--bundle flag"
1622+
it_behaves_like "--no-bundle flag"
16301623

1631-
it "does not run bundle install" do
1632-
bundle "gem #{gem_name}"
1633-
expect(out).to_not include("Running bundle install in the new gem directory.")
1634-
end
1624+
it "does not run bundle install" do
1625+
bundle "gem #{gem_name}"
1626+
expect(out).to_not include("Running bundle install in the new gem directory.")
16351627
end
16361628
end
16371629

1638-
context "testing --github-username option against git and bundle config settings" do
1639-
context "without git config set" do
1630+
context "without git config set" do
1631+
before do
1632+
git("config --global --unset github.user")
1633+
end
1634+
context "with github-username option in bundle config settings set to some value" do
16401635
before do
1641-
git("config --global --unset github.user")
1642-
end
1643-
context "with github-username option in bundle config settings set to some value" do
1644-
before do
1645-
global_config "BUNDLE_GEM__GITHUB_USERNAME" => "different_username"
1646-
end
1647-
it_behaves_like "--github-username option", "gh_user"
1648-
end
1649-
1650-
context "with github-username option in bundle config settings set to false" do
1651-
before do
1652-
global_config "BUNDLE_GEM__GITHUB_USERNAME" => "false"
1653-
end
1654-
it_behaves_like "--github-username option", "gh_user"
1636+
global_config "BUNDLE_GEM__GITHUB_USERNAME" => "different_username"
16551637
end
1638+
it_behaves_like "--github-username option", "gh_user"
16561639
end
16571640

1658-
context "with git config set" do
1659-
context "with github-username option in bundle config settings set to some value" do
1660-
before do
1661-
global_config "BUNDLE_GEM__GITHUB_USERNAME" => "different_username"
1662-
end
1663-
it_behaves_like "--github-username option", "gh_user"
1664-
end
1641+
it_behaves_like "github_username configuration"
16651642

1666-
context "with github-username option in bundle config settings set to false" do
1667-
before do
1668-
global_config "BUNDLE_GEM__GITHUB_USERNAME" => "false"
1669-
end
1670-
it_behaves_like "--github-username option", "gh_user"
1643+
context "with github-username option in bundle config settings set to false" do
1644+
before do
1645+
global_config "BUNDLE_GEM__GITHUB_USERNAME" => "false"
16711646
end
1647+
it_behaves_like "--github-username option", "gh_user"
16721648
end
16731649
end
16741650

1675-
context "testing github_username bundle config against git config settings" do
1676-
context "without git config set" do
1651+
context "with git config set" do
1652+
context "with github-username option in bundle config settings set to some value" do
16771653
before do
1678-
git("config --global --unset github.user")
1654+
global_config "BUNDLE_GEM__GITHUB_USERNAME" => "different_username"
16791655
end
1680-
1681-
it_behaves_like "github_username configuration"
1656+
it_behaves_like "--github-username option", "gh_user"
16821657
end
16831658

1684-
context "with git config set" do
1685-
it_behaves_like "github_username configuration"
1659+
it_behaves_like "github_username configuration"
1660+
1661+
context "with github-username option in bundle config settings set to false" do
1662+
before do
1663+
global_config "BUNDLE_GEM__GITHUB_USERNAME" => "false"
1664+
end
1665+
it_behaves_like "--github-username option", "gh_user"
16861666
end
16871667
end
16881668

0 commit comments

Comments
 (0)