Skip to content

Commit

Permalink
move test ENV variables
Browse files Browse the repository at this point in the history
  • Loading branch information
cantino committed Aug 7, 2014
1 parent 78f6150 commit c3944cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions spec/env.test
@@ -0,0 +1,5 @@
APP_SECRET_TOKEN=notarealappsecrettoken
TWITTER_OAUTH_KEY=twitteroauthkey
TWITTER_OAUTH_SECRET=twitteroauthsecret
THIRTY_SEVEN_SIGNALS_OAUTH_KEY=TESTKEY
THIRTY_SEVEN_SIGNALS_OAUTH_SECRET=TESTSECRET
2 changes: 0 additions & 2 deletions spec/models/service_spec.rb
Expand Up @@ -59,8 +59,6 @@
stub_request(:post, "https://launchpad.37signals.com/authorization/token?client_id=TESTKEY&client_secret=TESTSECRET&refresh_token=refreshtokentest&type=refresh").
to_return(:status => 200, :body => '{"expires_in":1209600,"access_token": "NEWTOKEN"}', :headers => {})
@service.provider = '37signals'
ENV['THIRTY_SEVEN_SIGNALS_OAUTH_KEY'] = 'TESTKEY'
ENV['THIRTY_SEVEN_SIGNALS_OAUTH_SECRET'] = 'TESTSECRET'
@service.refresh_token = 'refreshtokentest'
@service.refresh_token!
@service.token.should == 'NEWTOKEN'
Expand Down
7 changes: 5 additions & 2 deletions spec/spec_helper.rb
@@ -1,4 +1,3 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'

if ENV['COVERAGE']
Expand All @@ -9,6 +8,10 @@
Coveralls.wear!('rails')
end

# Required ENV variables that are normally set in .env are setup here for the test environment.
require 'dotenv'
Dotenv.load File.join(File.dirname(__FILE__), "env.test")

require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
Expand All @@ -19,7 +22,7 @@

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

ActiveRecord::Migration.maintain_test_schema!

Expand Down

0 comments on commit c3944cc

Please sign in to comment.