githubris 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/.travis.yml +8 -2
  2. data/Gemfile +6 -3
  3. data/README.md +14 -0
  4. data/Rakefile +5 -11
  5. data/githubris.gemspec +2 -0
  6. data/lib/githubris.rb +18 -8
  7. data/lib/githubris/api.rb +89 -11
  8. data/lib/githubris/api/gist.rb +34 -15
  9. data/lib/githubris/api/http.rb +12 -0
  10. data/lib/githubris/api/user.rb +10 -4
  11. data/lib/githubris/base.rb +80 -0
  12. data/lib/githubris/comment.rb +1 -6
  13. data/lib/githubris/error.rb +5 -0
  14. data/lib/githubris/gist.rb +15 -60
  15. data/lib/githubris/gist/file.rb +1 -8
  16. data/lib/githubris/oauth.rb +36 -0
  17. data/lib/githubris/publicity.rb +13 -0
  18. data/lib/githubris/user.rb +13 -28
  19. data/lib/githubris/version.rb +1 -1
  20. data/spec/githubris/api/gist_spec.rb +8 -41
  21. data/spec/githubris/api/user_spec.rb +17 -2
  22. data/spec/githubris/api_spec.rb +99 -0
  23. data/spec/githubris/base_spec.rb +77 -0
  24. data/spec/githubris/gist_spec.rb +21 -76
  25. data/spec/githubris/oauth_spec.rb +71 -0
  26. data/spec/githubris/publicity_spec.rb +22 -0
  27. data/spec/githubris/user_spec.rb +50 -13
  28. data/spec/githubris_spec.rb +34 -40
  29. data/spec/spec_helper.rb +9 -6
  30. data/spec/support/fixtures.rb +115 -99
  31. data/spec/support/fixtures/vcr_cassettes/Githubris/_find_gist.yml +44 -0
  32. data/spec/support/fixtures/vcr_cassettes/Githubris/_find_user.yml +40 -0
  33. data/spec/support/fixtures/vcr_cassettes/Githubris/_public_gists.yml +55 -0
  34. data/spec/support/fixtures/vcr_cassettes/Githubris_API/_authenticated_/when_authenticated_with_bad_credentials.yml +40 -0
  35. data/spec/support/fixtures/vcr_cassettes/Githubris_API/_authenticated_/when_authenticated_with_good_credentials.yml +42 -0
  36. data/spec/support/fixtures/vcr_cassettes/Githubris_API/_authenticated_/when_there_are_no_credentials.yml +42 -0
  37. data/spec/support/fixtures/vcr_cassettes/Githubris_API_Gist/_get_gist.yml +44 -0
  38. data/spec/support/fixtures/vcr_cassettes/Githubris_API_Gist/_get_public_gists.yml +107 -0
  39. data/spec/support/fixtures/vcr_cassettes/Githubris_API_Gist/_get_user_gists.yml +43 -0
  40. data/spec/support/fixtures/vcr_cassettes/Githubris_API_User/_get_authenticated_user/without_credentials.yml +42 -0
  41. data/spec/support/fixtures/vcr_cassettes/Githubris_API_User/_get_user.yml +40 -0
  42. data/spec/support/fixtures/vcr_cassettes/Githubris_Gist/_save.yml +42 -0
  43. data/spec/support/fixtures/vcr_cassettes/Githubris_Gist/any_gist.yml +44 -0
  44. data/spec/support/fixtures/vcr_cassettes/Githubris_Gist/given_a_gist_full_of_data.yml +44 -0
  45. data/spec/support/fixtures/vcr_cassettes/Githubris_Gist/on_a_gist_with_an_id.yml +44 -0
  46. data/spec/support/fixtures/vcr_cassettes/Githubris_Gist/on_a_gist_with_an_id/_reload.yml +44 -0
  47. data/spec/support/fixtures/vcr_cassettes/Githubris_User/_gists.yml +43 -0
  48. data/spec/support/fixtures/vcr_cassettes/Githubris_User/_reload.yml +40 -0
  49. data/spec/support/fixtures/vcr_cassettes/Githubris_User/_reload/on_a_user_with_a_login.yml +40 -0
  50. data/spec/support/fixtures/vcr_cassettes/Githubris_User/_reload/on_a_user_without_a_login.yml +40 -0
  51. data/spec/support/fixtures/vcr_cassettes/Githubris_User/_starred_gists/on_an_authenticated_user.yml +82 -0
  52. data/spec/support/vcr.rb +6 -0
  53. metadata +57 -21
  54. data/features/get_a_gist.feature +0 -13
  55. data/features/get_a_user.feature +0 -8
  56. data/features/list_of_public_gists.feature +0 -12
  57. data/features/list_of_users_public_gists.feature +0 -13
  58. data/features/step_definitions/general_steps.rb +0 -32
  59. data/features/support/env.rb +0 -6
  60. data/features/support/fakeweb_responses.rb +0 -12
  61. data/features/support/fixtures.rb +0 -47
  62. data/lib/githubris/builder.rb +0 -28
  63. data/spec/githubris/builder_spec.rb +0 -28
  64. data/spec/support/custom_matchers.rb +0 -27
  65. data/spec/support/fakeweb_responses.rb +0 -12
  66. data/spec/support/gist.json +0 -335
  67. data/spec/support/public_gists_page_1.json +0 -884
  68. data/spec/support/public_gists_page_2.json +0 -898
  69. data/spec/support/user.json +0 -14
  70. data/spec/support/user_public_gists.json +0 -65
