Remove -l arg from bash script
This commit is contained in:
commit
2463be1f84
|
|
@ -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_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")
|
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
|
EM.run do
|
||||||
|
|
||||||
# mock up exchange
|
# mock up exchange
|
||||||
MQRouter.client_exchange = double("client_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.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)
|
@mq_router.user_publish_to_session(music_session, user1, "a message", :client_id => music_session_member1.client_id)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,10 @@ Spork.prefork do
|
||||||
DatabaseCleaner.clean
|
DatabaseCleaner.clean
|
||||||
end
|
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
|
# 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
|
# examples within a transaction, remove the following line or assign false
|
||||||
# instead of true.
|
# instead of true.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
|
JAMKAZAM_TESTING_BUCKET = 'jamkazam-testing' # cuz i'm not comfortable using aws_bucket accessor directly
|
||||||
|
|
||||||
def app_config
|
def app_config
|
||||||
klass = Class.new do
|
klass = Class.new do
|
||||||
def aws_bucket
|
def aws_bucket
|
||||||
'jamkazam-testing'
|
JAMKAZAM_TESTING_BUCKET
|
||||||
end
|
end
|
||||||
|
|
||||||
def aws_access_key_id
|
def aws_access_key_id
|
||||||
|
|
@ -16,3 +17,15 @@ def app_config
|
||||||
|
|
||||||
return klass.new
|
return klass.new
|
||||||
end
|
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
|
||||||
|
|
@ -99,10 +99,11 @@ Spork.prefork do
|
||||||
config.include Snapshot
|
config.include Snapshot
|
||||||
|
|
||||||
config.before(:suite) do
|
config.before(:suite) do
|
||||||
|
set_up_snapshot
|
||||||
end
|
end
|
||||||
|
|
||||||
config.before(:all) do
|
config.before(:all) do
|
||||||
set_up_snapshot
|
|
||||||
end
|
end
|
||||||
|
|
||||||
config.before(:each) do
|
config.before(:each) do
|
||||||
|
|
@ -120,10 +121,6 @@ Spork.prefork do
|
||||||
config.before(:each, :js => true) do
|
config.before(:each, :js => true) do
|
||||||
end
|
end
|
||||||
|
|
||||||
config.before(:each) do
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
config.append_after(:each) do
|
config.append_after(:each) do
|
||||||
|
|
||||||
Capybara.reset_sessions!
|
Capybara.reset_sessions!
|
||||||
|
|
@ -144,7 +141,12 @@ Spork.prefork do
|
||||||
end
|
end
|
||||||
|
|
||||||
config.after(:all) do
|
config.after(:all) do
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
config.after(:suite) do
|
||||||
tear_down_snapshot
|
tear_down_snapshot
|
||||||
|
wipe_s3_test_bucket
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,39 @@ def cookie_jar
|
||||||
Capybara.current_session.driver.browser.current_session.instance_variable_get(:@rack_mock_session).cookie_jar
|
Capybara.current_session.driver.browser.current_session.instance_variable_get(:@rack_mock_session).cookie_jar
|
||||||
end
|
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
|
||||||
|
'h0V0ffr3JOp/UtgaGrRfAk25KHNiO9gm8Pj9m6v3'
|
||||||
|
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)
|
def sign_in(user)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue