summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAgis Anastasopoulos <agis.anast@gmail.com>2015-10-11 12:18:12 +0200
committerAgis Anastasopoulos <agis.anast@gmail.com>2015-10-11 12:18:24 +0300
commita5bb7cfe749bfba8aae34539a9c2c0b1fd4dae36 (patch)
tree294f55095379f3578603af4b126bf94457fc012f
parent21b1e3b6ff0f4fc9ff7ffeaded1fefdd42bcf8eb (diff)
downloadbundler-more-env-specs.tar.gz
Add more `Env` testsmore-env-specs
-rw-r--r--spec/bundler/env_spec.rb49
1 files changed, 46 insertions, 3 deletions
diff --git a/spec/bundler/env_spec.rb b/spec/bundler/env_spec.rb
index 04c6612811..99d89fd4d6 100644
--- a/spec/bundler/env_spec.rb
+++ b/spec/bundler/env_spec.rb
@@ -5,6 +5,47 @@ describe Bundler::Env do
let(:env) { described_class.new }
describe "#report" do
+ it "prints the environment" do
+ out = env.report
+
+ expect(out).to include("Environment")
+ expect(out).to include(Bundler::VERSION)
+ expect(out).to include(Gem::VERSION)
+ expect(out).to include(env.send(:ruby_version))
+ expect(out).to include(env.send(:git_version))
+ end
+
+ context "when there is a Gemfile and a lockfile and print_gemfile is true" do
+ before do
+ gemfile "gem 'rack', '1.0.0'"
+
+ lockfile <<-L
+ GEM
+ remote: file:#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
+ DEPENDENCIES
+ rack
+
+ BUNDLED WITH
+ 1.10.0
+ L
+ end
+
+ let(:output) { env.report(:print_gemfile => true) }
+
+ it "prints the Gemfile" do
+ expect(output).to include("Gemfile")
+ expect(output).to include("'rack', '1.0.0'")
+ end
+
+ it "prints the lockfile" do
+ expect(output).to include("Gemfile.lock")
+ expect(output).to include("rack (1.0.0)")
+ end
+ end
+
context "when Gemfile contains a gemspec and print_gemspecs is true" do
let(:gemspec) do
<<-GEMSPEC.gsub(/^\s+/, "")
@@ -23,9 +64,11 @@ describe Bundler::Env do
end
end
- it "prints the contents of that gemspec" do
- output = env.report(:print_gemspecs => true)
- expect(output.gsub(/^\s+/, "")).to include(gemspec)
+ it "prints the gemspec" do
+ output = env.report(:print_gemspecs => true).gsub(/^\s+/, "")
+
+ expect(output).to include("foo.gemspec:")
+ expect(output).to include(gemspec)
end
end
end