redditkit 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,7 @@ describe RedditKit::Base do
22
22
 
23
23
  context "predicate method" do
24
24
  it "can access predicate methods" do
25
- expect(@thing.id?).to be_true
25
+ expect(@thing.id?).to be true
26
26
  end
27
27
  end
28
28
 
@@ -6,14 +6,14 @@ describe RedditKit::Client::Account, :vcr do
6
6
  it "signs the user in" do
7
7
  client = RedditKit::Client.new redditkit_username, redditkit_password
8
8
 
9
- expect(client.signed_in?).to be_true
9
+ expect(client.signed_in?).to be true
10
10
  expect(client.user).to_not be_nil
11
11
  end
12
12
  end
13
13
 
14
14
  describe "#signed_in?" do
15
15
  it "determines whether there is a user signed in" do
16
- expect(authenticated_client.signed_in?).to be_true
16
+ expect(authenticated_client.signed_in?).to be true
17
17
  end
18
18
  end
19
19
 
@@ -22,7 +22,7 @@ describe RedditKit::Client::Account, :vcr do
22
22
  client = RedditKit::Client.new :username => redditkit_username, :password => redditkit_password
23
23
  client.sign_out
24
24
 
25
- expect(client.signed_in?).to_not be_true
25
+ expect(client.signed_in?).to be false
26
26
  end
27
27
  end
28
28
 
@@ -55,7 +55,7 @@ describe RedditKit::Client::Links, :vcr do
55
55
  links = RedditKit.links_with_domain "github.com"
56
56
  result = links.all? { |link| link.domain == 'github.com' }
57
57
 
58
- expect(result).to be_true
58
+ expect(result).to be true
59
59
  end
60
60
  end
61
61
 
@@ -62,7 +62,7 @@ describe RedditKit::Client::Moderation, :vcr do
62
62
  end
63
63
 
64
64
  it "requests the correct resource" do
65
- authenticated_client.distinguish :comment => '12345'
65
+ authenticated_client.distinguish '12345'
66
66
  expect(a_post('api/distinguish/yes')).to have_been_made
67
67
  end
68
68
  end
@@ -95,7 +95,7 @@ describe RedditKit::Client::Multireddits, :vcr do
95
95
  multireddits = authenticated_client.my_multireddits
96
96
  multireddit = multireddits.find { |multi| multi.name == multireddit_name }
97
97
 
98
- expect(multireddit.subreddits.include? 'haskell').to be_true
98
+ expect(multireddit.subreddits.include? 'haskell').to be true
99
99
 
100
100
  authenticated_client.delete_multireddit multireddit_name
101
101
  end
@@ -136,7 +136,7 @@ describe RedditKit::Client::Multireddits, :vcr do
136
136
  authenticated_client.add_subreddit_to_multireddit 'addsubreddit', 'haskell'
137
137
  multireddit = authenticated_client.multireddit redditkit_username, 'addsubreddit'
138
138
 
139
- expect(multireddit.subreddits.include? 'haskell').to be_true
139
+ expect(multireddit.subreddits.include? 'haskell').to be true
140
140
 
141
141
  authenticated_client.delete_multireddit 'addsubreddit'
142
142
  end
@@ -149,7 +149,7 @@ describe RedditKit::Client::Multireddits, :vcr do
149
149
  authenticated_client.remove_subreddit_from_multireddit 'removesubreddit', 'haskell'
150
150
  multireddit = authenticated_client.multireddit redditkit_username, 'removesubreddit'
151
151
 
152
- expect(multireddit.subreddits.include? 'haskell').to be_false
152
+ expect(multireddit.subreddits.include? 'haskell').to be false
153
153
 
154
154
  authenticated_client.delete_multireddit 'removesubreddit'
155
155
  end
@@ -67,14 +67,14 @@ describe RedditKit::Client::Users, :vcr do
67
67
  client = RedditKit::Client.new
68
68
  available = client.username_available? 'samsymons'
69
69
 
70
- expect(available).to_not be_true
70
+ expect(available).to be false
71
71
  end
72
72
 
73
73
  it "returns true for an available username" do
74
74
  client = RedditKit::Client.new
75
75
  available = client.username_available? 'available_user'
76
76
 
