Skip to content

Commit

Permalink
Refactory spec_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelp committed Sep 26, 2013
1 parent d66433a commit 3f15991
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
25 changes: 5 additions & 20 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

require 'bitstamp'

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

# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
Expand All @@ -19,23 +23,4 @@
# the seed, which is printed after each run.
# --seed 1234
config.order = 'random'

config.before(:all) {}
config.before(:each) do
# The famous singleton problem
Bitstamp.setup do |config|
config.key = nil
config.secret = nil
end
end
config.after(:all) {}
config.after(:each) {}
end

def read_bitstamp_yaml
Bitstamp.setup do |config|
raise "You must set environment variable BITSTAMP_KEY and BITSTAMP_SECRET with your username and password to run specs." if ENV['BITSTAMP_KEY'].nil? or ENV['BITSTAMP_SECRET'].nil?
config.key = ENV['BITSTAMP_KEY']
config.secret = ENV['BITSTAMP_SECRET']
end
end
end
17 changes: 17 additions & 0 deletions spec/support/bitstamp_setup.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
RSpec.configure do |config|
config.before(:each) do
# The famous singleton problem
Bitstamp.setup do |config|
config.key = nil
config.secret = nil
end
end
end

def read_bitstamp_yaml
Bitstamp.setup do |config|
raise "You must set environment variable BITSTAMP_KEY and BITSTAMP_SECRET with your username and password to run specs." if ENV['BITSTAMP_KEY'].nil? or ENV['BITSTAMP_SECRET'].nil?
config.key = ENV['BITSTAMP_KEY']
config.secret = ENV['BITSTAMP_SECRET']
end
end

0 comments on commit 3f15991

Please sign in to comment.