File: command_spec.rb

package info (click to toggle)
ruby-mina 0.3.7-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 444 kB
  • sloc: ruby: 1,630; makefile: 31
file content (71 lines) | stat: -rw-r--r-- 1,786 bytes parent folder | download | duplicates (2)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
require 'spec_helper'
require 'command_helper'

describe "Invoking the 'mina' command in a project" do
  before :each do
    Dir.chdir root('test_env')
  end

  it "should think it's 'mina', not 'rake' (1)" do
    run_command 'pinkledills'
    expect(exitstatus).not_to eq(0)
    expect(stderr).to include 'mina aborted'
  end

  it "should think it's 'mina', not 'rake' (1)" do
    mina '-T'
    expect(stdout).to include 'mina help'
    expect(stdout).to include 'mina git:clone'
  end

  it 'with --version should print the version' do
    mina '--version'
    expect(stdout).to include Mina.version
  end

  it 'with -V should print the version' do
    mina '-V'
    expect(stdout).to include Mina.version
  end

  describe 'without arguments' do
    before :each do
      mina
    end

    it 'should print standard help tasks' do
      mina
      expect(stdout).to include 'mina help'
      expect(stdout).to include 'mina init'
      expect(stdout).to include 'mina tasks'
    end

    it 'should print project-specific tasks' do
      mina
      expect(stdout).to include 'mina deploy'
      expect(stdout).to include 'mina restart'
      expect(stdout).to include 'mina setup'
    end

    it "should be the same as running 'help'" do
      previous_out = stdout

      mina 'help'
      expect(stdout).to eq(previous_out)
    end
  end

  it "with 'mina -f' on a non-existing file should fail" do
    run_command '-f', 'foobar'
    expect(stderr).to include 'mina aborted'
    expect(stderr).to include 'No Rakefile found'
  end

  it "with 'mina tasks' should print tasks" do
    mina 'tasks'

    expect(stdout).to include('bundle:install')
    expect(stdout).to include('Install gem dependencies using Bundler')
    expect(stdout).to include('passenger:restart')
  end
end