popularity 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/Rakefile +6 -9
- data/VERSION +1 -1
- data/lib/popularity.rb +10 -17
- data/lib/popularity/crawler.rb +30 -7
- data/lib/popularity/networks/facebook.rb +6 -13
- data/lib/popularity/networks/github.rb +3 -9
- data/lib/popularity/networks/google_plus.rb +4 -10
- data/lib/popularity/networks/medium.rb +3 -9
- data/lib/popularity/networks/pinterest.rb +3 -9
- data/lib/popularity/networks/reddit_comment.rb +4 -10
- data/lib/popularity/networks/reddit_post.rb +13 -15
- data/lib/popularity/networks/reddit_share.rb +2 -16
- data/lib/popularity/networks/rubygems.rb +3 -9
- data/lib/popularity/networks/soundcloud.rb +3 -12
- data/lib/popularity/networks/twitter.rb +3 -9
- data/lib/popularity/results_container.rb +37 -26
- data/lib/popularity/search.rb +14 -13
- data/popularity.gemspec +8 -13
- data/spec/google_plus_spec.rb +3 -3
- data/spec/medium_spec.rb +3 -3
- data/spec/pinterest_spec.rb +3 -3
- data/spec/reddit_post_spec.rb +1 -1
- data/spec/reddit_spec.rb +40 -11
- data/spec/results_container_spec.rb +4 -4
- data/spec/rubygems_spec.rb +3 -3
- data/spec/search_spec.rb +9 -9
- data/spec/soundcloud_spec.rb +3 -3
- data/spec/spec_helper.rb +4 -1
- metadata +8 -13
- data/test/facebook_test.rb +0 -28
- data/test/fixtures/vcr_cassettes/facebook.yml +0 -50
- data/test/fixtures/vcr_cassettes/google.yml +0 -425
- data/test/helper.rb +0 -34
- data/test/test_non_specific.rb +0 -27
- data/test/test_twitter.rb +0 -28
data/test/helper.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
|
3
|
-
module SimpleCov::Configuration
|
4
|
-
def clean_filters
|
5
|
-
@filters = []
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
SimpleCov.configure do
|
10
|
-
clean_filters
|
11
|
-
load_adapter 'test_frameworks'
|
12
|
-
end
|
13
|
-
|
14
|
-
ENV["COVERAGE"] && SimpleCov.start do
|
15
|
-
add_filter "/.rvm/"
|
16
|
-
end
|
17
|
-
require 'rubygems'
|
18
|
-
require 'bundler'
|
19
|
-
begin
|
20
|
-
Bundler.setup(:default, :development)
|
21
|
-
rescue Bundler::BundlerError => e
|
22
|
-
$stderr.puts e.message
|
23
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
24
|
-
exit e.status_code
|
25
|
-
end
|
26
|
-
require 'minitest/autorun'
|
27
|
-
require 'shoulda'
|
28
|
-
require 'webmock'
|
29
|
-
require 'vcr'
|
30
|
-
|
31
|
-
|
32
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
33
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
34
|
-
require 'popularity'
|
data/test/test_non_specific.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
VCR.configure do |config|
|
4
|
-
config.cassette_library_dir = "test/fixtures/vcr_cassettes"
|
5
|
-
config.hook_into :webmock
|
6
|
-
end
|
7
|
-
|
8
|
-
class NonSpecificUrlTest < Minitest::Test
|
9
|
-
def setup
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_total
|
14
|
-
VCR.use_cassette("google") do
|
15
|
-
p = Popularity.search('http://google.com')
|
16
|
-
assert_match 23405566, p.total
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_search_info
|
21
|
-
VCR.use_cassette("google") do
|
22
|
-
p = Popularity.search('http://google.com')
|
23
|
-
assert_match 23405566, p.total
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
data/test/test_twitter.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class FacebookTest < Minitest::Test
|
4
|
-
def test_total
|
5
|
-
VCR.use_cassette("facebook") do
|
6
|
-
@p = Popularity::Facebook.new('http://google.com')
|
7
|
-
|
8
|
-
assert_equal (@p.shares + @p.comments), @p.total
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_comments
|
13
|
-
VCR.use_cassette("facebook") do
|
14
|
-
@p = Popularity::Facebook.new('http://google.com')
|
15
|
-
|
16
|
-
assert_equal 10121, @p.comments
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_shares
|
21
|
-
VCR.use_cassette("facebook") do
|
22
|
-
@p = Popularity::Facebook.new('http://google.com')
|
23
|
-
|
24
|
-
assert_equal 12081903, @p.shares
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|