crunchbase-ruby-library 0.1.7 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +66 -0
  3. data/.rubocop_todo.yml +47 -0
  4. data/.travis.yml +12 -0
  5. data/Gemfile +4 -0
  6. data/README.md +44 -54
  7. data/Rakefile +4 -1
  8. data/bin/console +15 -0
  9. data/bin/setup +8 -0
  10. data/crunchbase-ruby-library.gemspec +15 -12
  11. data/lib/crunchbase.rb +12 -3
  12. data/lib/crunchbase/api.rb +110 -102
  13. data/lib/crunchbase/client.rb +50 -0
  14. data/lib/crunchbase/exception.rb +13 -11
  15. data/lib/crunchbase/model.rb +50 -48
  16. data/lib/crunchbase/model/acquired_by.rb +23 -20
  17. data/lib/crunchbase/model/acquiree.rb +2 -1
  18. data/lib/crunchbase/model/acquirer.rb +2 -1
  19. data/lib/crunchbase/model/acquisition.rb +16 -19
  20. data/lib/crunchbase/model/address.rb +4 -6
  21. data/lib/crunchbase/model/advisory_role.rb +2 -2
  22. data/lib/crunchbase/model/board_members_and_advisor.rb +10 -9
  23. data/lib/crunchbase/model/category.rb +6 -7
  24. data/lib/crunchbase/model/competitor.rb +3 -2
  25. data/lib/crunchbase/model/current_team.rb +7 -11
  26. data/lib/crunchbase/model/customer.rb +3 -2
  27. data/lib/crunchbase/model/degree.rb +4 -5
  28. data/lib/crunchbase/model/entity.rb +98 -108
  29. data/lib/crunchbase/model/error.rb +3 -4
  30. data/lib/crunchbase/model/featured_team.rb +19 -0
  31. data/lib/crunchbase/model/founded_company.rb +2 -3
  32. data/lib/crunchbase/model/founder.rb +3 -4
  33. data/lib/crunchbase/model/fund.rb +8 -11
  34. data/lib/crunchbase/model/fund_raise.rb +7 -8
  35. data/lib/crunchbase/model/funding_round.rb +29 -24
  36. data/lib/crunchbase/model/headquarter.rb +2 -1
  37. data/lib/crunchbase/model/image.rb +6 -7
  38. data/lib/crunchbase/model/investment.rb +20 -27
  39. data/lib/crunchbase/model/investor.rb +6 -7
  40. data/lib/crunchbase/model/ipo.rb +12 -12
  41. data/lib/crunchbase/model/job.rb +11 -10
  42. data/lib/crunchbase/model/location.rb +20 -11
  43. data/lib/crunchbase/model/member.rb +3 -4
  44. data/lib/crunchbase/model/membership.rb +7 -8
  45. data/lib/crunchbase/model/new.rb +5 -6
  46. data/lib/crunchbase/model/office.rb +3 -4
  47. data/lib/crunchbase/model/organization.rb +39 -38
  48. data/lib/crunchbase/model/organization_summary.rb +7 -8
  49. data/lib/crunchbase/model/owned_by.rb +4 -5
  50. data/lib/crunchbase/model/parent_location.rb +3 -3
  51. data/lib/crunchbase/model/past_team.rb +7 -11
  52. data/lib/crunchbase/model/person.rb +53 -46
  53. data/lib/crunchbase/model/person_summary.rb +13 -14
  54. data/lib/crunchbase/model/primary_affiliation.rb +6 -6
  55. data/lib/crunchbase/model/primary_image.rb +3 -3
  56. data/lib/crunchbase/model/primary_location.rb +8 -7
  57. data/lib/crunchbase/model/product.rb +14 -13
  58. data/lib/crunchbase/model/product_summary.rb +4 -5
  59. data/lib/crunchbase/model/school.rb +3 -2
  60. data/lib/crunchbase/model/search.rb +39 -40
  61. data/lib/crunchbase/model/search_result.rb +7 -6
  62. data/lib/crunchbase/model/simple_organization.rb +9 -10
  63. data/lib/crunchbase/model/sub_organization.rb +3 -4
  64. data/lib/crunchbase/model/video.rb +4 -5
  65. data/lib/crunchbase/model/website.rb +7 -11
  66. data/lib/crunchbase/request.rb +8 -0
  67. data/lib/crunchbase/request/client.rb +69 -0
  68. data/lib/crunchbase/version.rb +2 -1
  69. data/spec/crunchbase.yml.example +2 -2
  70. data/spec/crunchbase/client_spec.rb +25 -0
  71. data/spec/crunchbase/data/board_members_and_advisors/facebook.json +462 -0
  72. data/spec/crunchbase/data/categories/facebook.json +67 -0
  73. data/spec/crunchbase/data/current_team/facebook.json +4335 -0
  74. data/spec/crunchbase/data/featured_team/facebook.json +286 -0
  75. data/spec/crunchbase/data/funding_rounds/37bd05f961af726ba3c1b279da842805.json +484 -0
  76. data/spec/crunchbase/data/funding_rounds/facebook.json +2049 -0
  77. data/spec/crunchbase/data/headquarters/facebook.json +50 -0
  78. data/spec/crunchbase/data/investors/facebook.json +776 -0
  79. data/spec/crunchbase/data/news/facebook.json +1426 -0
  80. data/spec/crunchbase/data/news/facebook_2.json +1426 -0
  81. data/spec/crunchbase/data/offices/facebook.json +50 -0
  82. data/spec/crunchbase/data/organizations/crunchbase.json +2845 -0
  83. data/spec/crunchbase/data/organizations/ekohe.json +654 -0
  84. data/spec/crunchbase/data/organizations/facebook-without-relationships.json +45 -0
  85. data/spec/crunchbase/data/organizations/facebook.json +6723 -0
  86. data/spec/crunchbase/data/organizations/mx-media-llc.json +7 -0
  87. data/spec/crunchbase/data/past_team/facebook.json +4336 -0
  88. data/spec/crunchbase/data/people/facebook_founders.json +148 -0
  89. data/spec/crunchbase/data/people/mark-zuckerberg.json +2602 -0
  90. data/spec/crunchbase/data/websites/facebook.json +74 -0
  91. data/spec/crunchbase/model/board_members_and_advisor_spec.rb +39 -11
  92. data/spec/crunchbase/model/category_spec.rb +47 -0
  93. data/spec/crunchbase/model/current_team_spec.rb +50 -0
  94. data/spec/crunchbase/model/featured_team_spec.rb +40 -0
  95. data/spec/crunchbase/model/founders_spec.rb +49 -0
  96. data/spec/crunchbase/model/fund_raise_spec.rb +4 -24
  97. data/spec/crunchbase/model/funding_round_spec.rb +75 -32
  98. data/spec/crunchbase/model/headquarter_spec.rb +37 -0
  99. data/spec/crunchbase/model/investment_spec.rb +4 -15
  100. data/spec/crunchbase/model/investor_spec.rb +37 -0
  101. data/spec/crunchbase/model/new_spec.rb +86 -0
  102. data/spec/crunchbase/model/office_spec.rb +29 -9
  103. data/spec/crunchbase/model/organization_spec.rb +160 -34
  104. data/spec/crunchbase/model/past_team_spec.rb +36 -14
  105. data/spec/crunchbase/model/person_spec.rb +21 -19
  106. data/spec/crunchbase/model/product_spec.rb +4 -31
  107. data/spec/crunchbase/model/search_spec.rb +25 -49
  108. data/spec/crunchbase/model/website_spec.rb +36 -9
  109. data/spec/crunchbase/support/api_helper.rb +19 -0
  110. data/spec/spec_helper.rb +14 -4
  111. metadata +103 -6
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crunchbase
4
+ module Model
5
+ RSpec.describe Headquarter do
6
+ let(:headquarters_data) { parse_json('headquarters', 'facebook') }
7
+
8
+ context 'headquarters of facebook' do
9
+ let(:headquarters) { Headquarter.organization_lists('facebook') }
10
+
11
+ before :each do
12
+ result = search_results(headquarters_data, Headquarter)
13
+
14
+ allow(Headquarter).to receive(:organization_lists).and_return(result)
15
+ end
16
+
17
+ it 'should return 1 of total count with headquarters' do
18
+ expect(headquarters.results.size).to eq(1)
19
+ end
20
+
21
+ it 'should paging values from headquarters response' do
22
+ expect(headquarters.pages).to eq(1)
23
+ expect(headquarters.current_page).to eq(1)
24
+ expect(headquarters.per_page).to eq(100)
25
+ end
26
+
27
+ it 'should return first office record' do
28
+ first_item = headquarters.results.first
29
+
30
+ expect(first_item.type_name).to eq('Address')
31
+ expect(first_item.uuid).to eq('daebcfe0115c38af678c04603cc9f00f')
32
+ expect(first_item.name).to eq('Headquarters')
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,17 +1,6 @@
1
- require File.join(File.dirname(__FILE__), "../..", "spec_helper.rb")
2
-
3
- module Crunchbase
4
- module Model
5
-
6
- describe Investment, "#organization_lists" do
7
- begin
8
- results = Investment.organization_lists("stripes-group").results
9
- results.collect {|e| puts e.inspect }
10
-
11
- rescue Exception => e
12
- puts e.message
13
- end
14
- end
1
+ # frozen_string_literal: true
15
2
 
