Sha256: d70f2641f3f2eedbb3bab0e750ca1847a2210fde9b5734bef7acdb031b106197

Contents?: true

Size: 953 Bytes

Versions: 6

Compression:

Stored size: 953 Bytes

Contents

require 'rails_helper'

module RocketJobMissionControl
  class ::TheJobClass < OpenStruct;
  end

  RSpec.describe JobsHelper, type: :helper do
    before do
      helper.extend(RocketJobMissionControl::ApplicationHelper)
    end

    describe '#job_action_link' do
      let(:action) { 'abort' }
      let(:http_method) { :patch }
      let(:path) { "/jobs/42/#{action}" }
      let(:action_link) { helper.job_action_link(action, path, http_method) }

      it 'uses the action as the label' do
        expect(action_link).to match(/>abort<\/a>/)
      end

      it 'links to the correct url' do
        expect(action_link).to match(/href="\/jobs\/42\/abort\"/)
      end

      it 'adds prompt for confirmation' do
        expect(action_link).to match(/data-confirm="Are you sure you want to abort this job\?"/)
      end

      it 'uses correct http method' do
        expect(action_link).to match(/data-method="patch"/)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rocketjob_mission_control-3.0.0.rc1 spec/helpers/jobs_helper_spec.rb
rocketjob_mission_control-2.1.1 spec/helpers/jobs_helper_spec.rb
rocketjob_mission_control-2.1.0 spec/helpers/jobs_helper_spec.rb
rocketjob_mission_control-2.0.0 spec/helpers/jobs_helper_spec.rb
rocketjob_mission_control-2.0.0.rc2 spec/helpers/jobs_helper_spec.rb
rocketjob_mission_control-2.0.0.rc1 spec/helpers/jobs_helper_spec.rb