Completed
Push — master ( 8c5aaa...f46502 )
by Michael
01:05
created

TestCLI.bar()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 4
rs 10
1
require 'thor'
2
3
class TestCLI < Thor
4
  desc 'foo', 'Command'
5
  def foo
6
    puts '{}'
7
  end
8
9
  desc 'bar', 'Command'
10
  method_options baz: :string
11
  def bar(corge)
12
    puts options[:baz]
13
    puts corge
14
  end
15
end
16
17
describe 'test app' do
18
  def app
19
    RackThor.new(TestCLI).router
20
  end
21
22
  it 'can run a simple command' do
23
    post '/foo'
24
    expect(last_response).to be_ok
25
    expect(last_response.body).to eq("{}\n")
26
  end
27
28
  it 'can run a command with options' do
29
    post '/bar', {args: ['grault'], options: {baz: 'quux'}}
30
    expect(last_response).to be_ok
31
    expect(last_response.body).to eq("quux\ngrault\n")
32
  end
33
end
34