VRFS-923 - pushing a pretend delete. will review Jenkins

This commit is contained in:
Anthony Davis 2014-01-07 13:40:26 -06:00
parent 9045e82530
commit 8b3d1abd5c
4 changed files with 58 additions and 6 deletions

View File

@ -78,6 +78,10 @@ Spork.prefork do
DatabaseCleaner.clean
end
config.after(:suite) do
wipe_s3_test_bucket
end
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.

View File

@ -1,8 +1,9 @@
JAMKAZAM_TESTING_BUCKET = 'jamkazam-testing' # cuz i'm not comfortable using aws_bucket accessor directly
def app_config
klass = Class.new do
def aws_bucket
'jamkazam-testing'
JAMKAZAM_TESTING_BUCKET
end
def aws_access_key_id
@ -15,4 +16,16 @@ def app_config
end
return klass.new
end
def wipe_s3_test_bucket
test_config = app_config
s3 = AWS::S3.new(:access_key_id => test_config.aws_access_key_id,
:secret_access_key => test_config.aws_secret_access_key)
test_bucket = s3.buckets[JAMKAZAM_TESTING_BUCKET]
if test_bucket.name == JAMKAZAM_TESTING_BUCKET
puts "Ruby - Pretending to delete all contents of #{test_bucket.name}"
#test_bucket.delete_all
end
end

View File

@ -99,10 +99,11 @@ Spork.prefork do
config.include Snapshot
config.before(:suite) do
set_up_snapshot
end
config.before(:all) do
set_up_snapshot
end
config.before(:each) do
@ -120,10 +121,6 @@ Spork.prefork do
config.before(:each, :js => true) do
end
config.before(:each) do
end
config.append_after(:each) do
Capybara.reset_sessions!
@ -144,7 +141,12 @@ Spork.prefork do
end
config.after(:all) do
end
config.after(:suite) do
tear_down_snapshot
wipe_s3_test_bucket
end
end
end

View File

@ -29,6 +29,39 @@ def cookie_jar
Capybara.current_session.driver.browser.current_session.instance_variable_get(:@rack_mock_session).cookie_jar
end
#these S3 functions copied from ruby/spec/support/utilities.rb
JAMKAZAM_TESTING_BUCKET = 'jamkazam-testing' # cuz i'm not comfortable using aws_bucket accessor directly
def app_config
klass = Class.new do
def aws_bucket
JAMKAZAM_TESTING_BUCKET
end
def aws_access_key_id
'AKIAJESQY24TOT542UHQ'
end
def aws_secret_access_key
'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'
end
end
return klass.new
end
def wipe_s3_test_bucket
test_config = app_config
s3 = AWS::S3.new(:access_key_id => test_config.aws_access_key_id,
:secret_access_key => test_config.aws_secret_access_key)
test_bucket = s3.buckets[JAMKAZAM_TESTING_BUCKET]
if test_bucket.name == JAMKAZAM_TESTING_BUCKET
puts "Web - Pretending to delete all contents of #{test_bucket.name}"
#test_bucket.delete_all
end
end
# --end of S3 methods copied from ruby/spec/support/utilities.rb
def sign_in(user)