octopi 0.1.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/.gitignore +2 -1
  2. data/.yardoc +0 -0
  3. data/README.rdoc +16 -41
  4. data/Rakefile +9 -0
  5. data/VERSION.yml +2 -2
  6. data/examples/overall.rb +1 -1
  7. data/lib/ext/hash_ext.rb +5 -0
  8. data/lib/ext/string_ext.rb +5 -0
  9. data/lib/octopi.rb +101 -202
  10. data/lib/octopi/api.rb +209 -0
  11. data/lib/octopi/base.rb +42 -38
  12. data/lib/octopi/blob.rb +12 -8
  13. data/lib/octopi/branch.rb +20 -7
  14. data/lib/octopi/branch_set.rb +11 -0
  15. data/lib/octopi/comment.rb +20 -0
  16. data/lib/octopi/commit.rb +39 -35
  17. data/lib/octopi/error.rb +17 -5
  18. data/lib/octopi/file_object.rb +6 -5
  19. data/lib/octopi/gist.rb +28 -0
  20. data/lib/octopi/issue.rb +49 -40
  21. data/lib/octopi/issue_comment.rb +7 -0
  22. data/lib/octopi/issue_set.rb +21 -0
  23. data/lib/octopi/key.rb +14 -7
  24. data/lib/octopi/key_set.rb +14 -0
  25. data/lib/octopi/plan.rb +5 -0
  26. data/lib/octopi/repository.rb +66 -45
  27. data/lib/octopi/repository_set.rb +9 -0
  28. data/lib/octopi/resource.rb +11 -16
  29. data/lib/octopi/self.rb +33 -0
  30. data/lib/octopi/tag.rb +12 -6
  31. data/lib/octopi/user.rb +62 -38
  32. data/octopi.gemspec +43 -12
  33. data/test/api_test.rb +58 -0
  34. data/test/authenticated_test.rb +39 -0
  35. data/test/blob_test.rb +23 -0
  36. data/test/branch_test.rb +20 -0
  37. data/test/commit_test.rb +82 -0
  38. data/test/file_object_test.rb +39 -0
  39. data/test/gist_test.rb +16 -0
  40. data/test/issue_comment.rb +19 -0
  41. data/test/issue_set_test.rb +33 -0
  42. data/test/issue_test.rb +120 -0
  43. data/test/key_set_test.rb +29 -0
  44. data/test/key_test.rb +35 -0
  45. data/test/repository_set_test.rb +23 -0
  46. data/test/repository_test.rb +141 -0
  47. data/test/stubs/commits/fcoury/octopi/octopi.rb +818 -0
  48. data/test/tag_test.rb +20 -0
  49. data/test/test_helper.rb +236 -0
  50. data/test/user_test.rb +92 -0
  51. metadata +54 -12
  52. data/examples/github.yml.example +0 -14
  53. data/test/octopi_test.rb +0 -46
@@ -1,14 +0,0 @@
1
- #
2
- # Octopi GitHub API configuration file
3
- #
4
-
5
- # GitHub user login and token
6
- login: github-username
7
- token: github-token
8
-
9
- # Trace level
10
- # Possible values:
11
- # false - no tracing, same as if the param is ommited
12
- # true - will output each POST or GET operation to the stdout
13
- # curl - same as true, but in addition will output the curl equivalent of each command (for debugging)
14
- trace: curl
data/test/octopi_test.rb DELETED
@@ -1,46 +0,0 @@
1
- require 'test_helper'
2
-
3
- class OctopiTest < Test::Unit::TestCase
4
- include Octopi
5
-
6
- # TODO: Those tests are obviously brittle. Need to stub/mock it.
7
-
8
- def assert_find_all(cls, check_method, repo, user)
9
- repo_method = cls.resource_name(:plural)
10
-
11
- item1 = cls.find_all(repo.name,user.login).first
12
- item2 = cls.find_all(repo).first
13
- item3 = repo.send(repo_method).first
14
-
15
- assert_equal item1.send(check_method), item2.send(check_method)
16
- assert_equal item1.send(check_method), item3.send(check_method)
17
- end
18
-
19
- def setup
20
- @user = User.find("fcoury")
21
- @repo = @user.repository("octopi")
22
- @issue = @repo.issues.first
23
- end
24
-
25
- context Issue do
26
- should "return the correct issue by number" do
27
- assert_equal @issue.number, Issue.find(@repo, @issue.number).number
28
- assert_equal @issue.number, Issue.find(@user, @repo, @issue.number).number
29
- assert_equal @issue.number, Issue.find(@repo.owner, @repo.name, @issue.number).number
30
- end
31
-
32
- should "return the correct issue by using repo.issue number" do
33
- assert_equal @issue.number, @repo.issue(@issue.number).number
34
- end
35
-
36
- should "fetch the same issue using different but equivalent find_all params" do
37
- assert_find_all Issue, :number, @repo, @user
38
- end
39
- end
40
-
41
- context Commit do
42
- should "fetch the same commit using different but equivalent find_all params" do
43
- assert_find_all Commit, :id, @repo, @user
44
- end
45
- end
46
- end