Skip to content

Commit

Permalink
fix: Rake tasks specs (#47)
Browse files Browse the repository at this point in the history
* fix: Update spec

* fix: Update spec

* fix: Rake tasks specs
  • Loading branch information
Quentinchampenois authored Jan 17, 2024
1 parent cab60be commit 38f2616
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
6 changes: 4 additions & 2 deletions spec/lib/tasks/decidim_app/k8s/dump_db_tasks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
require "spec_helper"

describe "rake decidim_app:k8s:dump_db", type: :task do
before do
allow(DecidimApp::K8s::ConfigurationExporter).to receive(:dump_db).and_return(true)
end

it "preloads the Rails environment" do
expect(task.prerequisites).to include "environment"
end

it "invokes the configuration exporter" do
expect(DecidimApp::K8s::ConfigurationExporter).to receive(:dump_db).and_return(true)

task.execute
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
describe "rake decidim_app:k8s:export_configuration", type: :task do
let(:image) { "dummy-image" }

before do
allow(DecidimApp::K8s::ConfigurationExporter).to receive(:export!).with(image).and_return(true)
end

it "preloads the Rails environment" do
expect(task.prerequisites).to include "environment"
end

it "invokes the configuration exporter" do
with_modified_env IMAGE: image do
expect(DecidimApp::K8s::ConfigurationExporter).to receive(:export!).with(image).and_return(true)

task.execute
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

it "calls the manager service" do
with_modified_env path: path.to_s do
expect(DecidimApp::K8s::Manager).to receive(:run).with(path.to_s)
allow(DecidimApp::K8s::Manager).to receive(:run).with(path.to_s)

task.execute
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/tasks/decidim_app/k8s/upgrade_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
end

it "calls db:migrate" do
expect(Rake::Task["db:migrate"]).to receive(:invoke)
allow(Rake::Task["db:migrate"]).to receive(:invoke)

task.execute
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
require "spec_helper"

describe "rake scaleway:storage:migrate_from_local", type: :task do
before do
allow(ActiveStorage::Migrator).to receive(:migrate!).with(:local, :scaleway).and_return(true)
end

it "preloads the Rails environment" do
expect(task.prerequisites).to include "environment"
end

it "invokes the migrator" do
expect(ActiveStorage::Migrator).to receive(:migrate!).with(:local, :scaleway).and_return(true)

task.execute
end
end

0 comments on commit 38f2616

Please sign in to comment.