aboutsummaryrefslogtreecommitdiffstats
path: root/spec/other/help_spec.rb
blob: 068aad2039502f3f0da60eff221617a9c1a1d023 (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
33
34
35
36
37
38
39
require "spec_helper"

describe "bundle help" do
  # Rubygems 1.4+ no longer load gem plugins so this test is no longer needed
  rubygems_under_14 = Gem::Requirement.new("< 1.4").satisfied_by?(Gem::Version.new(Gem::VERSION))
  it "complains if older versions of bundler are installed", :if => rubygems_under_14 do
    system_gems "bundler-0.8.1"

    bundle "help", :expect_err => true
    expect(err).to include("Please remove Bundler 0.8 versions.")
    expect(err).to include("This can be done by running `gem cleanup bundler`.")
  end

  it "uses groff when available" do
    fake_groff!

    bundle "help gemfile"
    expect(out).to eq(%|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/gemfile.5"]|)
  end

  it "prefixes bundle commands with bundle- when finding the groff files" do
    fake_groff!

    bundle "help install"
    expect(out).to eq(%|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/bundle-install"]|)
  end

  it "simply outputs the txt file when there is no groff on the path" do
    kill_path!

    bundle "help install", :expect_err => true
    expect(out).to match(/BUNDLE-INSTALL/)
  end

  it "still outputs the old help for commands that do not have man pages yet" do
    bundle "help check"
    expect(out).to include("Check searches the local machine")
  end
end