77
- expect(available).to be_true
77
+ expect(available).to be true
78
78
  end
79
79
  end
80
80
 
@@ -6,28 +6,28 @@ describe RedditKit::Client::Voting do
6
6
  context "with a comment full name passed" do
7
7
  it "upvotes the comment" do
8
8
  authenticated_client.upvote test_comment_full_name
9
- expect(test_comment.upvoted?).to be_true
9
+ expect(test_comment.upvoted?).to be true
10
10
  end
11
11
  end
12
12
 
13
13
  context "with a link full name passed" do
14
14
  it "upvotes the link" do
15
15
  authenticated_client.upvote test_link_full_name
16
- expect(test_link.upvoted?).to be_true
16
+ expect(test_link.upvoted?).to be true
17
17
  end
18
18
  end
19
19
 
20
20
  context "with a comment passed" do
21
21
  it "upvotes the comment" do
22
22
  authenticated_client.upvote test_comment
23
- expect(test_comment.upvoted?).to be_true
23
+ expect(test_comment.upvoted?).to be true
24
24
  end
25
25
  end
26
26
 
27
27
  context "with a link passed" do
28
28
  it "upvotes the link" do
29
29
  authenticated_client.upvote test_link
30
- expect(test_link.upvoted?).to be_true
30
+ expect(test_link.upvoted?).to be true
31
31
  end
32
32
  end
33
33
  end
@@ -36,28 +36,28 @@ describe RedditKit::Client::Voting do
36
36
  context "with a comment full name passed" do
37
37
  it "downvotes the comment" do
38
38
  authenticated_client.downvote test_comment_full_name
39
- expect(test_comment.downvoted?).to be_true
39
+ expect(test_comment.downvoted?).to be true
40
40
  end
41
41
  end
42
42
 
43
43
  context "with a link full name passed" do
44
44
  it "downvotes the link" do
45
45
  authenticated_client.downvote test_link_full_name
46
- expect(test_link.downvoted?).to be_true
46
+ expect(test_link.downvoted?).to be true
47
47
  end
48
48
  end
49
49
 
50
50
  context "with a comment passed" do
51
51
  it "downvotes the comment" do
52
52
  authenticated_client.downvote test_comment
53
- expect(test_comment.downvoted?).to be_true
53
+ expect(test_comment.downvoted?).to be true
54
54
  end
55
55
  end
56
56
 
57
57
  context "with a link passed" do
58
58
  it "downvotes the link" do
59
59
  authenticated_client.downvote test_link
60
- expect(test_link.downvoted?).to be_true
60
+ expect(test_link.downvoted?).to be true
61
61
  end
62
62
  end
63
63
  end
@@ -66,32 +66,32 @@ describe RedditKit::Client::Voting do
66
66
  context "with a comment full name passed" do
67
67
  it "withdraws the vote on the comment" do
68
68
  authenticated_client.withdraw_vote test_comment_full_name
69
- expect(test_comment.upvoted?).to_not be_true
70
- expect(test_comment.downvoted?).to_not be_true
69
+ expect(test_comment.upvoted?).to be false
70
+ expect(test_comment.downvoted?).to be false
71
71
  end
72
72
  end
73
73
 
74
74
  context "with a link full name passed" do
75
75
  it "withdraws the vote on the link" do
76
76
  authenticated_client.withdraw_vote test_link_full_name
77
- expect(test_link.upvoted?).to_not be_true
78
- expect(test_link.downvoted?).to_not be_true
77
+ expect(test_link.upvoted?).to be false
78
+ expect(test_link.downvoted?).to be false
79
79
  end
80
80
  end
81
81
 
82
82
  context "with a comment passed" do
83
83
  it "withdraws the vote on the comment" do
84
84
  authenticated_client.withdraw_vote test_comment
85
- expect(test_comment.upvoted?).to_not be_true
86
- expect(test_comment.downvoted?).to_not be_true
85
+ expect(test_comment.upvoted?).to be false
86
+ expect(test_comment.downvoted?).to be false
87
87
  end
88
88
  end
89
89
 
90
90
  context "with a link passed" do
91
91
  it "withdraws the vote on the link" do
92
92
  authenticated_client.withdraw_vote test_link