@@ -0,0 +1,82 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://GithubrisTestUser:password@api.github.com/user?
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ authorization:
11
+ - Basic BasicAuthCrap
12
+ connection:
13
+ - close
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ server:
20
+ - nginx/1.0.13
21
+ date:
22
+ - Sat, 07 Apr 2012 02:51:39 GMT
23
+ content-type:
24
+ - application/json; charset=utf-8
25
+ connection:
26
+ - close
27
+ status:
28
+ - 200 OK
29
+ x-ratelimit-limit:
30
+ - '5000'
31
+ etag:
32
+ - ! '"73dbd2e2feaf1697381e9c917d343af6"'
33
+ x-ratelimit-remaining:
34
+ - '4993'
35
+ content-length:
36
+ - '650'
37
+ body:
38
+ encoding: US-ASCII
39
+ string: ! '{"following":0,"type":"User","avatar_url":"https://secure.gravatar.com/avatar/20de3fd01e285d14de84067c34ab74d2?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"GithubrisTestUser","owned_private_repos":0,"private_gists":0,"public_repos":1,"url":"https://api.github.com/users/GithubrisTestUser","html_url":"https://github.com/GithubrisTestUser","disk_usage":0,"plan":{"private_repos":0,"name":"free","collaborators":0,"space":307200},"created_at":"2012-02-24T12:23:28Z","gravatar_id":"20de3fd01e285d14de84067c34ab74d2","collaborators":0,"id":1469392,"total_private_repos":0,"public_gists":3,"followers":0}'
40
+ http_version: '1.1'
41
+ recorded_at: Sat, 07 Apr 2012 02:51:36 GMT
42
+ - request:
43
+ method: get
44
+ uri: https://GithubrisTestUser:password@api.github.com/gists/starred?
45
+ body:
46
+ encoding: US-ASCII
47
+ string: ''
48
+ headers:
49
+ authorization:
50
+ - Basic BasicAuthCrap
51
+ connection:
52
+ - close
53
+ response:
54
+ status:
55
+ code: 200
56
+ message: OK
57
+ headers:
58
+ server:
59
+ - nginx/1.0.13
60
+ date:
61
+ - Sat, 07 Apr 2012 02:51:40 GMT
62
+ content-type:
63
+ - application/json; charset=utf-8
64
+ connection:
65
+ - close
66
+ status:
67
+ - 200 OK
68
+ x-ratelimit-limit:
69
+ - '5000'
70
+ etag:
71
+ - ! '"1b5c39e4bc61cb4c5008b01186db63a0"'
72
+ x-ratelimit-remaining:
73
+ - '4992'
74
+ content-length:
75
+ - '1700'
76
+ body:
77
+ encoding: US-ASCII
78
+ string: ! '[{"files":{"no_delegate.rb":{"type":"application/ruby","language":"Ruby","size":208,"raw_url":"https://gist.github.com/raw/2324597/5f6a891a29772999207c89479c78130c642e5819/no_delegate.rb","filename":"no_delegate.rb"}},"git_push_url":"git@gist.github.com:2324597.git","comments":0,"updated_at":"2012-04-07T02:32:38Z","public":true,"url":"https://api.github.com/gists/2324597","user":{"login":"mdobson","url":"https://api.github.com/users/mdobson","avatar_url":"https://secure.gravatar.com/avatar/e042fe6b36628f262ad2d27e8f21addf?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"e042fe6b36628f262ad2d27e8f21addf","id":934320},"created_at":"2012-04-07T02:32:38Z","description":"No
79
+ use of delegates","html_url":"https://gist.github.com/2324597","id":"2324597","git_pull_url":"git://gist.github.com/2324597.git"},{"files":{"hello.html":{"type":"text/html","language":"HTML","size":15,"raw_url":"https://gist.github.com/raw/2324571/97ca6dd8d1f864e915833dcbafebc49ac6d3ab86/hello.html","filename":"hello.html"}},"git_push_url":"git@gist.github.com:2324571.git","comments":0,"updated_at":"2012-04-07T02:27:15Z","public":true,"url":"https://api.github.com/gists/2324571","user":{"login":"justinspradlin","url":"https://api.github.com/users/justinspradlin","avatar_url":"https://secure.gravatar.com/avatar/c4bccd1d6229139154c5571813e353a4?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"c4bccd1d6229139154c5571813e353a4","id":636274},"created_at":"2012-04-07T02:27:15Z","description":"Demo","html_url":"https://gist.github.com/2324571","id":"2324571","git_pull_url":"git://gist.github.com/2324571.git"}]'
80
+ http_version: '1.1'
81
+ recorded_at: Sat, 07 Apr 2012 02:51:37 GMT
82
+ recorded_with: VCR 2.0.1
@@ -0,0 +1,6 @@
1
+ require 'vcr'
2
+
3
+ VCR.configure do |c|
4
+ c.cassette_library_dir = 'spec/support/fixtures/vcr_cassettes'
5
+ c.hook_into :fakeweb
6
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: githubris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-18 00:00:00.000000000 Z
12
+ date: 2012-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
- requirement: &19299620 !ruby/object:Gem::Requirement
16
+ requirement: &9220560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,29 @@ dependencies:
21
21
  version: 0.8.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *19299620
