mvcli 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mvcli/version.rb +1 -1
- data/spec/mvcli/router_spec.rb +15 -13
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb15bdc23646980fbfdea73b3cd1f051467aff7e
|
4
|
+
data.tar.gz: 2e38b80f19750bf4d47c8f0cc31ba4a1c138aadb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dccdfd0d6bef05bdab748537d0f2679441b8d3039865329fae20509c4546fdbf72c47cf8577b6d7aaff959aa902b29db1acef5778add753d112395fb9bbf58b7
|
7
|
+
data.tar.gz: 923fc371652f94527547153d65a6b9ddb85042641b70c656b8aa940b6283b1a8dc8545149450d81b33866699dc78339598e23c42f9a5237c64ae7ce1960ed73f
|
data/lib/mvcli/version.rb
CHANGED
data/spec/mvcli/router_spec.rb
CHANGED
@@ -2,6 +2,8 @@ require "spec_helper"
|
|
2
2
|
require "mvcli/router"
|
3
3
|
|
4
4
|
describe "MVCLI::Router" do
|
5
|
+
use_natural_assertions
|
6
|
+
|
5
7
|
Given(:Router) {MVCLI::Router}
|
6
8
|
Given(:actions) {mock(:Actions)}
|
7
9
|
Given(:router) {self.Router.new actions}
|
@@ -20,36 +22,36 @@ describe "MVCLI::Router" do
|
|
20
22
|
context "with a route matched to an action" do
|
21
23
|
Given {router.match 'login' => 'logins#create'}
|
22
24
|
When {invoke 'login'}
|
23
|
-
Then {@action
|
24
|
-
And {@command.
|
25
|
-
Then {@command.argv
|
25
|
+
Then { @action == 'logins#create' }
|
26
|
+
And { not @command.nil? }
|
27
|
+
Then { @command.argv == ['login'] }
|
26
28
|
end
|
27
29
|
|
28
30
|
context "when there are command line options, it does not interfere" do
|
29
|
-
Given {router.match 'login' => 'logins#create'}
|
30
|
-
When {invoke 'login --then --go-away -f 6 -p'}
|
31
|
-
Then {@command.
|
31
|
+
Given { router.match 'login' => 'logins#create' }
|
32
|
+
When { invoke 'login --then --go-away -f 6 -p' }
|
33
|
+
Then { not @command.nil? }
|
32
34
|
end
|
33
35
|
|
34
36
|
context "with a route matched to a block" do
|
35
|
-
Given {router.match bam: ->(command) {@command = command}}
|
36
|
-
When {invoke 'bam'}
|
37
|
-
Then {@command.argv
|
37
|
+
Given { router.match bam: ->(command) {@command = command} }
|
38
|
+
When { invoke 'bam' }
|
39
|
+
Then { @command.argv == ['bam'] }
|
38
40
|
end
|
39
41
|
|
40
42
|
context "with a route with captures" do
|
41
43
|
Given {router.match 'show loadbalancer :id' => 'loadbalancers#show'}
|
42
44
|
When {invoke 'show loadbalancer 6'}
|
43
|
-
Then {@action
|
44
|
-
And {@command.argv == ['show' 'loadbalancer' '6']}
|
45
|
-
And {@bindings[:id]
|
45
|
+
Then {@action == 'loadbalancers#show'}
|
46
|
+
And {@command.argv == ['show', 'loadbalancer', '6']}
|
47
|
+
And {@bindings[:id] == '6'}
|
46
48
|
end
|
47
49
|
|
48
50
|
context "with macros" do
|
49
51
|
Given { router.macro /(-h|--help) (.*)/ => "help \\2" }
|
50
52
|
Given { router.match "help me" => "help#me"}
|
51
53
|
When { invoke "--help me" }
|
52
|
-
Then { @action
|
54
|
+
Then { @action == 'help#me' }
|
53
55
|
end
|
54
56
|
|
55
57
|
def invoke(route = '')
|