93
- expect(test_link.upvoted?).to_not be_true
94
- expect(test_link.downvoted?).to_not be_true
93
+ expect(test_link.upvoted?).to be false
94
+ expect(test_link.downvoted?).to be false
95
95
  end
96
96
  end
97
97
  end
@@ -27,9 +27,9 @@ describe RedditKit::Client, :vcr do
27
27
  it "should tell us whether it is signed in", :authenticated do
28
28
  client = authenticated_client
29
29
 
30
- expect(client.signed_in?).to be_true
30
+ expect(client.signed_in?).to be true
31
31
  client.sign_out
32
- expect(client.signed_in?).to_not be_true
32
+ expect(client.signed_in?).to be false
33
33
  end
34
34
 
35
35
  it "should be able to sign out", :authenticated do
@@ -6,21 +6,21 @@ describe RedditKit::Comment, :vcr do
6
6
  comments = RedditKit.comments '1n002d'
7
7
  comment = comments.first
8
8
 
9
- expect(comment.replies?).to be_true
9
+ expect(comment.replies?).to be true
10
10
  end
11
11
 
12
12
  it "should be deleted if both author and comment attributes are set to '[deleted]'" do
13
13
  attributes = { :data => { :author => '[deleted]', :body => '[deleted]' } }
14
14
  deleted_comment = RedditKit::Comment.new attributes
15
15
 
16
- expect(deleted_comment.deleted?).to be_true
16
+ expect(deleted_comment.deleted?).to be true
17
17
  end
18
18
 
19
19
  it "should not be deleted if neither author and comment attributes are set to '[deleted]'" do
20
20
  comments = RedditKit.comments '1n002d'
21
21
  comment = comments.first
22
22
 
23
- expect(comment.deleted?).to_not be_true
23
+ expect(comment.deleted?).to be false
24
24
  end
25
25
 
26
26
  end
@@ -3,23 +3,34 @@ require 'spec_helper'
3
3
  describe RedditKit::Link do
4
4
 
5
5
  before :all do
6
- attributes = { :data => { :id => '12345', :url => 'http://example.com/test.png', :permalink => 'permalink', :created_utc => Time.now.to_i } }
6
+ attributes = { :data => { :id => '12345', :title => "&", :url => 'http://example.com/test.png', :permalink => 'permalink', :created_utc => Time.now.to_i } }
7
7
  @link = RedditKit::Link.new attributes
8
8
 
9
9
  old_link_attributes = { :data => { :id => '12345', :url => 'http://example.com/test.png', :created_utc => Time.new(2000, 1, 1).to_i } }
10
10
  @old_link = RedditKit::Link.new old_link_attributes
11
+
12
+ parameter_link_attributes = { :data => { :id => '12345', :url => 'http://example.com/test?param=something&whatever=test', :created_utc => Time.new(2000, 1, 1).to_i } }
13
+ @link_with_parameters = RedditKit::Link.new parameter_link_attributes
14
+ end
15
+
16
+ it "decodes HTML entities in link titles" do
17
+ expect(@link.title).to eq '&'
18
+ end
19
+
20
+ it "decodes HTML entities in link URLs" do
21
+ expect(@link_with_parameters.url).to eq 'http://example.com/test?param=something&whatever=test'
11
22
  end
12
23
 
13
24
  it "does not show the score for new links" do
14
- expect(@link.showing_link_score?).to be_false
25
+ expect(@link.showing_link_score?).to be false
15
26
  end
16
27
 
17
28
  it "shows the score for old links" do
18
- expect(@old_link.showing_link_score?).to be_true
29
+ expect(@old_link.showing_link_score?).to be true
19
30
  end
20
31
 
21
32
  it "determines whether the link has an image extension" do
22
- expect(@link.image_link?).to be_true
33
+ expect(@link.image_link?).to be true
23
34
  end
24
35
 
25
36
  it "returns the link's permalink" do
@@ -17,7 +17,7 @@ describe RedditKit::Multireddit do
17
17
  result = subreddits.all? { |subreddit| subreddit.is_a? String }
18
18
 
19
19
  expect(subreddits.length).to eq 3
20
- expect(result).to be_true
20
+ expect(result).to be true
21
21
  end
22
22
 
23
23
  it "returns the username of the multireddit's owner" do
