linkedin-scraper 0.0.8 → 0.0.9

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.
@@ -1,13 +1,83 @@
1
1
  require 'spec_helper'
2
2
  require 'linkedin-scraper'
3
3
 
4
-
5
4
  describe Linkedin::Profile do
5
+
6
+
7
+ before(:all) do
8
+ page = Nokogiri::HTML(File.open("spec/fixtures/jgrevich.html", 'r') { |f| f.read })
9
+ @profile = Linkedin::Profile.new(page, "http://www.linkedin.com/in/jgrevich")
10
+ end
11
+
6
12
  describe "::get_profile" do
7
- it "Create an instance of profile class and populate it will all details" do
8
- @profile = Linkedin::Profile.get_profile("http://www.linkedin.com/in/jeffweiner08")
9
- @profile.first_name.should == "Jeff"
10
- #other parameters may change with time
13
+ it "Create an instance of profile class" do
14
+ expect(@profile).to be_instance_of Linkedin::Profile
11
15
  end
12
16
  end
17
+
18
+ describe ".first_name" do
19
+ it 'returns the first and last name of the profile' do
20
+ expect(@profile.first_name).to eq "Justin"
21
+ end
22
+ end
23
+
24
+ describe ".last_name" do
25
+ it 'returns the last name of the profile' do
26
+ expect(@profile.last_name).to eq "Grevich"
27
+ end
28
+ end
29
+
30
+ describe ".name" do
31
+ it 'returns the first and last name of the profile' do
32
+ expect(@profile.name).to eq "Justin Grevich"
33
+ end
34
+ end
35
+
36
+ describe ".certifications" do
37
+ it 'returns an array of certification hashes' do
38
+ expect(@profile.certifications.class).to eq Array
39
+ expect(@profile.certifications.count).to eq 2
40
+ end
41
+
42
+ it 'returns the certification name' do
43
+ expect(@profile.certifications.first[:name]).to eq "CISSP"
44
+ end
45
+
46
+ it 'returns the certification start_date' do
47
+ expect(@profile.certifications.first[:start_date]).to eq Date.parse('December 2010')
48
+ end
49
+ end
50
+
51
+ describe ".organizations" do
52
+ it 'returns an array of organization hashes for the profile' do
53
+ expect(@profile.organizations.class).to eq Array
54
+ expect(@profile.organizations.first[:name]).to eq 'San Diego Ruby'
55
+ end
56
+ end
57
+
58
+ describe ".languages" do
59
+ it 'returns an array of languages hashes' do
60
+ expect(@profile.languages.class).to eq Array
61
+ end
62
+
63
+ context 'with language data' do
64
+
65
+ it 'returns an array with one language hash' do
66
+ expect(@profile.languages.class).to eq Array
67
+ end
68
+
69
+ describe 'language hash' do
70
+ it 'contains the key and value for language name' do
71
+ expect(@profile.languages.first[:language]).to eq 'English'
72
+ end
73
+
74
+ it 'contains the key and value for language proficiency' do
75
+ expect(@profile.languages.first[:proficiency]).to eq '(Native or bilingual proficiency)'
76
+ end
77
+ end
78
+ end # context 'with language data' do
79
+ end # describe ".languages" do
80
+
81
+
82
+
13
83
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linkedin-scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yatish Mehta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-12 00:00:00.000000000 Z
11
+ date: 2013-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -39,6 +39,7 @@ files:
39
39
  - lib/linkedin-scraper/profile.rb
40
40
  - lib/linkedin-scraper/version.rb
41
41
  - linkedin-scraper.gemspec
42
+ - spec/fixtures/jgrevich.html
42
43
  - spec/linkedin-scraper/profile_spec.rb
43
44
  - spec/spec_helper.rb
44
45
  homepage: https://github.com/yatishmehta27/linkedin-scraper
@@ -66,5 +67,6 @@ specification_version: 4
66
67
  summary: when a url of public linkedin profile page is given it scrapes the entire
67
68
  page and converts into a accessible object
68
69
  test_files:
70
+ - spec/fixtures/jgrevich.html
69
71
  - spec/linkedin-scraper/profile_spec.rb
70
72
  - spec/spec_helper.rb