3
+ module Crunchbase::Model
4
+ RSpec.describe Investment do
16
5
  end
17
- end
6
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crunchbase
4
+ module Model
5
+ RSpec.describe Investor do
6
+ let(:investors_data) { parse_json('investors', 'facebook') }
7
+
8
+ context 'investors of facebook' do
9
+ let(:investors) { Investor.organization_lists('facebook') }
10
+
11
+ before :each do
12
+ result = search_results(investors_data, Investor)
13
+
14
+ allow(Investor).to receive(:organization_lists).and_return(result)
15
+ end
16
+
17
+ it 'should return 11 of total count with investors' do
18
+ expect(investors.results.size).to eq(20)
19
+ end
20
+
21
+ it 'should paging values from investors response' do
22
+ expect(investors.pages).to eq(1)
23
+ expect(investors.current_page).to eq(1)
24
+ expect(investors.per_page).to eq(100)
25
+ end
26
+
27
+ it 'should return first investors record' do
28
+ first_item = investors.results.first
29
+
30
+ expect(first_item.object.uuid).to eq('0159561fbe5d81eb7ccdb4d6efeb30fc')
31
+ expect(first_item.object.type_name).to eq('Person')
32
+ expect(first_item.object.permalink).to eq('mark-pincus')
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crunchbase
4
+ module Model
5
+ RSpec.describe New do
6
+ let(:news_data) { parse_json('news', 'facebook') }
7
+ let(:page2_news_data) { parse_json('news', 'facebook_2') }
8
+
9
+ context 'news of facebook' do
10
+ let(:news) { New.organization_lists('facebook') }
11
+
12
+ before :each do
13
+ result = search_results(news_data, New)
14
+
15
+ allow(New).to receive(:organization_lists).and_return(result)
16
+ end
17
+
18
+ it 'should return 100 of total count with news' do
19
+ expect(news.results.size).to eq(100)
20
+ end
21
+
22
+ it 'should paging values from news response' do
23
+ expect(news.pages).to eq(2632)
24
+ expect(news.current_page).to eq(1)
25
+ expect(news.per_page).to eq(100)
26
+ end
27
+
28
+ it 'should return first news record' do
29
+ first_item = news.results.first
30
+
31
+ expect(first_item.type_name).to eq('News')
32
+ expect(first_item.uuid).to eq('527114a5b61a44989480eea5c4452800')
33
+ expect(first_item.author).to eq('Anthony Ha')
34
+ expect(first_item.title).to eq('Facebook says its ad transparency features will go live next month')
35
+ end
36
+
37
+ it 'should return last news record' do
38
+ first_item = news.results.last
39
+
40
+ expect(first_item.type_name).to eq('News')
41
+ expect(first_item.uuid).to eq('36474c1cd9acfc2717e1974fbc7f1bdb')
42
+ expect(first_item.author).to eq('Natasha Lomas')
43
+ expect(first_item.title).to eq('Teens favoring Snapchat and Instagram over Facebook, says eMarketer')
44
+ end
45
+ end
46
+
47
+ context 'the second page news of facebook' do
48
+ let(:page2_news) { New.organization_lists('facebook', page: 2) }
49
+
50
+ before :each do
51
+ result = search_results(page2_news_data, New)
52
+
53
+ allow(New).to receive(:organization_lists).and_return(result)
54
+ end
55
+
56
+ it 'should return 100 of total count with news' do
57
+ expect(page2_news.results.size).to eq(100)
58
+ end
59
+
60
+ it 'should paging values from news response' do
61
+ expect(page2_news.pages).to eq(2632)
62
+ expect(page2_news.current_page).to eq(2)
63
+ expect(page2_news.per_page).to eq(100)
64
+ end
65
+
66
+ it 'should return first news record' do
67
+ first_item = page2_news.results.first
68
+
69
+ expect(first_item.type_name).to eq('News')
70
+ expect(first_item.uuid).to eq('36474c1cd9acfc2717e1974fbc7f1bdb')
71
+ expect(first_item.author).to eq('Natasha Lomas')
72
+ expect(first_item.title).to eq('Teens favoring Snapchat and Instagram over Facebook, says eMarketer')
73
+ end
74
+
75
+ it 'should return last news record' do
76
+ first_item = page2_news.results.last
77
+
78
+ expect(first_item.type_name).to eq('News')
79
+ expect(first_item.uuid).to eq('21d29affc387006838577aba6e214430')
80
+ expect(first_item.author).to eq('Josh Constine')
81
+ expect(first_item.title).to eq('Facebook Messenger globally tests injecting display ads into inbox')
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -1,17 +1,37 @@
1
- require File.join(File.dirname(__FILE__), "../..", "spec_helper.rb")
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Crunchbase
4
4
  module Model