24
+ version_requirements: *9220560
25
+ - !ruby/object:Gem::Dependency
26
+ name: multi_json
27
+ requirement: &9218880 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.1.0
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *9218880
36
+ - !ruby/object:Gem::Dependency
37
+ name: addressable
38
+ requirement: &9217820 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 2.2.7
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *9217820
25
47
  description: Githubris is meant to make Github API interaction a breeze.
26
48
  email:
27
49
  - isaac@isaacbfsanders.com
@@ -35,44 +57,57 @@ files:
35
57
  - Gemfile
36
58
  - README.md
37
59
  - Rakefile
38
- - features/get_a_gist.feature
39
- - features/get_a_user.feature
40
- - features/list_of_public_gists.feature
41
- - features/list_of_users_public_gists.feature
42
- - features/step_definitions/general_steps.rb
43
- - features/support/env.rb
44
- - features/support/fakeweb_responses.rb
45
- - features/support/fixtures.rb
46
60
  - githubris.gemspec
47
61
  - lib/githubris.rb
48
62
  - lib/githubris/api.rb
49
63
  - lib/githubris/api/gist.rb
64
+ - lib/githubris/api/http.rb
50
65
  - lib/githubris/api/user.rb
51
- - lib/githubris/builder.rb
66
+ - lib/githubris/base.rb
52
67
  - lib/githubris/comment.rb
