add notice when matching is completed

This commit is contained in:
Bilal
2020-09-15 16:15:51 +03:00
parent 28e0eb36b7
commit fb32746c81
8 changed files with 55 additions and 4 deletions

View File

@@ -324,6 +324,18 @@ feature 'User managing appearance releases' do
expect(page).to have_content no_appearance_releases
end
scenario 'Message is shown when matching job is completed', js: true do
visit project_appearance_releases_path(project)
attach_file import_appearance_release_field, Rails.root.join(file_fixture('person_photo.png')), visible: false
allow(MatchAppearanceReleasesJob).to receive(:perform_later).with(project, anything)
click_button submit_create_button
expect(page).to have_content matching_started
expect(page).to have_content no_appearance_releases
expect(page).not_to have_content matching_started
expect(page).to have_content matching_completed
end
scenario 'user leaving the page is presented with the warning if file upload is in progress', js: true do
skip "Test is inconsistently failing in CI"
@@ -847,6 +859,10 @@ feature 'User managing appearance releases' do
t 'appearance_releases.create.matching_started'
end
def matching_completed
t 'appearance_releases.create.matching_completed'
end
def filter_type_all
t 'appearance_releases.type_filter_actions.all_releases'
end

View File

@@ -10,6 +10,11 @@ describe MatchAppearanceReleasesJob do
end
describe ".perform_now" do
# before do
# allow(ProjectsChannel).to receive(:appearance_matching_flash_message).with(be_kind_of(Project), I18n.t("appearance_releases.create.matching_completed"))
# end
it "returns if no attachment is sent" do
expect(MatchingRequest).not_to receive(:create)
attachments = []
@@ -50,6 +55,8 @@ describe MatchAppearanceReleasesJob do
expect(AppearanceRelease.last.contract).not_to be_attached
expect(AppearanceRelease.last.person_photo).to be_attached
# expect(ProjectsChannel).to receive(:appearance_matching_flash_message)
end
it "creates a new incomplete appearance release for contracts which cannot be matched by BrayniacAI" do