pintrest-api 0.0.2 → 0.0.3
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/lib/pintrest_api/pin.rb +1 -0
- data/test/spec_helper.rb +26 -0
- data/test/test_board.rb +27 -0
- data/test/test_pin.rb +5 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2087614e3ea66777339a3d2e6bd3dee45cd60479
|
4
|
+
data.tar.gz: bf96b96e7c7a28e773be584fc261d89c2d3d44a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46f59576f523cb1421b82fa6d86c3a5b62679d0a54d9f9437d06db85e7405f5cebc3c2e153ab4b3fae372f4d5b5c320362b29b874c6571a1de9fe1758a4392e2
|
7
|
+
data.tar.gz: 2a19ecbe469d252c4b5e9438417d8aec50208a9089950712aeadbc047cf74ee56750b7cfda4ccb2f61f0cd0fbfcdc47e54099681ab7204cb437f67b8160c9ae6
|
data/lib/pintrest_api/pin.rb
CHANGED
data/test/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require_relative '../lib/pintrest_api.rb'
|
3
|
+
|
4
|
+
PIN_USER = 'soniakalathil'
|
5
|
+
|
6
|
+
module SpecHelper
|
7
|
+
def setup
|
8
|
+
# Register PhantomJS (aka poltergeist) as the driver to use
|
9
|
+
Capybara.register_driver :poltergeist do |app|
|
10
|
+
Capybara::Poltergeist::Driver.new(app)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Use XPath as the default selector for the find method
|
14
|
+
Capybara.default_selector = :css
|
15
|
+
|
16
|
+
# Start up a new thread
|
17
|
+
@session = Capybara::Session.new(:poltergeist)
|
18
|
+
|
19
|
+
# Report using a particular user agent
|
20
|
+
@session.driver.headers = { 'User-Agent' =>
|
21
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X)" }
|
22
|
+
|
23
|
+
# Return the driver's session
|
24
|
+
@session
|
25
|
+
end
|
26
|
+
end
|
data/test/test_board.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require_relative './spec_helper.rb'
|
3
|
+
|
4
|
+
class TestBoard < Minitest::Test
|
5
|
+
include SpecHelper
|
6
|
+
|
7
|
+
def test_all_gets_all_boards
|
8
|
+
@session.visit 'http://www.pinterest.com/' + PIN_USER
|
9
|
+
sleep 3
|
10
|
+
expected_board_count = Nokogiri::HTML.parse(@session.body).css('.BoardCount > .value').inner_text.to_i
|
11
|
+
actual_board_count = PintrestApi::Board.all(PIN_USER).count
|
12
|
+
|
13
|
+
assert_equal expected_board_count, actual_board_count
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_pins_get_users_pins_for_board
|
17
|
+
@session.visit 'http://www.pintrest.com/' + PIN_USER
|
18
|
+
sleep 3
|
19
|
+
doc = Nokogiri::HTML.parse @session.body
|
20
|
+
board_name = doc.css('.boardName').inner_text
|
21
|
+
binding.pry
|
22
|
+
expected_pin_count = doc.css('.PinCount > .value').inner_text
|
23
|
+
actual_pin_count = PintrestApi::Board.pins(PIN_USER, board_name)
|
24
|
+
|
25
|
+
assert_equal expected_board_count, actual_pin_count
|
26
|
+
end
|
27
|
+
end
|
data/test/test_pin.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pintrest-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mika Kalathil
|
@@ -167,6 +167,9 @@ files:
|
|
167
167
|
- lib/pintrest_api/board.rb
|
168
168
|
- lib/pintrest_api/core.rb
|
169
169
|
- lib/pintrest_api/pin.rb
|
170
|
+
- test/spec_helper.rb
|
171
|
+
- test/test_board.rb
|
172
|
+
- test/test_pin.rb
|
170
173
|
homepage: http://rubygems.org/gems/pintrest-api
|
171
174
|
licenses:
|
172
175
|
- MIT
|
@@ -191,4 +194,7 @@ rubygems_version: 2.4.3
|
|
191
194
|
signing_key:
|
192
195
|
specification_version: 4
|
193
196
|
summary: Pintrest Api
|
194
|
-
test_files:
|
197
|
+
test_files:
|
198
|
+
- test/spec_helper.rb
|
199
|
+
- test/test_board.rb
|
200
|
+
- test/test_pin.rb
|