@@ -12,7 +12,7 @@ describe RedditKit::Thing do
12
12
 
13
13
  it "is equal to another thing with the same full name" do
14
14
  second_thing = RedditKit::Thing.new({ :kind => 't1', :data => { :id => '12345' } })
15
- expect(@thing == second_thing).to be_true
15
+ expect(@thing == second_thing).to be true
16
16
  end
17
17
 
18
18
  end
@@ -33,19 +33,19 @@ describe RedditKit::Votable do
33
33
 
34
34
  describe "#upvoted?" do
35
35
  it "determines whether the object is upvoted" do
36
- expect(@votable.upvoted?).to be_true
36
+ expect(@votable.upvoted?).to be true
37
37
  end
38
38
  end
39
39
 
40
40
  describe "#downvoted?" do
41
41
  it "determines whether the object is downvoted" do
42
- expect(@votable.downvoted?).to_not be_true
42
+ expect(@votable.downvoted?).to be false
43
43
  end
44
44
  end
45
45
 
46
46
  describe "#voted?" do
47
47
  it "determines whether the object has been voted on" do
48
- expect(@votable.voted?).to be_true
48
+ expect(@votable.voted?).to be true
49
49
  end
50
50
  end
51
51
 
@@ -11,7 +11,7 @@ describe RedditKit do
11
11
  end
12
12
 
13
13
  it "responds to methods on its client" do
14
- expect(RedditKit.respond_to?(:username)).to be_true
14
+ expect(RedditKit.respond_to?(:username)).to be true
15
15
  end
16
16
 
17
17
  it "forwards methods to its client" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redditkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Symons
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-11 00:00:00.000000000 Z
11
+ date: 2014-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -24,20 +24,54 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: htmlentities
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: multi_json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.8'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.8'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: dotenv
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.9'
31
62
  - - ">="
32
63
  - !ruby/object:Gem::Version
33
- version: '0'
64
+ version: 0.9.0
34
65
  type: :development
35
66
  prerelease: false
36
67
  version_requirements: !ruby/object:Gem::Requirement
37
68
  requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '0.9'
38
72
  - - ">="
39
73
  - !ruby/object:Gem::Version
40
- version: '0'
74
+ version: 0.9.0
41
75
  description: A simple reddit API library, covering 100% of the reddit API.
42
76
  email:
43
77
  - samsymons@me.com
@@ -48,8 +82,9 @@ files:
48
82
  - LICENSE.md
49
83
  - README.md
50
84
  - Rakefile
51
- - redditkit.gemspec
85
+ - lib/redditkit.rb
52
86
  - lib/redditkit/base.rb
87
+ - lib/redditkit/client.rb
53
88
  - lib/redditkit/client/account.rb
54
89
  - lib/redditkit/client/apps.rb
55
90
  - lib/redditkit/client/captcha.rb
@@ -66,7 +101,6 @@ files:
66
101
  - lib/redditkit/client/utilities.rb
67
102
  - lib/redditkit/client/voting.rb
68
103
  - lib/redditkit/client/wiki.rb
69
- - lib/redditkit/client.rb
70
104
  - lib/redditkit/comment.rb
71
105
  - lib/redditkit/creatable.rb
72
106
  - lib/redditkit/error.rb
@@ -83,8 +117,7 @@ files:
83
117
  - lib/redditkit/user.rb
84
118
  - lib/redditkit/version.rb
85
119
  - lib/redditkit/votable.rb
86
- - lib/redditkit.rb
87
- - spec/cassettes/authenticated_client.yml
120
+ - redditkit.gemspec
88
121
  - spec/cassettes/RedditKit_Client/should_raise_an_error_with_invalid_credentials.yml
89
122
  - spec/cassettes/RedditKit_Client_Account/_sign_in/signs_the_user_in.yml
90
123
  - spec/cassettes/RedditKit_Client_Account/_update_session/updates_the_current_session.yml
@@ -92,8 +125,8 @@ files:
92
125
  - spec/cassettes/RedditKit_Client_Captcha/_needs_captcha_/checks_if_the_current_account_needs_a_CAPTCHA.yml
93
126
  - spec/cassettes/RedditKit_Client_Captcha/_new_captcha_identifier/returns_a_new_CAPTCHA_identifier.yml