5
+ RSpec.describe Office do
6
+ let(:offices_data) { parse_json('offices', 'facebook') }
5
7
 
6
- describe Office, "#organization_lists" do
7
- begin
8
- results = Office.organization_lists("facebook").results
9
- results.collect {|e| puts e.name }
8
+ context 'offices of facebook' do
9
+ let(:offices) { Office.organization_lists('facebook') }
10
10
 
11
- rescue Exception => e
12
- puts e.message
11
+ before :each do
12
+ result = search_results(offices_data, Office)
13
+
14
+ allow(Office).to receive(:organization_lists).and_return(result)
15
+ end
16
+
17
+ it 'should return 1 of total count with offices' do
18
+ expect(offices.results.size).to eq(1)
19
+ end
20
+
21
+ it 'should paging values from offices response' do
22
+ expect(offices.pages).to eq(1)
23
+ expect(offices.current_page).to eq(1)
24
+ expect(offices.per_page).to eq(100)
25
+ end
26
+
27
+ it 'should return first office record' do
28
+ first_item = offices.results.first
29
+
30
+ expect(first_item.type_name).to eq('Address')
31
+ expect(first_item.uuid).to eq('daebcfe0115c38af678c04603cc9f00f')
32
+ expect(first_item.name).to eq('Headquarters')
33
+ end
13
34
  end
