Sha256: d47e8e57d3843758a92e545830b7df020b19b8f826c360da0461ae15988fc2a5

Contents?: true

Size: 1.01 KB

Versions: 12

Compression:

Stored size: 1.01 KB

Contents

require 'rails_helper'

describe Kuroko2::JobSuspendSchedulesController do
  routes { Kuroko2::Engine.routes }

  before { sign_in }

  let(:schedules) { create_list(:job_suspend_schedule, 1) }
  let(:definition) { create(:job_definition, job_suspend_schedules: schedules) }

  describe '#index' do
    it do
      get :index, params: { job_definition_id: definition.id }

      expect(response).to have_http_status(:ok)
      expect(assigns(:suspend_schedule)).to be_new_record
      expect(assigns(:suspend_schedules)).to eq schedules
    end
  end

  describe '#create' do
    it do
      post :create, params: { job_definition_id: definition.id, job_suspend_schedule: { cron: '* * * * *' } }

      expect(response).to have_http_status(:created)
    end
  end

  describe '#destroy' do

    it do
      delete :destroy, params: { job_definition_id: definition.id, id: schedules.first.id }
      definition.reload

      expect(response).to have_http_status(:ok)
      expect(definition.job_schedules.size).to be 0
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
kuroko2-0.4.2 spec/controllers/job_suspend_schedules_controller_spec.rb
kuroko2-0.4.1 spec/controllers/job_suspend_schedules_controller_spec.rb
kuroko2-0.4.0 spec/controllers/job_suspend_schedules_controller_spec.rb
kuroko2-0.3.4 spec/controllers/job_suspend_schedules_controller_spec.rb
kuroko2-0.3.3 spec/controllers/job_suspend_schedules_controller_spec.rb
kuroko2-0.3.2 spec/controllers/job_suspend_schedules_controller_spec.rb
kuroko2-0.3.1 spec/controllers/job_suspend_schedules_controller_spec.rb
kuroko2-0.3.0 spec/controllers/job_suspend_schedules_controller_spec.rb
kuroko2-0.2.3 spec/controllers/job_suspend_schedules_controller_spec.rb
kuroko2-0.2.2 spec/controllers/job_suspend_schedules_controller_spec.rb
kuroko2-0.2.1 spec/controllers/job_suspend_schedules_controller_spec.rb
kuroko2-0.2.0 spec/controllers/job_suspend_schedules_controller_spec.rb