Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Rake tasks specs (#47) #48

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading