sba 0.0.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.
Files changed (74) hide show
  1. data/.gitignore +41 -0
  2. data/.rspec +3 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.md +10 -0
  5. data/LICENSE.mkd +20 -0
  6. data/README.mkd +72 -0
  7. data/Rakefile +16 -0
  8. data/autotest/discover.rb +1 -0
  9. data/lib/faraday/multipart.rb +29 -0
  10. data/lib/faraday/raise_error.rb +31 -0
  11. data/lib/faraday/response/raise_error.rb +32 -0
  12. data/lib/sba.rb +51 -0
  13. data/lib/sba/client.rb +44 -0
  14. data/lib/sba/client/connection.rb +37 -0
  15. data/lib/sba/client/data.rb +73 -0
  16. data/lib/sba/client/licenses.rb +111 -0
  17. data/lib/sba/client/loans.rb +125 -0
  18. data/lib/sba/client/request.rb +37 -0
  19. data/lib/sba/client/sites.rb +71 -0
  20. data/lib/sba/client/urls.rb +134 -0
  21. data/lib/sba/configuration.rb +44 -0
  22. data/lib/sba/version.rb +3 -0
  23. data/sba.gemspec +37 -0
  24. data/spec/data_spec.rb +103 -0
  25. data/spec/fixtures/all_sites_keywords.json +1393 -0
  26. data/spec/fixtures/business_type_state.json +81 -0
  27. data/spec/fixtures/business_type_state_city.json +131 -0
  28. data/spec/fixtures/business_type_state_county.json +101 -0
  29. data/spec/fixtures/business_type_zip.json +111 -0
  30. data/spec/fixtures/by_business_type.json +601 -0
  31. data/spec/fixtures/by_state.json +71 -0
  32. data/spec/fixtures/city_links_for_state.json +30 -0
  33. data/spec/fixtures/data_city.json +87543 -0
  34. data/spec/fixtures/data_city_county.json +88355 -0
  35. data/spec/fixtures/data_county.json +813 -0
  36. data/spec/fixtures/data_specific_city.json +15 -0
  37. data/spec/fixtures/data_specific_county.json +2493 -0
  38. data/spec/fixtures/doing_business_as.json +591 -0
  39. data/spec/fixtures/employer_requirements.json +2211 -0
  40. data/spec/fixtures/entity_filing.json +551 -0
  41. data/spec/fixtures/federal_and_state_financing_for.json +973 -0
  42. data/spec/fixtures/loan_grants.json +901 -0
  43. data/spec/fixtures/loan_grants_by_industry_specialty.json +533 -0
  44. data/spec/fixtures/loan_grants_by_specialty.json +210 -0
  45. data/spec/fixtures/loan_grants_industry.json +324 -0
  46. data/spec/fixtures/loan_grants_state_ind_spec.json +381 -0
  47. data/spec/fixtures/loan_grants_state_industry.json +381 -0
  48. data/spec/fixtures/loan_grants_state_specialty.json +362 -0
  49. data/spec/fixtures/primary_url_for_athens.json +15 -0
  50. data/spec/fixtures/primary_url_for_clarke_county.json +29 -0
  51. data/spec/fixtures/rec_sites_categories.json +249 -0
  52. data/spec/fixtures/rec_sites_categories.xml +1 -0
  53. data/spec/fixtures/rec_sites_domain.json +9 -0
  54. data/spec/fixtures/rec_sites_domain.xml +1 -0
  55. data/spec/fixtures/rec_sites_keyword.json +17 -0
  56. data/spec/fixtures/rec_sites_keywords.xml +1 -0
  57. data/spec/fixtures/rec_sites_master_term.json +9 -0
  58. data/spec/fixtures/rec_sites_master_term.xml +1 -0
  59. data/spec/fixtures/state_financing_for.json +73 -0
  60. data/spec/fixtures/state_licenses.json +11191 -0
  61. data/spec/fixtures/tax_registration.json +1101 -0
  62. data/spec/fixtures/url_city.json +6063 -0
  63. data/spec/fixtures/url_city_county.json +6875 -0
  64. data/spec/fixtures/url_county.json +813 -0
  65. data/spec/fixtures/url_specific_city.json +141 -0
  66. data/spec/fixtures/url_specific_county.json +477 -0
  67. data/spec/helper.rb +27 -0
  68. data/spec/licenses_spec.rb +148 -0
  69. data/spec/loans_spec.rb +193 -0
  70. data/spec/sba_ruby/client_spec.rb +8 -0
  71. data/spec/sba_spec.rb +9 -0
  72. data/spec/sites_spec.rb +101 -0
  73. data/spec/urls_spec.rb +188 -0
  74. metadata +345 -0
