Permalink
Browse files

allow setting of API keys for tests

  • Loading branch information...
1 parent 4d665c1 commit 6ed024b6e7e2bcf4cf10ca63f8d722a7d47a310b @jpmckinney jpmckinney committed Nov 7, 2012
Showing with 17 additions and 9 deletions.
  1. +1 −0 .gitignore
  2. +16 −9 spec/spec_helper.rb
View
@@ -21,6 +21,7 @@ pkg
Gemfile.lock
## PROJECT::SPECIFIC
+spec/support/api_keys.rb
## YARD
doc
View
@@ -3,6 +3,22 @@
require 'fakeweb'
require File.dirname(__FILE__) + '/../lib/govkit'
+# Set to true to run tests against the live URLs, and add the following to
+# spec/support/api_keys.rb:
+#
+# unless FakeWeb.allow_net_connect?
+# GovKit.configure do |config|
+# config.sunlight_apikey = 'YOUR_SUNLIGHT_API_KEY'
+# config.votesmart_apikey = 'YOUR_VOTESMART_API_KEY'
+# config.ftm_apikey = 'YOUR_FTM_API_KEY'
+# end
+# end
+FakeWeb.allow_net_connect = false
+
+# Requires supporting ruby files with custom matchers and macros, etc,
+# in spec/support/ and its subdirectories.
+Dir[File.join(File.dirname(__FILE__), 'support', '**', '*.rb')].each {|f| require f}
+
# prevent the use of `` in tests
RSpec.configure do |c|
end
@@ -25,13 +41,4 @@ def rp(*args)
end
end
-# Set to true to run tests against the live URLs
-FakeWeb.allow_net_connect = false
-
FIXTURES_DIR = File.join(File.dirname(__FILE__), 'fixtures')
-
-GovKit.configure do |config|
- config.openstates_apikey = 'YOUR_OPENSTATES_API_KEY'
- config.votesmart_apikey = 'YOUR_VOTESMART_API_KEY'
- config.ftm_apikey = 'YOUR_FTM_API_KEY'
-end

0 comments on commit 6ed024b

Please sign in to comment.