forked from AuthorizeNet/sdk-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add shared spec helper with credentials loading function
- Loading branch information
Marcin Kot
committed
Oct 15, 2014
1 parent
fc744a5
commit c579921
Showing
3 changed files
with
14 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
require "authorize_net" | ||
require "yaml" | ||
|
||
Dir['./spec/support/**/*.rb'].each{ |f| require f } | ||
|
||
RSpec.configure do |config| | ||
config.before(:suite) do | ||
begin | ||
CREDENTIALS = YAML.load_file(File.dirname(__FILE__) + "/credentials.yml") | ||
rescue Errno::ENOENT | ||
warn "WARNING: Running w/o valid AuthorizeNet sandbox credentials. Create spec/credentials.yml." | ||
end | ||
end | ||
config.include SharedHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module SharedHelper | ||
def credentials | ||
$credentials ||= YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml") | ||
rescue Errno::ENOENT | ||
warn "WARNING: Running w/o valid AuthorizeNet sandbox credentials. Create spec/credentials.yml." | ||
end | ||
end |