14
35
  end
15
-
16
36
  end
17
- end
37
+ end
@@ -1,72 +1,198 @@
1
- require File.join(File.dirname(__FILE__), "../..", "spec_helper.rb")
1
+ # frozen_string_literal: true
2
2
 
3
+ # disabled ModuleLength
3
4
  module Crunchbase
4
5
  module Model
6
+ RSpec.describe Organization do
7
+ let(:without_relationship_json_data) { parse_json('organizations', 'facebook-without-relationships') }
8
+ let(:with_relationship_json_data) { parse_json('organizations', 'facebook') }
9
+ let(:ekohe_data) { parse_json('organizations', 'ekohe') }
5
10
 
6
- describe Organization do
11
+ context 'facebook without relationships data' do
12
+ let(:without_organization) { Organization.get('facebook') }
7
13
 
8
- context "organization with i18n name" do
9
- before(:all) do
10
- @organization = Organization.get("bon-appétit")
14
+ before :each do
15
+ result = Organization.new(without_relationship_json_data)
16
+
17
+ allow(Organization).to receive(:get).and_return(result)
18
+ end
19
+
20
+ it 'should return facebook and Facebook from API' do
21
+ expect(without_organization.permalink).to eq('facebook')
22
+ expect(without_organization.name).to eq('Facebook')
11
23
  end
12
24
 
