mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Configure rake specs in one place
So we don't have to add it to every rake spec file.
This commit is contained in:
@@ -145,6 +145,10 @@ RSpec.configure do |config|
|
||||
config.default_formatter = "doc"
|
||||
end
|
||||
|
||||
config.define_derived_metadata(file_path: %r{/spec/lib/tasks/}) do |metadata|
|
||||
metadata[:type] = :rake
|
||||
end
|
||||
|
||||
# Reset locale for all specs.
|
||||
config.around(:each) do |example|
|
||||
locale = ENV.fetch('LOCALE', 'en_TST')
|
||||
@@ -245,6 +249,8 @@ RSpec.configure do |config|
|
||||
# You can use `rspec -n` to run only failed specs.
|
||||
config.example_status_persistence_file_path = "tmp/rspec-status.txt"
|
||||
|
||||
config.include_context "rake", type: :rake
|
||||
|
||||
# Helpers
|
||||
config.include FactoryBot::Syntax::Methods
|
||||
config.include JsonSpec::Helpers
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe 'truncate_data.rake' do
|
||||
include_context "rake"
|
||||
|
||||
describe ':truncate' do
|
||||
context 'when months_to_keep is specified' do
|
||||
it 'truncates order cycles closed earlier than months_to_keep months ago' do
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe 'enterprises.rake' do
|
||||
include_context "rake"
|
||||
|
||||
describe ':remove_enterprise' do
|
||||
context 'when the enterprises exists' do
|
||||
it 'removes the enterprise' do
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe 'ofn:import:product_images' do
|
||||
include_context "rake"
|
||||
|
||||
describe 'task' do
|
||||
context "filename is blank" do
|
||||
it 'raises an error' do
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe "reset.rake" do
|
||||
include_context "rake"
|
||||
|
||||
it "clears job queues" do
|
||||
job_class = Class.new do
|
||||
include Sidekiq::Job
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe 'sample_data.rake' do
|
||||
include_context "rake"
|
||||
|
||||
before do
|
||||
# Create seed data required by the sample data.
|
||||
create(:user)
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe "simplecov.rake" do
|
||||
include_context "rake"
|
||||
|
||||
describe "simplecov:collate_results" do
|
||||
context "when there are reports to merge" do
|
||||
let(:input_dir) { Rails.root.join("spec/fixtures/simplecov") }
|
||||
|
||||
@@ -4,8 +4,6 @@ require 'spec_helper'
|
||||
require 'rake'
|
||||
|
||||
RSpec.describe 'users.rake' do
|
||||
include_context "rake"
|
||||
|
||||
describe ':remove_enterprise_limit' do
|
||||
context 'when the user exists' do
|
||||
let(:user) { create(:user) }
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Let this context take care of Rake testing gotchas.
|
||||
#
|
||||
# ```rb
|
||||
# RSpec.describe "my_task.rake" do
|
||||
# include_context "rake"
|
||||
# # ..
|
||||
# ```
|
||||
#
|
||||
# A shared context for all rake specs
|
||||
shared_context "rake" do
|
||||
before(:all) do
|
||||
# Make sure that Rake tasks are only loaded once.
|
||||
|
||||
Reference in New Issue
Block a user