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

TestCLI   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 13
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A foo() 0 3 1
A bar() 0 4 1
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