13
- it 'returns organization data' do
14
- expect(@organization.name).to eq("Bon Appétit")
25
+ it 'should return nil when without relationships' do
26
+ expect(without_organization.products.nil?).to be_truthy
27
+ expect(without_organization.offices.nil?).to be_truthy
28
+ expect(without_organization.headquarters.nil?).to be_truthy
29
+ expect(without_organization.funding_rounds.nil?).to be_truthy
30
+ expect(without_organization.competitors.nil?).to be_truthy
31
+ expect(without_organization.investments.nil?).to be_truthy
32
+ expect(without_organization.acquisitions.nil?).to be_truthy
33
+ expect(without_organization.ipo.nil?).to be_truthy
34
+ expect(without_organization.categories.nil?).to be_truthy
35
+ expect(without_organization.news.nil?).to be_truthy
36
+ expect(without_organization.current_team.nil?).to be_truthy
37
+ expect(without_organization.websites.nil?).to be_truthy
38
+ expect(without_organization.founders.nil?).to be_truthy
39
+ expect(without_organization.past_team.nil?).to be_truthy
40
+ expect(without_organization.board_members_and_advisors.nil?).to be_truthy
41
+ expect(without_organization.featured_team.nil?).to be_truthy
15
42
  end
16
43
  end
17
44
 
18
- context "TODO" do
19
- before(:all) do
20
- @organization = Organization.get("abovenet")
45
+ context 'facebook with relationships data' do
46
+ let(:organization) { Organization.get('facebook') }
47
+
48
+ before :each do
49
+ result = Organization.new(with_relationship_json_data)
50
+
51
+ allow(Organization).to receive(:get).and_return(result)
52
+ end
53
+
54
+ it 'should return facebook and Facebook from API' do
55
+ expect(organization.permalink).to eq('facebook')
56
+ expect(organization.name).to eq('Facebook')
57
+ end
58
+
59
+ it 'should return one primary_image' do
60
+ expect(organization.primary_image.nil?).to be_falsy
61
+ expect(organization.primary_image_total_items).to eq(1)
62
+ end
63
+
64
+ it 'should return 0 of products and competitors' do
65
+ expect(organization.products.size).to eq(0)
66
+ expect(organization.competitors.size).to eq(0)
67
+ end
68
+
69
+ it 'should return 1 of offices - OneToOne' do
70
+ expect(organization.offices.class).to eq(Office)
71
+ expect(organization.offices.nil?).to be_falsy
72
+ end
73
+
74
+ it 'should return 1 of headquarters - OneToOne' do
75
+ expect(organization.headquarters.class).to eq(Headquarter)
76
+ expect(organization.headquarters.nil?).to be_falsy
77
+ end
78
+
79
+ it 'should return 10 of funding_rounds' do
80
+ expect(organization.funding_rounds.size).to eq(10)
81
+ end
82
+
83
+ it 'should return 10 of investments' do
84
+ expect(organization.investments.size).to eq(10)
21
85
  end
22
86
 
23
- it 'show all products name' do
24
- puts @organization.products.map { |i| i.name }.inspect unless @organization.products.nil?
87
+ it 'should return 10 of acquisitions' do
88
+ expect(organization.acquisitions.size).to eq(10)
25
89
  end
26
90
 
27
- it 'show all offices name' do
28
- puts @organization.offices.map { |i| i.name }.inspect unless @organization.offices.nil?
91
+ it 'should return ipo relationship' do
92
+ expect(organization.ipo.nil?).to be_falsy
29
93
  end
30
94
 
31
- it 'show all funding_rounds funding_type' do
32
- puts @organization.funding_rounds.map { |i| i.funding_type }.inspect unless @organization.funding_rounds.nil?
95
+ it 'should return 3 of categories' do
96
+ expect(organization.categories.size).to eq(3)
33
97
  end
34
98
 
35
- it 'show all competitors name' do
36
- puts @organization.competitors.map { |i| i.name }.inspect unless @organization.competitors.nil?
99
+ it 'should return 0 of videos' do
100
+ expect(organization.videos.size).to eq(0)
101
+ expect(organization.videos_total_items).to eq(0)
37
102
  end
38
103
 
39
- it 'show all investments money_invested' do
40
- puts @organization.investments.map { |i| i.money_invested }.inspect unless @organization.investments.nil?
104
+ it 'should return 10 of news' do
105
+ expect(organization.news.size).to eq(10)
106
+ expect(organization.news_total_items).to eq(263177)
41
107
  end
42
108
 
43
- it 'show all acquisitions acquiree name' do
44
- puts @organization.acquisitions.map { |i| i.acquiree.name }.inspect unless @organization.acquisitions.nil?
109
+ it 'should return 10 of current_team' do
110
+ expect(organization.current_team.size).to eq(10)
45
111
  end
46
112
 
