Sha256: 83475dab6ccc7201c9433d7f87bb3aba680727444c3c7ab10a266dbf90802557

Contents?: true

Size: 989 Bytes

Versions: 22

Compression:

Stored size: 989 Bytes

Contents

require 'rails_helper'

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

  before { sign_in }

  let(:schedules) { create_list(:job_schedule, 1) }
  let(:definition) { create(:job_definition, job_schedules: schedules) }

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

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

  describe '#create' do
    it do
      post :create, params: { job_definition_id: definition.id, job_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

22 entries across 22 versions & 1 rubygems

Version Path
kuroko2-0.8.0 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.7.0 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.6.0 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.5.2 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.5.1 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.5.0 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.4.6 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.4.5 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.4.4 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.4.3 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.4.2 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.4.1 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.4.0 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.3.4 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.3.3 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.3.2 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.3.1 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.3.0 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.2.3 spec/controllers/job_schedules_controller_spec.rb
kuroko2-0.2.2 spec/controllers/job_schedules_controller_spec.rb