68
+ - lib/githubris/error.rb
53
69
  - lib/githubris/gist.rb
54
70
  - lib/githubris/gist/file.rb
55
71
  - lib/githubris/issue.rb
72
+ - lib/githubris/oauth.rb
56
73
  - lib/githubris/organization.rb
74
+ - lib/githubris/publicity.rb
57
75
  - lib/githubris/repository.rb
58
76
  - lib/githubris/user.rb
59
77
  - lib/githubris/version.rb
60
78
  - spec/githubris/api/gist_spec.rb
61
79
  - spec/githubris/api/user_spec.rb
62
80
  - spec/githubris/api_spec.rb
63
- - spec/githubris/builder_spec.rb
81
+ - spec/githubris/base_spec.rb
64
82
  - spec/githubris/gist_spec.rb
83
+ - spec/githubris/oauth_spec.rb
84
+ - spec/githubris/publicity_spec.rb
65
85
  - spec/githubris/user_spec.rb
66
86
  - spec/githubris_spec.rb
67
87
  - spec/spec_helper.rb
68
- - spec/support/custom_matchers.rb
69
- - spec/support/fakeweb_responses.rb
70
88
  - spec/support/fixtures.rb
71
- - spec/support/gist.json
72
- - spec/support/public_gists_page_1.json
73
- - spec/support/public_gists_page_2.json
74
- - spec/support/user.json
75
- - spec/support/user_public_gists.json
89
+ - spec/support/fixtures/vcr_cassettes/Githubris/_find_gist.yml
90
+ - spec/support/fixtures/vcr_cassettes/Githubris/_find_user.yml
91
+ - spec/support/fixtures/vcr_cassettes/Githubris/_public_gists.yml
92
+ - spec/support/fixtures/vcr_cassettes/Githubris_API/_authenticated_/when_authenticated_with_bad_credentials.yml
93
+ - spec/support/fixtures/vcr_cassettes/Githubris_API/_authenticated_/when_authenticated_with_good_credentials.yml
94
+ - spec/support/fixtures/vcr_cassettes/Githubris_API/_authenticated_/when_there_are_no_credentials.yml
95
+ - spec/support/fixtures/vcr_cassettes/Githubris_API_Gist/_get_gist.yml
96
+ - spec/support/fixtures/vcr_cassettes/Githubris_API_Gist/_get_public_gists.yml
97
+ - spec/support/fixtures/vcr_cassettes/Githubris_API_Gist/_get_user_gists.yml
98
+ - spec/support/fixtures/vcr_cassettes/Githubris_API_User/_get_authenticated_user/without_credentials.yml
99
+ - spec/support/fixtures/vcr_cassettes/Githubris_API_User/_get_user.yml
100
+ - spec/support/fixtures/vcr_cassettes/Githubris_Gist/_save.yml
101
+ - spec/support/fixtures/vcr_cassettes/Githubris_Gist/any_gist.yml
102
+ - spec/support/fixtures/vcr_cassettes/Githubris_Gist/given_a_gist_full_of_data.yml
103
+ - spec/support/fixtures/vcr_cassettes/Githubris_Gist/on_a_gist_with_an_id.yml
104
+ - spec/support/fixtures/vcr_cassettes/Githubris_Gist/on_a_gist_with_an_id/_reload.yml
105
+ - spec/support/fixtures/vcr_cassettes/Githubris_User/_gists.yml
106
+ - spec/support/fixtures/vcr_cassettes/Githubris_User/_reload.yml
107
+ - spec/support/fixtures/vcr_cassettes/Githubris_User/_reload/on_a_user_with_a_login.yml
108
+ - spec/support/fixtures/vcr_cassettes/Githubris_User/_reload/on_a_user_without_a_login.yml
109
+ - spec/support/fixtures/vcr_cassettes/Githubris_User/_starred_gists/on_an_authenticated_user.yml
110
+ - spec/support/vcr.rb
76
111
  homepage: http://isaacbfsanders.com/githubris