47
- it 'show all ipo funded_company name' do
48
- puts "IPOs - #{@organization.ipo_total_items.nil?}"
49
- puts @organization.ipo.map { |i| i.funded_company.name }.inspect unless @organization.ipo.nil?
113
+ it 'should return 4 of websites' do
114
+ expect(organization.websites.size).to eq(4)
50
115
  end
51
116
 
52
- it "show all categories name" do
53
- puts @organization.categories.map {|i| i.name }.inspect unless @organization.categories.nil?
117
+ it 'should return 10 of investors item and total pages count 20' do
118
+ expect(organization.investors.size).to eq(10)
119
+ expect(organization.investors_total_items).to eq(20)
54
120
  end
55
121
 
56
- it "show all news name" do
57
- puts @organization.news.map {|i| i.title }.inspect unless @organization.news.nil?
122
+ it 'should return 5 of founders' do
123
+ expect(organization.founders.size).to eq(5)
58
124
  end
59
125
 
60
- it "show all current_team members name" do
61
- puts @organization.current_team.map {|i| [i.title, i.person.last_name] }.inspect unless @organization.current_team.nil?
126
+ it 'should return 10 of past_team and total 420 of past team' do
127
+ expect(organization.past_team_total_items).to eq(420)
128
+ expect(organization.past_team.size).to eq(10)
62
129
  end
63
130
 
64
- it "show all websites website" do
65
- puts @organization.websites.map {|i| i.website }.inspect unless @organization.websites.nil?
131
+ it 'should return the first past_team information' do
132
+ first_member = organization.past_team[0]
133
+
134
+ expect(first_member.title).to eq('Software Engineer')
135
+ expect(first_member.uuid).to eq('009b372b0ee6bf03f60346b3a1730f41')
136
+ expect(first_member.person.first_name).to eq('Perry')
137
+ expect(first_member.person.last_name).to eq('Tam')
138
+ expect(first_member.person.permalink).to eq('perry-tam')
139
+ end
140
+
141
+ it 'should return 10 of board_members_and_advisors' do
142
+ expect(organization.board_members_and_advisors_total_items).to eq(10)
143
+ expect(organization.board_members_and_advisors.size).to eq(10)
144
+ end
145
+
146
+ it 'should return 6 of featured_team' do
147
+ expect(organization.featured_team_total_items).to eq(6)
148
+ expect(organization.featured_team.size).to eq(6)
149
+ end
150
+
151
+ context 'funding_rounds' do
152
+ it 'should return correctly data of the first funding round' do
153
+ first_funding_round = organization.funding_rounds[0]
154
+
155
+ expect(first_funding_round.uuid).to eq('37bd05f961af726ba3c1b279da842805')
156
+ expect(first_funding_round.funding_type).to eq('private_equity')
157
+ expect(first_funding_round.announced_on).to eq(Date.parse('2011-01-21'))
158
+ expect(first_funding_round.money_raised_currency_code).to eq('USD')
159
+ expect(first_funding_round.money_raised).to eq(1500000000)
160
+ expect(first_funding_round.money_raised_usd).to eq(1500000000)
161
+ expect(first_funding_round.investments.size).to eq(2)
162
+
163
+ expect(first_funding_round.investments[0].investors.name).to eq('DST Global')
164
+ expect(first_funding_round.investments[0].partners.size).to eq(1)
165
+ end
66
166
  end
67
167
  end
68
168
 
69
- end
169
+ context 'ekohe data' do
170
+ let(:ekohe) { Organization.get('ekohe') }
70
171
 
172
+ before :each do
173
+ result = Organization.new(ekohe_data)
174
+
175
+ allow(Organization).to receive(:get).and_return(result)
176
+ end
177
+
178
+ it 'should return ekohe information' do
179
+ expect(ekohe.name).to eq('Ekohe')
180
+ expect(ekohe.permalink).to eq('ekohe')
181
+ end
182
+
183
+ it 'should return ekohe relationships data' do
184
+ expect(ekohe.acquired_by.nil?).to be_truthy
185
+ expect(ekohe.products.empty?).to be_truthy
186
+ end
187
+ end
188
+
189
+ context 'mx-media-llc data' do
190
+ it 'should return Crunchbase::Exception with 404 as results' do
191
+ expect do
192
+ parse_json('organizations', 'mx-media-llc')
193
+ end.to raise_error(Crunchbase::Exception)
194
+ end
195
+ end
196
+ end
71
197
  end
72
198
  end