Sha256: 14d3ff6090be02629c4dff8890785435c73684d52fd97615edb01ed4afacf1f1

Contents?: true

Size: 1.81 KB

Versions: 1

Compression:

Stored size: 1.81 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
    expect(current_path).to eq resque_scheduler_engine_routes.delayed_job_class_path klass: 'SomeIvarJob'
  end

  def then_i_should_be_on_the_delayed_class_page_with_params
    expect(current_path).to eq resque_scheduler_engine_routes.delayed_job_class_path klass: 'JobWithParams'
  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
    expect(current_path).to eq resque_scheduler_engine_routes.timestamp_path timestamp: some_time_in_the_future.to_i
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resque-scheduler-web-0.0.4 spec/features/delayed/see_all_timestamps_for_a_class_spec.rb