Skip to content

Commit

Permalink
allow setting of API keys for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
James McKinney committed Nov 7, 2012
1 parent 4d665c1 commit 6ed024b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -21,6 +21,7 @@ pkg
Gemfile.lock Gemfile.lock


## PROJECT::SPECIFIC ## PROJECT::SPECIFIC
spec/support/api_keys.rb


## YARD ## YARD
doc doc
Expand Down
25 changes: 16 additions & 9 deletions spec/spec_helper.rb
Expand Up @@ -3,6 +3,22 @@
require 'fakeweb' require 'fakeweb'
require File.dirname(__FILE__) + '/../lib/govkit' 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 # prevent the use of `` in tests
RSpec.configure do |c| RSpec.configure do |c|
end end
Expand All @@ -25,13 +41,4 @@ def rp(*args)
end end
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') 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.