summaryrefslogtreecommitdiff
path: root/spec/bundler/env_spec.rb
blob: 04c661281162951c81c3f14e1c16761ebcdf39c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require "spec_helper"
require "bundler/settings"

describe Bundler::Env do
  let(:env) { described_class.new }

  describe "#report" do
    context "when Gemfile contains a gemspec and print_gemspecs is true" do
      let(:gemspec) do
        <<-GEMSPEC.gsub(/^\s+/, "")
          Gem::Specification.new do |gem|
            gem.name = "foo"
            gem.author = "Fumofu"
          end
        GEMSPEC
      end

      before do
        gemfile("gemspec")

        File.open(bundled_app.join("foo.gemspec"), "wb") do |f|
          f.write(gemspec)
        end
      end

      it "prints the contents of that gemspec" do
        output = env.report(:print_gemspecs => true)
        expect(output.gsub(/^\s+/, "")).to include(gemspec)
      end
    end
  end
end