diff options
Diffstat (limited to 'spec/commands/init_spec.rb')
-rw-r--r-- | spec/commands/init_spec.rb | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/spec/commands/init_spec.rb b/spec/commands/init_spec.rb index 7960ce85bd..ed52187115 100644 --- a/spec/commands/init_spec.rb +++ b/spec/commands/init_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "bundle init" do it "generates a Gemfile" do bundle! :init expect(out).to include("Writing new Gemfile") - expect(bundled_app("Gemfile")).to be_file + expect(bundled_app_gemfile).to be_file end context "when a Gemfile already exists" do @@ -15,7 +15,7 @@ RSpec.describe "bundle init" do end it "does not change existing Gemfiles" do - expect { bundle :init }.not_to change { File.read(bundled_app("Gemfile")) } + expect { bundle :init }.not_to change { File.read(bundled_app_gemfile) } end it "notifies the user that an existing Gemfile already exists" do @@ -32,9 +32,7 @@ RSpec.describe "bundle init" do FileUtils.mkdir bundled_app(subdir) - Dir.chdir bundled_app(subdir) do - bundle! :init - end + bundle! :init, :dir => bundled_app(subdir) expect(out).to include("Writing new Gemfile") expect(bundled_app("#{subdir}/Gemfile")).to be_file @@ -50,9 +48,7 @@ RSpec.describe "bundle init" do mode = File.stat(bundled_app(subdir)).mode ^ 0o222 FileUtils.chmod mode, bundled_app(subdir) - Dir.chdir bundled_app(subdir) do - bundle :init - end + bundle :init, :dir => bundled_app(subdir) expect(err).to include("directory is not writable") expect(Dir[bundled_app("#{subdir}/*")]).to be_empty @@ -75,7 +71,7 @@ RSpec.describe "bundle init" do bundle :init, :gemspec => spec_file - gemfile = bundled_app("Gemfile").read + gemfile = bundled_app_gemfile.read expect(gemfile).to match(%r{source 'https://rubygems.org'}) expect(gemfile.scan(/gem "rack", "= 1.0.1"/).size).to eq(1) expect(gemfile.scan(/gem "rspec", "= 1.2"/).size).to eq(1) @@ -133,9 +129,7 @@ RSpec.describe "bundle init" do FileUtils.mkdir bundled_app(subdir) - Dir.chdir bundled_app(subdir) do - bundle! :init - end + bundle! :init, :dir => bundled_app(subdir) expect(out).to include("Writing new gems.rb") expect(bundled_app("#{subdir}/gems.rb")).to be_file |