Sha256: 3cf2cff0108ccd3a4510cac93a605abb2c7c44863c11ef91d770ed5bfc72d7b6

Contents?: true

Size: 1.99 KB

Versions: 3

Compression:

Stored size: 1.99 KB

Contents

require 'rails_helper'

feature 'seeing all of the timestamps where a class is delayed' do
  include SharedFunctionsForFeatures

  scenario 'viewing the timestamps page with no params' do
    given_there_is_a_delayed_job
    when_i_visit_the_delayed_jobs_page
    and_i_click_on_the_link_to_see_all_the_timestamps_for_that_job
    then_i_should_be_on_the_delayed_class_page
    and_i_should_see_the_timestamp_on_the_page
  end

  scenario 'viewing the timestamps page with activejob' do
    given_there_is_a_delayed_job_with_active_job
    when_i_visit_the_delayed_jobs_page
    and_i_click_on_the_link_to_see_all_the_timestamps_for_that_job
    and_i_should_see_the_timestamp_on_the_page
    when_i_click_on_the_timestap
    then_i_should_be_on_the_timestamp_page
  end

  def and_i_click_on_the_link_to_see_all_the_timestamps_for_that_job
    click_link 'All schedules'
  end

  def then_i_should_be_on_the_delayed_class_page
    path_params = {klass: 'SomeIvarJob'}
    path = resque_scheduler_engine_routes.delayed_job_class_path path_params
    expect(current_path).to eq path
  end

  def then_i_should_be_on_the_delayed_class_page_with_params
    path_params = {klass: 'JobWithParams'}
    path = resque_scheduler_engine_routes.delayed_job_class_path path_params
    expect(current_path).to eq path
  end

  def and_i_should_see_the_timestamp_on_the_page
    expect(page).to have_content some_time_in_the_future
  end

  def given_there_is_a_delayed_job_with_params
    Resque.enqueue_at(some_time_in_the_future,
                      JobWithParams,
                      argument: 'thingy')
  end

  def given_there_is_a_delayed_job_with_active_job
    ActiveJobTest.set(wait_until: some_time_in_the_future).perform_later
  end

  def when_i_click_on_the_timestap
    all('.timestamp-link').first.click
  end

  def then_i_should_be_on_the_timestamp_page
    path_params = { timestamp: some_time_in_the_future.to_i }
    path = resque_scheduler_engine_routes.timestamp_path path_params
    expect(current_path).to eq path
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
resque-scheduler-web-1.1.0 spec/features/delayed/see_all_timestamps_for_a_class_spec.rb
resque-scheduler-web-1.0.1 spec/features/delayed/see_all_timestamps_for_a_class_spec.rb
resque-scheduler-web-1.0.0 spec/features/delayed/see_all_timestamps_for_a_class_spec.rb