Sha256: b2a4d497773a104a414eeb77310a7c50058b00cc83c92f2d911074ea3a10fe56

Contents?: true

Size: 968 Bytes

Versions: 48

Compression:

Stored size: 968 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'dummy_task' do
  include_context(
    'rake',
    task_name: 'dummy_task',
    task_path: Spree::Core::Engine.root.join('spec/lib/tasks/dummy_task.rake'),
  )

  it 'calls the dummy task exactly once' do
    expect(DummyTaskRunner).to receive(:run).once
    task.invoke
  end

  # This tests:
  #   1) that tasks get reenabled between examples
  #   2) that tasks aren't loaded in the wrong way, causing them to execute
  #      an extra time for every example that's defined.
  # We need at least two specs to trigger the error conditions and spec order is
  # random so we just create the same spec twice. We could probably combine this
  # with the generic spec above but this seems clearer.
  2.times do |i|
    it "still calls the dummy task exactly once when more than one example is defined - #{i}" do
      expect(DummyTaskRunner).to receive(:run).once
      task.invoke
    end
  end
end

Version data entries

48 entries across 48 versions & 2 rubygems

Version Path
solidus_core-2.10.5 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.10.3 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.10.2 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.9.6 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.8.6 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.10.1 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.9.5 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.10.0 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.9.4 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.6.6 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.7.4 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.8.5 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.9.3 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.9.2 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.10.0.beta1 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.7.3 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.6.5 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.9.1 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.9.0 spec/lib/tasks/dummy_task_spec.rb
solidus_core-2.9.0.rc.1 spec/lib/tasks/dummy_task_spec.rb