94
127
  - spec/cassettes/RedditKit_Client_Comments/_comment/requests_the_correct_resource.yml
95
- - spec/cassettes/RedditKit_Client_Comments/_comments/with_a_link_identifier/returns_comments_on_a_link.yml
96
128
  - spec/cassettes/RedditKit_Client_Comments/_comments/with_a_RedditKit_Link/returns_comments_on_a_link.yml
129
+ - spec/cassettes/RedditKit_Client_Comments/_comments/with_a_link_identifier/returns_comments_on_a_link.yml
97
130
  - spec/cassettes/RedditKit_Client_Comments/_submit_comment/requests_the_correct_resource.yml
98
131
  - spec/cassettes/RedditKit_Client_Flair/_apply_flair_template/clears_flair_templates.yml
99
132
  - spec/cassettes/RedditKit_Client_Flair/_clear_flair_templates/clears_flair_templates.yml
@@ -196,6 +229,7 @@ files:
196
229
  - spec/cassettes/RedditKit_Client_Wiki/_revert_to_revision/requests_the_correct_resource.yml
197
230
  - spec/cassettes/RedditKit_Comment/should_not_be_deleted_if_neither_author_and_comment_attributes_are_set_to_deleted_.yml
198
231
  - spec/cassettes/RedditKit_Comment/should_return_replies.yml
232
+ - spec/cassettes/authenticated_client.yml
199
233
  - spec/redditkit/base_spec.rb
200
234
  - spec/redditkit/client/account_spec.rb
201
235
  - spec/redditkit/client/apps_spec.rb
@@ -243,12 +277,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
277
  version: '0'
244
278
  requirements: []
245
279
  rubyforge_project:
246
- rubygems_version: 2.1.10
280
+ rubygems_version: 2.2.0
247
281
  signing_key:
248
282
  specification_version: 4
249
283
  summary: A simple reddit API library.
250
284
  test_files:
251
- - spec/cassettes/authenticated_client.yml
252
285
  - spec/cassettes/RedditKit_Client/should_raise_an_error_with_invalid_credentials.yml
253
286
  - spec/cassettes/RedditKit_Client_Account/_sign_in/signs_the_user_in.yml
254
287
  - spec/cassettes/RedditKit_Client_Account/_update_session/updates_the_current_session.yml
@@ -256,8 +289,8 @@ test_files:
256
289
  - spec/cassettes/RedditKit_Client_Captcha/_needs_captcha_/checks_if_the_current_account_needs_a_CAPTCHA.yml
257
290
  - spec/cassettes/RedditKit_Client_Captcha/_new_captcha_identifier/returns_a_new_CAPTCHA_identifier.yml
258
291
  - spec/cassettes/RedditKit_Client_Comments/_comment/requests_the_correct_resource.yml
259
- - spec/cassettes/RedditKit_Client_Comments/_comments/with_a_link_identifier/returns_comments_on_a_link.yml
260
292
  - spec/cassettes/RedditKit_Client_Comments/_comments/with_a_RedditKit_Link/returns_comments_on_a_link.yml
293
+ - spec/cassettes/RedditKit_Client_Comments/_comments/with_a_link_identifier/returns_comments_on_a_link.yml
261
294
  - spec/cassettes/RedditKit_Client_Comments/_submit_comment/requests_the_correct_resource.yml
262
295
  - spec/cassettes/RedditKit_Client_Flair/_apply_flair_template/clears_flair_templates.yml
263
296
  - spec/cassettes/RedditKit_Client_Flair/_clear_flair_templates/clears_flair_templates.yml
@@ -360,6 +393,7 @@ test_files:
360
393
  - spec/cassettes/RedditKit_Client_Wiki/_revert_to_revision/requests_the_correct_resource.yml
361
394
  - spec/cassettes/RedditKit_Comment/should_not_be_deleted_if_neither_author_and_comment_attributes_are_set_to_deleted_.yml
362
395
  - spec/cassettes/RedditKit_Comment/should_return_replies.yml
396
+ - spec/cassettes/authenticated_client.yml
363
397
  - spec/redditkit/base_spec.rb
364
398
  - spec/redditkit/client/account_spec.rb
365
399
  - spec/redditkit/client/apps_spec.rb