Sha256: f6ae53757849065900a1114df304a634814f53e1f7cc446356ca8cf1d1fa969d

Contents?: true

Size: 802 Bytes

Versions: 133

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

#
# Rake task spec setup.
#
RSpec.shared_context "rake" do |task_path:, task_name:|
  require 'rake'

  let(:task) do
    Rake::Task[task_name]
  end

  before(:each) do
    # we need to reenable the task or else `task.invoke` will only run the task
    # for the first example that runs.
    task.reenable
  end

  before(:all) do
    Rake::Task.clear
    # Note: Using `Rails.application.load_tasks` doesn't seem to work correctly
    # in the specs. The tasks each run twice when invoked instead of once.
    load task_path
    # Many tasks require the 'environment' task, which isn't needed in specs
    # since the environment is already loaded. So generate a fake one.
    Rake::Task.define_task(:environment)
  end

  after(:all) do
    Rake::Task.clear
  end
end

Version data entries

133 entries across 133 versions & 2 rubygems

Version Path
solidus_core-4.4.2 lib/spree/testing_support/rake.rb
solidus_core-4.4.1 lib/spree/testing_support/rake.rb
solidus_core-4.4.0 lib/spree/testing_support/rake.rb
solidus_core-4.3.4 lib/spree/testing_support/rake.rb
solidus_core-4.2.4 lib/spree/testing_support/rake.rb
solidus_core-4.1.5 lib/spree/testing_support/rake.rb
solidus_core-4.3.3 lib/spree/testing_support/rake.rb
solidus_core-4.3.2 lib/spree/testing_support/rake.rb
solidus_core-4.1.4 lib/spree/testing_support/rake.rb
solidus_core-4.3.1 lib/spree/testing_support/rake.rb
solidus_core-4.3.0 lib/spree/testing_support/rake.rb
solidus_core-4.2.3 lib/spree/testing_support/rake.rb
solidus_core-4.1.3 lib/spree/testing_support/rake.rb
solidus_core-4.0.4 lib/spree/testing_support/rake.rb
solidus_core-3.4.6 lib/spree/testing_support/rake.rb
solidus_core-4.0.3 lib/spree/testing_support/rake.rb
solidus_core-4.1.2 lib/spree/testing_support/rake.rb
solidus_core-4.2.2 lib/spree/testing_support/rake.rb
solidus_core-3.4.5 lib/spree/testing_support/rake.rb
solidus_core-4.2.1 lib/spree/testing_support/rake.rb