spec: kill enable_jobs{} helper

the implementation was rife with potential race conditions, and active
records query cache doesn't play nicely with threading.

Change-Id: I0e1c3d5cc05ad78e2f91f304490e6a1b5a925ab2
Reviewed-on: https://gerrit.instructure.com/18880
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
This commit is contained in:
Jacob Fugal 2013-03-21 15:56:02 -06:00
parent de9d56b7f0
commit 3399c417a2
3 changed files with 6 additions and 21 deletions

View File

@ -41,11 +41,10 @@ shared_examples_for "conversations attachments selenium tests" do
add_recipient("student1")
add_recipient("student2")
add_recipient("student3")
enable_jobs do
expect {
submit_message_form(:attachments => [fullpath], :add_recipient => false, :group_conversation => false)
}.to change(Attachment, :count).by(1)
end
ConversationBatch.any_instance.stubs(:mode).returns(:sync)
expect {
submit_message_form(:attachments => [fullpath], :add_recipient => false, :group_conversation => false)
}.to change(Attachment, :count).by(1)
end
it "should save attachments on new messages on existing conversations" do

View File

@ -60,9 +60,8 @@ describe "conversations sent filter" do
add_recipient("student2")
add_recipient("student3")
enable_jobs do
submit_message_form(:message => message_text, :add_recipient => false, :group_conversation => false)
end
ConversationBatch.any_instance.stubs(:mode).returns(:sync)
submit_message_form(:message => message_text, :add_recipient => false, :group_conversation => false)
conversations = get_conversations
conversations.size.should == 3

View File

@ -897,19 +897,6 @@ Spec::Runner.configure do |config|
end
end
def enable_jobs
job_thread = Thread.new do
Thread.current[:done] = false
while !Thread.current[:done]
run_jobs
sleep 1
end
end
yield
job_thread[:done] = true
job_thread.join
end
def track_jobs
@jobs_tracking = Delayed::JobTracking.track { yield }
end