Remove -l arg from bash script

This commit is contained in:
jam 2014-01-07 14:37:22 -06:00
commit 2463be1f84
6 changed files with 72 additions and 6 deletions

View File

@ -31,12 +31,25 @@ describe MQRouter do
music_session_member1 = FactoryGirl.create(:connection, :user => user1, :music_session => music_session, :ip_address => "1.1.1.1", :client_id => "1")
music_session_member2 = FactoryGirl.create(:connection, :user => user2, :music_session => music_session, :ip_address => "2.2.2.2", :client_id => "2")
# this is necessary because other tests will call EM.schedule indirectly as they fiddle with AR models, since some of our
# notifications are tied to model activity. So, the issue here is that you'll have an unknown known amount of
# queued up messages ready to be sent to MQRouter (because EM.schedule will put deferred blocks onto @next_tick_queue),
# resulting in messages from other tests being sent to client_exchange or user_exchange
# there is no API I can see to clear out the EM queue. so just open up the EM module and do it manually
module EM
@next_tick_queue = []
end
EM.run do
# mock up exchange
MQRouter.client_exchange = double("client_exchange")
MQRouter.user_exchange = double("user_exchange")
MQRouter.client_exchange.should_receive(:publish).with("a message", :routing_key => "client.#{music_session_member2.client_id}")
MQRouter.user_exchange.should_not_receive(:publish)
@mq_router.user_publish_to_session(music_session, user1, "a message", :client_id => music_session_member1.client_id)

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

1
update
View File

@ -1,4 +1,5 @@
#!/bin/bash
set -e
echo ""

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)