diff --git a/spec/env.test b/spec/env.test new file mode 100644 index 0000000000..c086797c3b --- /dev/null +++ b/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 diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb index 1f8dddc04a..32387b58a5 100644 --- a/spec/models/service_spec.rb +++ b/spec/models/service_spec.rb @@ -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' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f4fa126ef5..27ef928648 100644 --- a/spec/spec_helper.rb +++ b/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'] @@ -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' @@ -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!