diff --git a/app/controllers/bundle_contexts_controller.rb b/app/controllers/bundle_contexts_controller.rb index 78653d822..011e847cd 100644 --- a/app/controllers/bundle_contexts_controller.rb +++ b/app/controllers/bundle_contexts_controller.rb @@ -10,7 +10,8 @@ def new def create @bundle_context = BundleContext.new(bundle_contexts_params) if @bundle_context.save - redirect_to controller: 'job_runs', created: 1 + flash[:success] = 'Success! Your job is queued. A link to your validation report will be emailed to you when it is ready.' + redirect_to controller: 'job_runs' else render :new end diff --git a/app/controllers/job_runs_controller.rb b/app/controllers/job_runs_controller.rb index 03552c1ec..3eea56279 100644 --- a/app/controllers/job_runs_controller.rb +++ b/app/controllers/job_runs_controller.rb @@ -1,6 +1,5 @@ class JobRunsController < ApplicationController def index - flash[:notice] = 'Success! Your job is queued. A link to your validation report will be emailed to you when it is ready.' if params[:created] @job_runs = JobRun.order('created_at desc').page params[:page] end @@ -13,7 +12,7 @@ def download if @job_run.output_location send_file @job_run.output_location else - flash[:notice] = 'Job is not complete. Please check back later.' + flash[:warning] = 'Job is not complete. Please check back later.' render 'show' end end diff --git a/spec/controllers/bundle_contexts_controller_spec.rb b/spec/controllers/bundle_contexts_controller_spec.rb index c51dcd783..b5154e6d4 100644 --- a/spec/controllers/bundle_contexts_controller_spec.rb +++ b/spec/controllers/bundle_contexts_controller_spec.rb @@ -44,7 +44,8 @@ post :create, params: params expect(assigns(:bundle_context)).to be_a(BundleContext).and be_persisted expect(response).to have_http_status(302) # HTTP code for found - expect(response).to redirect_to(job_runs_path(created: 1)) + expect(response).to redirect_to(job_runs_path) + expect(flash[:success]).to start_with('Success! Your job is queued.') end it 'has the correct attributes' do post :create, params: params diff --git a/spec/controllers/job_runs_controller_spec.rb b/spec/controllers/job_runs_controller_spec.rb index 1d17a73c4..ece0f4a91 100644 --- a/spec/controllers/job_runs_controller_spec.rb +++ b/spec/controllers/job_runs_controller_spec.rb @@ -31,7 +31,7 @@ it 'before job is complete, renders page with flash' do allow(JobRun).to receive(:find).with('123').and_return(instance_double(JobRun, output_location: nil)) get :download, params: { id: 123 } - expect(flash[:notice]).to eq('Job is not complete. Please check back later.') + expect(flash[:warning]).to eq('Job is not complete. Please check back later.') end it 'when job is complete, returns file attachment' do job_run_double = instance_double(JobRun, output_location: 'spec/test_data/input/mock_progress_log.yaml') @@ -42,7 +42,7 @@ 'Content-Type' => 'application/x-yaml', 'Content-Disposition' => 'attachment; filename="mock_progress_log.yaml"' ) - expect(flash[:notice]).to be_nil + expect(flash[:warning]).to be_nil end it 'requires ID param' do expect { get :download }.to raise_error(ActionController::UrlGenerationError)