Sha256: bb8cc0421efdd68cf6c74acc82cfc8854240172f410c44f18612e6dd423f1559

Contents?: true

Size: 771 Bytes

Versions: 11

Compression:

Stored size: 771 Bytes

Contents

#
# 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

11 entries across 11 versions & 1 rubygems

Version Path
solidus_core-2.5.2 spec/support/shared_contexts/rake.rb
solidus_core-2.5.1 spec/support/shared_contexts/rake.rb
solidus_core-2.5.0 spec/support/shared_contexts/rake.rb
solidus_core-2.5.0.rc1 spec/support/shared_contexts/rake.rb
solidus_core-2.5.0.beta2 spec/support/shared_contexts/rake.rb
solidus_core-2.5.0.beta1 spec/support/shared_contexts/rake.rb
solidus_core-2.4.2 spec/support/shared_contexts/rake.rb
solidus_core-2.4.1 spec/support/shared_contexts/rake.rb
solidus_core-2.4.0 spec/support/shared_contexts/rake.rb
solidus_core-2.4.0.rc1 spec/support/shared_contexts/rake.rb
solidus_core-2.4.0.beta1 spec/support/shared_contexts/rake.rb