@@ -0,0 +1,27 @@
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_group 'SBA', 'lib/sba'
4
+ add_group 'Faraday', 'lib/faraday'
5
+ end
6
+
7
+ require File.expand_path('../../lib/sba', __FILE__)
8
+ require 'rspec'
9
+ require 'webmock/rspec'
10
+
11
+ require 'sba'
12
+
13
+ RSpec.configure do |config|
14
+ config.include WebMock::API
15
+ end
16
+
17
+ def stub_get(path)
18
+ stub_request(:get, 'http://api.sba.gov/' + path)
19
+ end
20
+
21
+ def fixture_path
22
+ File.expand_path("../fixtures", __FILE__)
23
+ end
24
+
25
+ def fixture(file)
26
+ File.new(fixture_path + '/' + file)
27
+ end
@@ -0,0 +1,148 @@
1
+ require 'helper'
2
+
3
+ describe SBA do
4
+
5
+ describe "#by_category" do
6
+ before do
7
+ stub_request(:get, 'http://api.sba.gov/license_permit/by_category/doing%20business%20as.json').
8
+ with().
9
+ to_return(:body => fixture('doing_business_as.json'),
10
+ :headers => {'Content-Type' => 'application/json'})
11
+ end
12
+ it "should request the correct resource" do
13
+ SBA.by_category('doing business as')
14
+ a_request(:get, 'http://api.sba.gov/license_permit/by_category/doing%20business%20as.json').
15
+ with().
16
+ should have_been_made
17
+ end
18
+ it "should return the correct results" do
19
+ test = SBA.by_category('doing business as')
20
+ test.should be_a Hash
21
+ test["category_site"][1]["url"].should == "http://www.dced.state.ak.us/bsc/register.html"
22
+ end
23
+ end
24
+
25
+ describe "#by_state" do
26
+ before do
27
+ @path = "http://api.sba.gov/license_permit/all_by_state/CA.json?format=json"
28
+ stub_request(:get, @path).
29
+ with().
30
+ to_return(:body => fixture('by_state.json'),
31
+ :headers => {'Content-Type' => 'application/json'})
32
+ end
33
+ it "should request the correct resource" do
34
+ SBA.by_state("CA")
35
+ a_request(:get, @path).
36
+ with().
37
+ should have_been_made
38
+ end
39
+ it "should return the correct results" do
40
+ test = SBA.by_state("CA")
41
+ test.should be_a Hash
42
+ test["state_site"][0]["title"].should == "Obtain Disability Insurance"
43
+ end
44
+ end
45
+
46
+ describe "#by_business_type" do
47
+ before do
48
+ stub_request(:get, 'http://api.sba.gov/license_permit/by_business_type/child%20care%20services.json').
49
+ with().
50
+ to_return(:body => fixture('by_business_type.json'),
51
+ :headers => {'Content-Type' => 'application/json'})
52
+ end
53
+ it "should request the correct resource" do
54
+ SBA.by_business_type("child care services")
55
+ a_request(:get, 'http://api.sba.gov/license_permit/by_business_type/child%20care%20services.json').
56
+ with().
57
+ should have_been_made
58
+ end
59
+ it "should return the correct results" do
60
+ test = SBA.by_business_type("child care services")
61
+ test.should be_an Hash
62
+ test["business_type_site"][0]["url"].should == "http://www.hss.state.ak.us/dpa/programs/ccare/become_a_provider.htm"
63
+ test["business_type_site"][1]["url"].should == "http://www.azdhs.gov/als/childcare/"
64
+ end
65
+ end
66
+
67
+ describe "#business_type_state" do
68
+ before do
69
+ stub_request(:get, 'http://api.sba.gov/license_permit/state_only/child%20care%20services/va.json').
70
+ with().
71
+ to_return(:body => fixture('business_type_state.json'),
72
+ :headers => {'Content-Type' => 'application/json'})
73
+ end
74
+ it "should request the correct resource" do
75
+ SBA.business_type_state("child care services", "va")
76
+ a_request(:get, 'http://api.sba.gov/license_permit/state_only/child%20care%20services/va.json').
77
+ with().
78
+ should have_been_made
79
+ end
80
+ it "should return the correct results" do
81
+ test = SBA.business_type_state("child care services", "va")
82
+ test.should be_an Hash
83
+ test["state_site"][0]["url"].should == "http://www.vec.virginia.gov/vecportal/unins/insunemp.cfm"
84
+ end
85
+ end
86
+
87
+ describe "#business_type_state_county" do
88
+ before do
89
+ stub_request(:get, 'http://api.sba.gov/license_permit/state_and_county/child%20care%20services/ca/los%20angeles%20county.json').
90
+ with().
91
+ to_return(:body => fixture('business_type_state_county.json'),
92
+ :headers => {'Content-Type' => 'application/json'})
93
+ end
94
+ it "should request the correct resource" do
95
+ SBA.business_type_state_county("child care services", "ca", "los angeles county")
96
+ a_request(:get, 'http://api.sba.gov/license_permit/state_and_county/child%20care%20services/ca/los%20angeles%20county.json').
97
+ with().
98
+ should have_been_made
99
+ end
100
+ it "should return the correct results" do
101
+ test = SBA.business_type_state_county("child care services", "ca", "los angeles county")
102
+ test.should be_an Hash
103
+ test["state_site"][0]["url"].should == "http://www.edd.ca.gov/Disability/"
104
+ end
105
+ end
106
+
107
+ describe "#business_type_state_city" do
108
+ before do
109
+ stub_request(:get, 'http://api.sba.gov/license_permit/state_and_city/restaurant/ny/albany.json').
110
+ with().
111
+ to_return(:body => fixture('business_type_state_city.json'),
112
+ :headers => {'Content-Type' => 'application/json'})
113
+ end
114
+ it "should request the correct resource" do
115
+ SBA.business_type_state_city("restaurant", "ny", "albany")
116
+ a_request(:get, 'http://api.sba.gov/license_permit/state_and_city/restaurant/ny/albany.json').
117
+ with().
118
+ should have_been_made
119
+ end
120
+ it "should return the correct results" do
121
+ test = SBA.business_type_state_city("restaurant", "ny", "albany")
122
+ test.should be_an Hash
123
+ test["state_site"][0]["url"].should == "http://www.wcb.state.ny.us/content/main/DisabilityBenefits/Employer/introToLaw.jsp"
124
+ test["state_site"][1]["url"].should == "http://www.labor.state.ny.us/ui/dande/register1.shtm"
125
+ end
126
+ end
127
+
128
+ describe "#business_type_zip" do
129
+ before do
130
+ stub_request(:get, 'http://api.sba.gov/license_permit/by_zip/restaurant/49684.json').
131
+ with().
132
+ to_return(:body => fixture('business_type_zip.json'),
133
+ :headers => {'Content-Type' => 'application/json'})
134
+ end
135
+ it "should request the correct resource" do
136
+ SBA.business_type_zip("restaurant","49684")
137
+ a_request(:get, 'http://api.sba.gov/license_permit/by_zip/restaurant/49684.json').
138
+ with().
139
+ should have_been_made
140
+ end
141
+ it "should return the correct results" do
142
+ test = SBA.business_type_zip("restaurant","49684")
143
+ test.should be_an Hash
144
+ test["state_site"][0]["url"].should == "http://www.michigan.gov/uia/0,1607,7-118-26898---,00.html"
145
+ test["state_site"][1]["url"].should == "http://www.michigan.gov/wca/0,1607,7-191-26925---,00.html"
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,193 @@
1
+ require 'helper'
2
+
3
+ describe SBA do
4
+ describe "loan_grants_by_federal" do
5
+ before do
6
+ stub_request(:get, 'http://api.sba.gov/loans_grants/federal.json').
7
+ with().
8
+ to_return(:body => fixture('loan_grants.json'),
9
+ :headers => {'Content-Type' => 'application/json'})
10
+ end
11
+ it "should request the correct resource" do
12
+ SBA.loan_grants_by_federal()
13
+ a_request(:get, 'http://api.sba.gov/loans_grants/federal.json').
14
+ with().
15
+ should have_been_made
16
+ end
17
+ it "should return the correct results" do
18
+ test = SBA.loan_grants_by_federal()
19
+ test.should be_an Array
20
+ test[0]["title"].should == "Emergency Farm Loans"
21
+ test[1]["title"].should == "Economic Injury Loans"
22
+ end
23
+ end
24
+
25
+ describe "loan_grants_by_state" do
26
+ before do
27
+ stub_request(:get, 'http://api.sba.gov/loans_grants/state_financing_for/ca.json').
28
+ with().
29
+ to_return(:body => fixture('state_financing_for.json'),
30
+ :headers => {'Content-Type' => 'application/json'})
31
+ end
32
+ it "should request the correct resource" do
33
+ SBA.loan_grants_by_state("ca")
34
+ a_request(:get, 'http://api.sba.gov/loans_grants/state_financing_for/ca.json').
35
+ with().
36
+ should have_been_made
37
+ end
38
+ it "should return the correct results" do
39
+ test = SBA.loan_grants_by_state("ca")
40
+ test.should be_an Array
41
+ test[0]["title"].should == "Small Business Loan Guarantee Program"
42
+ end
43
+ end
44
+
45
+ describe "loan_grants_by_federal_state" do
46
+ before do
47
+ stub_request(:get, 'http://api.sba.gov/loans_grants/federal_and_state_financing_for/ca.json').
48
+ with().
49
+ to_return(:body => fixture('federal_and_state_financing_for.json'),
50
+ :headers => {'Content-Type' => 'application/json'})
51
+ end
52
+ it "should request the correct resource" do
53
+ SBA.loan_grants_by_federal_state("ca")
54
+ a_request(:get, 'http://api.sba.gov/loans_grants/federal_and_state_financing_for/ca.json').
55
+ with().
56
+ should have_been_made
57
+ end
58
+ it "should return the correct results" do
59
+ test = SBA.loan_grants_by_federal_state("ca")
60
+ test.should be_an Array
61
+ test[0]["title"].should == "Emergency Farm Loans"
62
+ test[1]["title"].should == "Economic Injury Loans"
63
+ end
64
+ end
65
+
66
+ describe "loan_grants_by_industry" do
67
+ before do
68
+ stub_request(:get, 'http://api.sba.gov/loans_grants/nil/for_profit/manufacturing/nil.json').
69
+ with().
70
+ to_return(:body => fixture('loan_grants_industry.json'),
71
+ :headers => {'Content-Type' => 'application/json'})
72
+ end
73
+ it "should request the correct resource" do
74
+ SBA.loan_grants_by_industry("manufacturing")
75
+ a_request(:get, 'http://api.sba.gov/loans_grants/nil/for_profit/manufacturing/nil.json').
76
+ with().
77
+ should have_been_made
78
+ end
79
+ it "should return the correct results" do
80
+ test = SBA.loan_grants_by_industry("manufacturing")
81
+ test.should be_an Array
82
+ test[0]["title"].should == "Small Manufacturers Competitiveness Fund (SMCF)"
83
+ test[1]["title"].should == "Manufacturing Modernization Loan Program "
84
+ end
85
+ end
86
+
87
+ describe "loan_grants_by_specialty" do
88
+ before do
89
+ stub_request(:get, 'http://api.sba.gov/loans_grants/nil/for_profit/nil/woman.json').
90
+ with().
91
+ to_return(:body => fixture('loan_grants_by_specialty.json'),
92
+ :headers => {'Content-Type' => 'application/json'})
93
+ end
94
+ it "should request the correct resource" do
95
+ SBA.loan_grants_by_specialty("woman")
96
+ a_request(:get, 'http://api.sba.gov/loans_grants/nil/for_profit/nil/woman.json').
97
+ with().
98
+ should have_been_made
99
+ end
100
+ it "should return the correct results" do
101
+ test = SBA.loan_grants_by_specialty("woman")
102
+ test.should be_an Array
103
+ test[0]["title"].should == "Delaware Access Program"
104
+ test[1]["title"].should == "Minority, Women, and Disabled Participation Loan Program"
105
+ end
106
+ end
107
+
108
+ describe "loan_grants_by_industry_specialty" do
109
+ before do
110
+ stub_request(:get, 'http://api.sba.gov/loans_grants/nil/for_profit/manufacturing/woman.json').
111
+ with().
112
+ to_return(:body => fixture('loan_grants_by_industry_specialty.json'),
113
+ :headers => {'Content-Type' => 'application/json'})
114
+ end
115
+ it "should request the correct resource" do
116
+ SBA.loan_grants_by_industry_specialty("manufacturing","woman")
117
+ a_request(:get, 'http://api.sba.gov/loans_grants/nil/for_profit/manufacturing/woman.json').
118
+ with().
119
+ should have_been_made
120
+ end
121
+ it "should return the correct results" do
122
+ test = SBA.loan_grants_by_industry_specialty("manufacturing","woman")
123
+ test.should be_an Array
124
+ test[0]["title"].should == "Delaware Access Program"
125
+ test[1]["title"].should == "Minority, Women, and Disabled Participation Loan Program"
126
+ end
127
+ end
128
+
129
+ describe "loan_grants_by_state_industry" do
130
+ before do
131
+ stub_request(:get, 'http://api.sba.gov/loans_grants/me/for_profit/manufacturing/nil.json').
132
+ with().
133
+ to_return(:body => fixture('loan_grants_state_industry.json'),
134
+ :headers => {'Content-Type' => 'application/json'})
135
+ end
136
+ it "should request the correct resource" do
137
+ SBA.loan_grants_by_state_industry("me","manufacturing")
138
+ a_request(:get, 'http://api.sba.gov/loans_grants/me/for_profit/manufacturing/nil.json').
139
+ with().
140
+ should have_been_made
141
+ end
142
+ it "should return the correct results" do
143
+ test = SBA.loan_grants_by_state_industry("me","manufacturing")
144
+ test.should be_an Array
145
+ test[0]["title"].should == "Economic Recovery Loan"
146
+ test[1]["title"].should == "Intermediary Relending Program"
147
+ end
148
+ end
149
+
150
+ describe "loan_grants_by_state_specialty" do
151
+ before do
152
+ stub_request(:get, 'http://api.sba.gov/loans_grants/ny/for_profit/nil/general_purpose.json').
153
+ with().
154
+ to_return(:body => fixture('loan_grants_state_specialty.json'),
155
+ :headers => {'Content-Type' => 'application/json'})
156
+ end
157
+ it "should request the correct resource" do
158
+ SBA.loan_grants_by_state_specialty("ny","general_purpose")
159
+ a_request(:get, 'http://api.sba.gov/loans_grants/ny/for_profit/nil/general_purpose.json').
160
+ with().
161
+ should have_been_made
162
+ end
163
+ it "should return the correct results" do
164
+ test = SBA.loan_grants_by_state_specialty("ny","general_purpose")
165
+ test.should be_an Array
166
+ test[0]["title"].should == "Micro Loans for Minority and Women Owned Businesses"
167
+ test[1]["title"].should == "Statewide Zone Capital Corporation of New York"
168
+ end
169
+ end
170
+
171
+ describe "loan_grants_by_state_industry_specialty" do
172
+ before do
173
+ stub_request(:get, 'http://api.sba.gov/loans_grants/me/for_profit/manufacturing/woman.json').
174
+ with().
175
+ to_return(:body => fixture('loan_grants_state_ind_spec.json'),
176
+ :headers => {'Content-Type' => 'application/json'})
177
+ end
178
+ it "should request the correct resource" do
179
+ SBA.loan_grants_by_state_industry_specialty("me","manufacturing", "woman")
180
+ a_request(:get, 'http://api.sba.gov/loans_grants/me/for_profit/manufacturing/woman.json').
181
+ with().
182
+ should have_been_made
183
+ end
184
+ it "should return the correct results" do
185
+ test = SBA.loan_grants_by_state_industry_specialty("me","manufacturing", "woman")
186
+ test.should be_an Array
187
+ test[0]["title"].should == "Economic Recovery Loan"
188
+ test[1]["title"].should == "Intermediary Relending Program"
189
+ end
190
+ end
191
+
192
+ end
193
+
@@ -0,0 +1,8 @@
1
+ require 'helper'
2
+
3
+ describe SBA::Client do
4
+ before do
5
+ @client = SBA::Client.new
6
+ end
7
+
8
+ end
@@ -0,0 +1,9 @@
1
+ require 'helper'
2
+
3
+ describe SBA do
4
+ describe ".client" do
5
+ it "should be a SBA::Client" do
6
+ SBA.client.should be_a SBA::Client
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,101 @@
1
+ require 'helper'
2
+
3
+ describe SBA, ".all_sites" do
4
+ before do
5
+ stub_request(:get, 'http://api.sba.gov/rec_sites/all_sites/keywords.json').
6
+ to_return(:body => fixture('all_sites_keywords.json'), :headers => {'Content-Type' => 'text/json; charset=utf-8'})
7
+ end
8
+
9
+ it "should request the correct resource" do
10
+ SBA.all_sites()
11
+ a_request(:get, 'http://api.sba.gov/rec_sites/all_sites/keywords.json').
12
+ should have_been_made
13
+ end
14
+
15
+ it "should return the correct results" do
16
+ test = SBA.all_sites()
17
+ test.should be_a Hash
18
+ test["recommended_sites_item150"][0]["title"] == "Tax Help and Training"
19
+ end
20
+ end
21
+
22
+ describe ".sites_by_keywords" do
23
+ before do
24
+ stub_request(:get, 'http://api.sba.gov/rec_sites/keywords/contracting.json').
25
+ with().
26
+ to_return(:body => fixture('rec_sites_keyword.json'),
27
+ :headers => {'Content-Type' => 'application/json'})
28
+ end
29
+ it "should request the correct resource" do
30
+ SBA.sites_by_keyword("contracting")
31
+ a_request(:get, 'http://api.sba.gov/rec_sites/keywords/contracting.json').
32
+ with().
33
+ should have_been_made
34
+ end
35
+ it "should return the correct results" do
36
+ test = SBA.sites_by_keyword("contracting")
37
+ test.should be_a Hash
38
+ test["recommended_sites_item0"][0]["title"] == "How to Find Contracting Opportunities"
39
+ end
40
+ end
41
+
42
+ describe ".sites_by_category" do
43
+ before do
44
+ stub_request(:get, 'http://api.sba.gov/rec_sites/category/managing%20a%20business.json').
45
+ with().
46
+ to_return(:body => fixture('rec_sites_categories.json'),
47
+ :headers => {'Content-Type' => 'application/json'})
48
+ end
49
+ it "should request the correct resource" do
50
+ SBA.sites_by_category("managing a business")
51
+ a_request(:get, 'http://api.sba.gov/rec_sites/category/managing%20a%20business.json').
52
+ with().
53
+ should have_been_made
54
+ end
55
+ it "should return the correct results" do
56
+ test = SBA.sites_by_category("managing a business")
57
+ test.should be_a Hash
58
+ test["recommended_sites_item5"][0]["title"] == "Demographics and Population Statistics"
59
+ end
60
+ end
61
+
62
+ describe ".sites_by_master_term" do
63
+ before do
64
+ stub_request(:get, 'http://api.sba.gov/rec_sites/keywords/master_term/export.json').
65
+ with().
66
+ to_return(:body => fixture('rec_sites_master_term.json'),
67
+ :headers => {'Content-Type' => 'application/json'})
68
+ end
69
+ it "should request the correct resource" do
70
+ SBA.sites_by_master_term("export")
71
+ a_request(:get, 'http://api.sba.gov/rec_sites/keywords/master_term/export.json').
72
+ with().
73
+ should have_been_made
74
+ end
75
+ it "should return the correct results" do
76
+ test = SBA.sites_by_master_term("export")
77
+ test.should be_a Hash
78
+ test["recommended_sites_item0"][0]["url"] == "http://www.sba.gov/content/exporting-and-importing"
79
+ end
80
+ end
81
+
82
+ describe ".sites_by_domain" do
83
+ before do
84
+ stub_request(:get, 'http://api.sba.gov/rec_sites/keywords/domain/irs.json').
85
+ with().
86
+ to_return(:body => fixture('rec_sites_domain.json'),
87
+ :headers => {'Content-Type' => 'application/json'})
88
+ end
89
+ it "should request the correct resource" do
90
+ SBA.sites_by_domain("irs")
91
+ a_request(:get, 'http://api.sba.gov/rec_sites/keywords/domain/irs.json').
92
+ with().
93
+ should have_been_made
94
+ end
95
+ it "should return the correct results" do
96
+ test = SBA.sites_by_domain("irs")
97
+ test.should be_a Hash
98
+ test["recommended_sites_item0"][0]["url"] == "http://www.irs.gov/businesses/small/article/0,,id=98277,00.html"
99
+ end
100
+ end
101
+