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:
parent
de9d56b7f0
commit
3399c417a2
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue