github_cli 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/.travis.yml +14 -3
  2. data/CHANGELOG.md +15 -0
  3. data/Gemfile +1 -1
  4. data/Gemfile.lock +41 -44
  5. data/README.md +77 -14
  6. data/Rakefile +4 -2
  7. data/features/assignee.feature +1 -0
  8. data/features/blob.feature +1 -0
  9. data/features/collaborator.feature +1 -0
  10. data/features/commit.feature +2 -1
  11. data/features/config.feature +27 -28
  12. data/features/event.feature +1 -0
  13. data/features/init.feature +20 -23
  14. data/features/key.feature +5 -5
  15. data/features/milestone.feature +3 -2
  16. data/features/reference.feature +3 -2
  17. data/features/starring.feature +1 -0
  18. data/features/support/hooks.rb +1 -1
  19. data/features/tag.feature +2 -1
  20. data/features/tree.feature +17 -0
  21. data/features/watching.feature +1 -0
  22. data/fixtures/simple_config +3 -5
  23. data/github_cli.gemspec +1 -1
  24. data/lib/github_cli/api.rb +11 -6
  25. data/lib/github_cli/apis/event.rb +8 -8
  26. data/lib/github_cli/apis/label.rb +0 -12
  27. data/lib/github_cli/apis/starring.rb +5 -5
  28. data/lib/github_cli/apis/watching.rb +5 -5
  29. data/lib/github_cli/cli.rb +21 -30
  30. data/lib/github_cli/command.rb +1 -1
  31. data/lib/github_cli/commands/authorizations.rb +28 -2
  32. data/lib/github_cli/commands/collaborators.rb +12 -12
  33. data/lib/github_cli/commands/commits.rb +18 -2
  34. data/lib/github_cli/commands/events.rb +6 -8
  35. data/lib/github_cli/commands/followers.rb +1 -1
  36. data/lib/github_cli/commands/labels.rb +22 -20
  37. data/lib/github_cli/commands/milestones.rb +43 -13
  38. data/lib/github_cli/commands/references.rb +21 -6
  39. data/lib/github_cli/commands/starring.rb +3 -2
  40. data/lib/github_cli/commands/tags.rb +16 -1
  41. data/lib/github_cli/commands/trees.rb +11 -5
  42. data/lib/github_cli/commands/watching.rb +3 -2
  43. data/lib/github_cli/config.rb +15 -6
  44. data/lib/github_cli/dsl.rb +2 -2
  45. data/lib/github_cli/formatter.rb +2 -3
  46. data/lib/github_cli/formatters/csv.rb +29 -14
  47. data/lib/github_cli/formatters/table.rb +2 -3
  48. data/lib/github_cli/man/gcli-config.1 +17 -13
  49. data/lib/github_cli/man/gcli-config.1.txt +23 -21
  50. data/lib/github_cli/vendor/thor/actions/create_link.rb +3 -0
  51. data/lib/github_cli/vendor/thor/actions/directory.rb +29 -10
  52. data/lib/github_cli/vendor/thor/actions/file_manipulation.rb +9 -3
  53. data/lib/github_cli/vendor/thor/actions.rb +18 -18
  54. data/lib/github_cli/vendor/thor/base.rb +97 -89
  55. data/lib/github_cli/vendor/thor/{task.rb → command.rb} +16 -12
  56. data/lib/github_cli/vendor/thor/core_ext/hash_with_indifferent_access.rb +5 -0
  57. data/lib/github_cli/vendor/thor/core_ext/io_binary_read.rb +12 -0
  58. data/lib/github_cli/vendor/thor/error.rb +4 -7
  59. data/lib/github_cli/vendor/thor/group.rb +34 -32
  60. data/lib/github_cli/vendor/thor/invocation.rb +28 -26
  61. data/lib/github_cli/vendor/thor/parser/options.rb +66 -26
  62. data/lib/github_cli/vendor/thor/rake_compat.rb +3 -2
  63. data/lib/github_cli/vendor/thor/runner.rb +21 -20
  64. data/lib/github_cli/vendor/thor/shell/basic.rb +20 -16
  65. data/lib/github_cli/vendor/thor/shell/color.rb +13 -9
  66. data/lib/github_cli/vendor/thor/shell/html.rb +13 -9
  67. data/lib/github_cli/vendor/thor/util.rb +214 -210
  68. data/lib/github_cli/vendor/thor/version.rb +1 -1
  69. data/lib/github_cli/vendor/thor.rb +232 -153
  70. data/lib/github_cli/version.rb +1 -1
  71. data/man/gcli-config.1.ronn +14 -11
  72. data/spec/github_cli/commands/assignees_spec.rb +20 -0
  73. data/spec/github_cli/commands/blobs_spec.rb +21 -0
  74. data/spec/github_cli/commands/collaborators_spec.rb +31 -0
  75. data/spec/github_cli/commands/commits_spec.rb +26 -0
  76. data/spec/github_cli/commands/emails_spec.rb +24 -0
  77. data/spec/github_cli/commands/events_spec.rb +56 -0
  78. data/spec/github_cli/commands/followers_spec.rb +44 -0
  79. data/spec/github_cli/commands/keys_spec.rb +36 -0
  80. data/spec/github_cli/commands/labels_spec.rb +61 -0
  81. data/spec/github_cli/commands/milestones_spec.rb +47 -0
  82. data/spec/github_cli/commands/references_spec.rb +42 -0
  83. data/spec/github_cli/commands/starring_spec.rb +40 -0
  84. data/spec/github_cli/commands/tags_spec.rb +26 -0
  85. data/spec/github_cli/commands/trees_spec.rb +32 -0
  86. data/spec/github_cli/commands/watching_spec.rb +40 -0
  87. data/spec/github_cli/config_spec.rb +109 -116
  88. data/spec/github_cli/util/convert_value_spec.rb +19 -0
  89. data/spec/github_cli/util/convert_values_spec.rb +14 -0
  90. data/spec/github_cli/util_spec.rb +0 -29
  91. metadata +51 -19
  92. data/lib/github_cli/vendor/thor/core_ext/dir_escape.rb +0 -0
  93. data/lib/github_cli/vendor/thor/core_ext/file_binary_read.rb +0 -9
  94. data/lib/github_cli/vendor/thor/empty.txt +0 -0