77
112
  licenses: []
78
113
  post_install_message:
@@ -98,3 +133,4 @@ signing_key:
98
133
  specification_version: 3
99
134
  summary: Githubris is meant to make Github API interaction a breeze.
100
135
  test_files: []
136
+ has_rdoc:
@@ -1,13 +0,0 @@
1
- Feature: Get a Gist
2
- In order to retrieve the newest gist data for a given gist
3
- As a developer
4
- I want to be able to get a gist.
5
-
6
- Scenario: Get a gist via the Githubris API
7
- When I access "@githubris.find_gist(1)"
8
- Then I have the first gist
9
-
10
- Scenario: Reload a gist's information
11
- Given @gist is a stale copy of the first gist
12
- When I access "@gist.reload"
13
- Then I have the newest version of the gist
@@ -1,8 +0,0 @@
1
- Feature: Get a user
2
- In order to retrieve data about a user
3
- As a developer
4
- I want to be able to get a user's data
5
-
6
- Scenario: Getting a user
7
- When I access "@githubris.find_user('GithubrisTestUser')"
8
- Then I have that user
@@ -1,12 +0,0 @@
1
- Feature: List of Public Gists
2
- In order to evaluate the data created by gist makers
3
- As a developer
4
- I want to be able to see a list of public gists
5
-
6
- Scenario: Asking for public gists
7
- When I access "@githubris.public_gists"
8
- Then I have the default number of gists
9
-
10
- Scenario: Asking for a certain page of public gists
11
- When I access "@githubris.public_gists(page: 60)"
12
- Then I have the default number of gists
@@ -1,13 +0,0 @@
1
- Feature: List of user's public gists
2
- In order to view all of the public gists another user has made,
3
- As a user of the Githubris GitHub API,
4
- I want to be able to access the gists via the API.
5
-
6
- Scenario: via Githubris
7
- When I access "@githubris.public_gists(user: 'GithubrisTestUser')"
8
- Then I have 2 gists
9
-
10
- Scenario: via the User
11
- Given @user is GithubrisTestUser
12
- When I access "@user.public_gists"
13
- Then I have 2 gists
@@ -1,32 +0,0 @@
1
- Given /^@user is GithubrisTestUser$/ do
2
- @user = @githubris.find_user('GithubrisTestUser')
3
- end
4
-
5
- Given /^@gist is a stale copy of the first gist$/ do
6
- @gist = Githubris::Gist.new :id => 1
7
- end
8
-
9
- When /^I access "([^"]*)"$/ do |api_code|
10
- @actual = binding.eval api_code
11
- end
12
-
13
- Then /^I have the default number of gists$/ do
14
- @actual.count.should eql 30
15
- end
16
-
17
- Then /^I have (\d+) gists$/ do |count|
18
- @actual.count.should eql Integer(count)
19
- end
20
-
21
- Then /^I have that user$/ do
22
- @actual.should == test_user
23
- end
24
-
25
- Then /^I have the first gist$/ do
26
- @actual.should == test_gist
27
- end
28
-
29
- Then /^I have the newest version of the gist$/ do
30
- @actual.should == test_gist
31
- end
32
-
@@ -1,6 +0,0 @@
1
-
2
- require 'githubris'
3
-
4
- Before do
5
- @githubris = Githubris.new
6
- end
@@ -1,12 +0,0 @@
1
- require 'fakeweb'
2
-
3
- FakeWeb.allow_net_connect = false
4
- FakeWeb.register_uri(:get, 'https://api.github.com/', :body => '{}')
5
- FakeWeb.register_uri(:get, /gists\/public(?:[^?]*\?page=(\d+))?/,
6
- :body => File.open("spec/support/public_gists_page_#{$1 || 1}.json", 'r') {|f| f.read })
7
- FakeWeb.register_uri(:get, /users\/([^\/]*)\/gists\z/,
8
- :body => File.open("spec/support/user_public_gists.json"){|f| f.read })
9
- FakeWeb.register_uri(:get, /users\/\w+\z/,
10
- :body => File.open("spec/support/user.json"){|f| f.read })
11
- FakeWeb.register_uri(:get, /gists\/\d+/,
12
- :body => File.open('spec/support/gist.json'){|f| f.read })
@@ -1,47 +0,0 @@
1
- module Fixtures
2
- def test_public_gists
3
- build_gists get_public_gists_data
4
- end
5
-
6
- def test_user_public_gists
7
- build_gists get_user_public_gists_data
8
- end
9
-
10
- def test_user
11
- build_user get_user_data
12
- end
13
-
14
- def test_gist
15
- build_gist get_gist_data
16
- end
17
-
18
- def build_gists data
19
- Githubris::Builder.new.build_gists data
20
- end
21
-
22
- def build_gist data
23
- Githubris::Builder.new.build_gist data
24
- end
25
-
26
- def build_user data
27
- Githubris::Builder.new.build_user data
28
- end
29
-
30
- def get_user_public_gists_data
31
- MultiJson.decode(File.open("spec/support/user_public_gists.json") {|f| f.read})
32
- end
33
-
34
- def get_public_gists_data(page=1)
35
- MultiJson.decode(File.open("spec/support/public_gists_page_#{page}.json") {|f| f.read })
36
- end
37
-
38
- def get_user_data
39
- MultiJson.decode(File.open('spec/support/user.json') {|f| f.read })
40
- end
41
-
42
- def get_gist_data
43
- MultiJson.decode(File.open('spec/support/gist.json') {|f| f.read })
44
- end
45
- end
46
-
47
- World(Fixtures)
@@ -1,28 +0,0 @@
1
- class Githubris::Builder
2
- def build_gists(data)
3
- if data.is_a? Array
4
- data = [data].flatten
5
- data.map do |gist|
6
- build_gist gist
7
- end
8
- else
9
- build_gist data
10
- end
11
- end
12
-
13
- def build_gist(data)
14
- Githubris::Gist.new build(data)
15
- end
16
-
17
- def build_user(data)
18
- Githubris::User.new build(data)
19
- end
20
-
21
- def build(data)
22
- attributes = {}
23
- data.each_pair do |key, value|
24
- attributes[key.to_sym] = value
25
- end
26
- attributes
27
- end
28
- end
@@ -1,28 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Githubris::Builder do
4
- let(:gist_collection_data) { Githubris::SpecHelper.gist_collection_data }
5
-
6
- describe '#build_gists' do
7
- it 'is an array of gists' do
8
- gists = subject.build_gists(gist_collection_data)
9
- gists.should be_instance_of Array
10
- gists.each do |gist|
11
- gist.should be_instance_of Githubris::Gist
12
- end
13
- end
14
- end
15
-
16
- describe '#build_users' do
17
- let(:user_data) { Githubris::SpecHelper.user_data }
18
- context 'schema' do
19
- subject { Githubris::Builder.new.build_user user_data }
20
-
21
- its(:login) { should be_instance_of String }
22
- its(:id) { should be_instance_of Fixnum }
23
- its(:avatar_url) { should be_kind_of URI }
24
- its(:url) { should be_kind_of URI }
25
- its(:gravatar_id) { should be_instance_of String }
26
- end
27
- end
28
- end
@@ -1,27 +0,0 @@
1
- RSpec::Matchers.define :be_greater_than do |first|
2
- match do |actual|
3
- (actual > first) && (actual < @second)
4
- end
5
-
6
- chain :but_less_than do |second|
7
- @second = second
8
- end
9
- end
10
-
11
- RSpec::Matchers.define :all do |expected|
12
-
13
- match do |actual|
14
- @actual = actual
15
- @actual.all?(&@expectation)
16
- end
17
- chain :be_instance_of do |expected_klazz|
18
- @message = "be instances of #{expected_klazz}"
19
- @expectation = lambda do |actual|
20
- actual.instance_of? expected_klazz
21
- end
22
- end
23
-
24
- description do
25
- "all #{@message}"
26
- end
27
- end