Add SDG phase model

The purpose of this model will be to have different sections in the SDG
index.
This commit is contained in:
Javi Martín
2021-01-07 19:23:55 +01:00
parent ee29ca43a5
commit 13f95e9419
9 changed files with 83 additions and 1 deletions

View File

@@ -9,27 +9,33 @@ describe "rake db:load_sdg" do
it "populates empty databases and assigns targets correctly" do
SDG::Goal.destroy_all
SDG::Phase.destroy_all
run_rake_task
expect(SDG::Goal.count).to eq 17
expect(SDG::Target.count).to eq 169
expect(SDG::Target["17.1"].goal.code).to eq 17
expect(SDG::Phase.count).to eq 3
end
it "does not create additional records on populated databases" do
expect(SDG::Goal.count).to eq 17
expect(SDG::Target.count).to eq 169
expect(SDG::Phase.count).to eq 3
goal_id = SDG::Goal.last.id
target_id = SDG::Target.last.id
phase_id = SDG::Phase.last.id
run_rake_task
expect(SDG::Goal.count).to eq 17
expect(SDG::Target.count).to eq 169
expect(SDG::Phase.count).to eq 3
expect(SDG::Goal.last.id).to eq goal_id
expect(SDG::Target.last.id).to eq target_id
expect(SDG::Phase.last.id).to eq phase_id
end
end