@@ -0,0 +1,31 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Collaborators do
6
+ let(:format) { 'table' }
7
+ let(:owner) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:user) { 'github' }
10
+ let(:api_class) { GithubCLI::Collaborator }
11
+
12
+ it "invokes collab:list" do
13
+ api_class.should_receive(:all).with(owner, repo, {}, format)
14
+ subject.invoke "collab:list", [owner, repo]
15
+ end
16
+
17
+ it "invokes collab:add" do
18
+ api_class.should_receive(:add).with(owner, repo, user, {}, format)
19
+ subject.invoke "collab:add", [owner, repo, user]
20
+ end
21
+
22
+ it "invokes collab:collab" do
23
+ api_class.should_receive(:collaborator?).with(owner, repo, user, {}, format)
24
+ subject.invoke "collab:collab", [owner, repo, user]
25
+ end
26
+
27
+ it "invokes collab:collab" do
28
+ api_class.should_receive(:remove).with(owner, repo, user, {}, format)
29
+ subject.invoke "collab:remove", [owner, repo, user]
30
+ end
31
+ end
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Commits do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:sha) { '3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15' }
10
+ let(:api_class) { GithubCLI::Commit }
11
+
12
+ it "invokes commit:get" do
13
+ api_class.should_receive(:get).with(user, repo, sha, {}, format)
14
+ subject.invoke "commit:get", [user, repo, sha]
15
+ end
16
+
17
+ it "invokes commit:create" do
18
+ api_class.should_receive(:create).with(user, repo, {}, format)
19
+ subject.invoke "commit:create", [user, repo]
20
+ end
21
+
22
+ it "invokes commit:create --tree" do
23
+ api_class.should_receive(:create).with(user, repo, {"tree" => sha}, format)
24
+ subject.invoke "commit:create", [user, repo], :tree => sha
25
+ end
26
+ end
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Emails do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:api_class) { GithubCLI::Email }
9
+
10
+ it "invokes email:list" do
11
+ api_class.should_receive(:all).with({}, format)
12
+ subject.invoke "email:list", []
13
+ end
14
+
15
+ it "invokes email:add" do
16
+ api_class.should_receive(:add).with(['email1', 'email2'], {}, format)
17
+ subject.invoke "email:add", ['email1', 'email2']
18
+ end
19
+
20
+ it "invokes email:delete" do
21
+ api_class.should_receive(:delete).with(['email1', 'email2'], {}, format)
22
+ subject.invoke "email:delete", ['email1', 'email2']
23
+ end
24
+ end
@@ -0,0 +1,56 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Events do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:org) { 'github' }
10
+ let(:api_class) { GithubCLI::Event }
11
+
12
+ it "invokes event:public" do
13
+ api_class.should_receive(:public).with({}, format)
14
+ subject.invoke "event:public", []
15
+ end
16
+
17
+ it "invokes event:repo" do
18
+ api_class.should_receive(:repository).with(user, repo, {}, format)
19
+ subject.invoke "event:repo", [user, repo]
20
+ end
21
+
22
+ it "invokes event:issue" do
23
+ api_class.should_receive(:repository).with(user, repo, {}, format)
24
+ subject.invoke "event:repo", [user, repo]
25
+ end
26
+
27
+ it "invokes event:network" do
28
+ api_class.should_receive(:network).with(user, repo, {}, format)
29
+ subject.invoke "event:network", [user, repo]
30
+ end
31
+
32
+ it "invokes event:org" do
33
+ api_class.should_receive(:organization).with(org, {}, format)
34
+ subject.invoke "event:org", [org]
35
+ end
36
+
37
+ it "invokes event:received" do
38
+ api_class.should_receive(:received).with(user, {}, format)
39
+ subject.invoke "event:received", [user]
40
+ end
41
+
42
+ it "invokes event:received --public" do
43
+ api_class.should_receive(:received).with(user, {'public' => true}, format)
44
+ subject.invoke "event:received", [user], :public => true
45
+ end
46
+
47
+ it "invokes event:performed" do
48
+ api_class.should_receive(:performed).with(user, {}, format)
49
+ subject.invoke "event:performed", [user]
50
+ end
51
+
52
+ it "invokes event:user_org" do
53
+ api_class.should_receive(:user_org).with(user, org, {}, format)
54
+ subject.invoke "event:user_org", [user, org]
55
+ end
56
+ end
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Followers do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:api_class) { GithubCLI::Follower }
9
+
10
+ it "invokes follower:list with user" do
11
+ api_class.should_receive(:all).with(user, {}, format)
12
+ subject.invoke "follower:list", [], :user => user
13
+ end
14
+
15
+ it "invokes follower:list without user" do
16
+ api_class.should_receive(:all).with(nil, {}, format)
17
+ subject.invoke "follower:list", []
18
+ end
19
+
20
+ it "invokes follower:following with user" do
21
+ api_class.should_receive(:following).with(user, {}, format)
22
+ subject.invoke "follower:following", [], :user => user
23
+ end
24
+
25
+ it "invokes follower:following without user" do
26
+ api_class.should_receive(:following).with(nil, {}, format)
27
+ subject.invoke "follower:following", []
28
+ end
29
+
30
+ it "invokes follower:follower without user" do
31
+ api_class.should_receive(:follower).with(user, {}, format)
32
+ subject.invoke "follower:follower", [user]
33
+ end
34
+
35
+ it "invokes follower:follow with user" do
36
+ api_class.should_receive(:follow).with(user, {}, format)
37
+ subject.invoke "follower:follow", [user]
38
+ end
39
+
40
+ it "invokes follower:follow with user" do
41
+ api_class.should_receive(:unfollow).with(user, {}, format)
42
+ subject.invoke "follower:unfollow", [user]
43
+ end
44
+ end
@@ -0,0 +1,36 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Keys do
6
+ let(:format) { 'table' }
7
+ let(:id) { 1 }
8
+ let(:user) { 'peter-murach' }
9
+ let(:repo) { 'github' }
10
+ let(:api_class) { GithubCLI::Key }
11
+
12
+ it "invokes key:list" do
13
+ api_class.should_receive(:all).with(user, repo, {}, format)
14
+ subject.invoke "key:list", [user, repo]
15
+ end
16
+
17
+ it "invokes key:get" do
18
+ api_class.should_receive(:get).with(user, repo, id, {}, format)
19
+ subject.invoke "key:get", [user, repo, id]
20
+ end
21
+
22
+ it "invokes key:create" do
23
+ api_class.should_receive(:create).with(user, repo, {}, format)
24
+ subject.invoke "key:create", [user, repo]
25
+ end
26
+
27
+ it "invokes key:edit" do
28
+ api_class.should_receive(:edit).with(user, repo, id, {}, format)
29
+ subject.invoke "key:edit", [user, repo, id]
30
+ end
31
+
32
+ it "invokes key:delete" do
33
+ api_class.should_receive(:delete).with(user, repo, id, {}, format)
34
+ subject.invoke "key:delete", [user, repo, id]
35
+ end
36
+ end
@@ -0,0 +1,61 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Labels do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:name) { 'bug' }
10
+ let(:api_class) { GithubCLI::Label }
11
+
12
+ it "invokes label:list" do
13
+ api_class.should_receive(:all).with(user, repo, {}, format)
14
+ subject.invoke "label:list", [user, repo]
15
+ end
16
+
17
+ it "invokes label:list --milestone 1" do
18
+ api_class.should_receive(:all).with(user, repo, {'milestone_id' => 1}, 'csv')
19
+ subject.invoke "label:list", [user, repo], :milestone => 1, :format => 'csv'
20
+ end
21
+
22
+ it "invokes label:list --issue 1" do
23
+ api_class.should_receive(:all).with(user, repo, {'issue_id' => 1}, format)
24
+ subject.invoke "label:list", [user, repo], :issue => 1
25
+ end
26
+
27
+ it "invokes label:get" do
28
+ api_class.should_receive(:get).with(user, repo, name, {}, format)
29
+ subject.invoke "label:get", [user, repo, name]
30
+ end
31
+
32
+ it "invokes label:create" do
33
+ api_class.should_receive(:create).with(user, repo, {}, format)
34
+ subject.invoke "label:create", [user, repo]
35
+ end
36
+
37
+ it "invokes label:update" do
38
+ api_class.should_receive(:update).with(user, repo, name, {}, format)
39
+ subject.invoke "label:update", [user, repo, name]
40
+ end
41
+
42
+ it "invokes label:delete" do
43
+ api_class.should_receive(:delete).with(user, repo, name, {}, format)
44
+ subject.invoke "label:delete", [user, repo, name]
45
+ end
46
+
47
+ it "invokes lable:add" do
48
+ api_class.should_receive(:add).with(user, repo, 1, [], {}, format)
49
+ subject.invoke "label:add", [user, repo, 1]
50
+ end
51
+
52
+ it "invokes lable:remove" do
53
+ api_class.should_receive(:remove).with(user, repo, '1', nil, {}, format)
54
+ subject.invoke "label:remove", [user, repo, '1']
55
+ end
56
+
57
+ it "invokes lable:replace" do
58
+ api_class.should_receive(:replace).with(user, repo, 1, [], {}, format)
59
+ subject.invoke "label:replace", [user, repo, 1]
60
+ end
61
+ end
@@ -0,0 +1,47 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Milestones do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:api_class) { GithubCLI::Milestone }
10
+
11
+ it "invokes milestone:list" do
12
+ api_class.should_receive(:all).with(user, repo,
13
+ {"state"=>"open", "sort"=>"due_date", "direction"=>"desc"}, format)
14
+ subject.invoke "milestone:list", [user, repo]
15
+ end
16
+
17
+ it "invokes milestone:list --state" do
18
+ api_class.should_receive(:all).with(user, repo,
19
+ {"state"=>"closed", "sort"=>"due_date", "direction"=>"desc"}, format)
20
+ subject.invoke "milestone:list", [user, repo], :state => "closed"
21
+ end
22
+
23
+ it "invokes milestone:get" do
24
+ api_class.should_receive(:get).with(user, repo, 1, {}, format)
25
+ subject.invoke "milestone:get", [user, repo, 1]
26
+ end
27
+
28
+ it "invokes milestone:create --title" do
29
+ api_class.should_receive(:create).with(user, repo, {"title" => 'new'}, format)
30
+ subject.invoke "milestone:create", [user, repo], :title => 'new'
31
+ end
32
+
33
+ it "invokes milestone:update" do
34
+ api_class.should_receive(:update).with(user, repo, 1, {}, format)
35
+ subject.invoke "milestone:update", [user, repo, 1]
36
+ end
37
+
38
+ it "invokes milestone:update --title" do
39
+ api_class.should_receive(:update).with(user, repo, 1, {'title' => 'new'}, format)
40
+ subject.invoke "milestone:update", [user, repo, 1], :title => 'new'
41
+ end
42
+
43
+ it "invokes milestone:delete" do
44
+ api_class.should_receive(:delete).with(user, repo, 1, {}, format)
45
+ subject.invoke "milestone:delete", [user, repo, 1]
46
+ end
47
+ end
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::References do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:ref) { 'refs/master' }
10
+ let(:sha) { '3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15' }
11
+ let(:api_class) { GithubCLI::Reference }
12
+
13
+ it "invokes ref:list" do
14
+ api_class.should_receive(:list).with(user, repo, {}, format)
15
+ subject.invoke "ref:list", [user, repo]
16
+ end
17
+
18
+ it "invokes ref:list --ref" do
19
+ api_class.should_receive(:list).with(user, repo, {"ref" => ref}, format)
20
+ subject.invoke "ref:list", [user, repo], :ref => ref
21
+ end
22
+
23
+ it "invokes ref:get" do
24
+ api_class.should_receive(:get).with(user, repo, ref, {}, format)
25
+ subject.invoke "ref:get", [user, repo, ref]
26
+ end
27
+
28
+ it "invokes ref:create --ref --sha" do
29
+ api_class.should_receive(:create).with(user, repo, {"ref" => ref, "sha" => sha}, format)
30
+ subject.invoke "ref:create", [user, repo], :ref => ref, :sha => sha
31
+ end
32
+
33
+ it "invokes ref:update --sha -f" do
34
+ api_class.should_receive(:update).with(user, repo, ref, {"sha" => sha, "force" => false}, format)
35
+ subject.invoke "ref:update", [user, repo, ref], :sha => sha
36
+ end
37
+
38
+ it "invokes ref:delete" do
39
+ api_class.should_receive(:delete).with(user, repo, ref, {}, format)
40
+ subject.invoke "ref:delete", [user, repo, ref]
41
+ end
42
+ end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Starring do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:api_class) { GithubCLI::Starring }
10
+
11
+ it "invokes star:list" do
12
+ api_class.should_receive(:list).with(user, repo, {}, format)
13
+ subject.invoke "star:list", [user, repo]
14
+ end
15
+
16
+ it "invokes star:starred" do
17
+ api_class.should_receive(:starred).with({}, format)
18
+ subject.invoke "star:starred", []
19
+ end
20
+
21
+ it "invokes star:starred --user" do
22
+ api_class.should_receive(:starred).with({"user" => user}, format)
23
+ subject.invoke "star:starred", [], :user => user
24
+ end
25
+
26
+ it "invokes star:starring" do
27
+ api_class.should_receive(:starring?).with(user, repo, {}, format)
28
+ subject.invoke "star:starring", [user, repo]
29
+ end
30
+
31
+ it "invokes star:star" do
32
+ api_class.should_receive(:star).with(user, repo, {}, format)
33
+ subject.invoke "star:star", [user, repo]
34
+ end
35
+
36
+ it "invokes star:star" do
37
+ api_class.should_receive(:unstar).with(user, repo, {}, format)
38
+ subject.invoke "star:unstar", [user, repo]
39
+ end
40
+ end
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Tags do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:sha) { '3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15' }
10
+ let(:api_class) { GithubCLI::Tag }
11
+
12
+ it "invokes tag:get" do
13
+ api_class.should_receive(:get).with(user, repo, sha, {}, format)
14
+ subject.invoke "tag:get", [user, repo, sha]
15
+ end
16
+
17
+ it "invokes tag:create" do
18
+ api_class.should_receive(:create).with(user, repo, {}, format)
19
+ subject.invoke "tag:create", [user, repo]
20
+ end
21
+
22
+ it "invokes tag:create --object" do
23
+ api_class.should_receive(:create).with(user, repo, {'object' => sha}, format)
24
+ subject.invoke "tag:create", [user, repo], :object => sha
25
+ end
26
+ end
@@ -0,0 +1,32 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Trees do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:sha) { '3a0f86fb8db8eea7ccbb9a95f325ddbedfb25e15' }
10
+ let(:api_class) { GithubCLI::Tree }
11
+
12
+ it "invokes tree:get" do
13
+ api_class.should_receive(:get).with(user, repo, sha, {}, format)
14
+ subject.invoke "tree:get", [user, repo, sha]
15
+ end
16
+
17
+ it "invokes tree:get" do
18
+ api_class.should_receive(:get).with(user, repo, sha, {'recursive' => true}, format)
19
+ subject.invoke "tree:get", [user, repo, sha], :recursive => true
20
+ end
21
+
22
+ it "invokes tree:create" do
23
+ api_class.should_receive(:create).with(user, repo, {}, format)
24
+ subject.invoke "tree:create", [user, repo]
25
+ end
26
+
27
+ it "invokes tree:create --tree" do
28
+ tree = { "path" => "file.rb", "mode" => "100644"}
29
+ api_class.should_receive(:create).with(user, repo, {'tree' => [tree]}, format)
30
+ subject.invoke "tree:create", [user, repo], :tree => [tree]
31
+ end
32
+ end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Watching do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:api_class) { GithubCLI::Watching }
10
+
11
+ it "invokes watch:list" do
12
+ api_class.should_receive(:list).with(user, repo, {}, format)
13
+ subject.invoke "watch:list", [user, repo]
14
+ end
15
+
16
+ it "invokes watch:watched" do
17
+ api_class.should_receive(:watched).with({}, format)
18
+ subject.invoke "watch:watched"
19
+ end
20
+
21
+ it "invokes watch:watched --user" do
22
+ api_class.should_receive(:watched).with({"user" => user}, format)
23
+ subject.invoke "watch:watched", [], {:user => user}
24
+ end
25
+
26
+ it "invokes watch:watching" do
27
+ api_class.should_receive(:watching?).with(user, repo, {}, format)
28
+ subject.invoke "watch:watching", [user, repo]
29
+ end
30
+
31
+ it "invokes watch:start" do
32
+ api_class.should_receive(:start).with(user, repo, {}, format)
33
+ subject.invoke "watch:start", [user, repo]
34
+ end
35
+
36
+ it "invokes watch:stop" do
37
+ api_class.should_receive(:stop).with(user, repo, {}, format)
38
+ subject.invoke "watch:stop", [user, repo]
39
+ end
40
+ end