Updated

spec/jobs / refresh_constituencies_job_spec.rb

B
29 lines of codes
0 methods
N/A complexity/method
3 churn
43.59 complexity
17 duplications
require 'rails_helper' RSpec.describe RefreshConstituenciesJob, type: :job do context "when Parliament has dissolved" do let(:constituency_1) do FactoryBot.create(:constituency, :coventry_north_east) end let(:constituency_2) do FactoryBot.create(:constituency, :sheffield_brightside_and_hillsborough) end before do stub_api_request_for("CV21PH").to_return(api_response(:ok, "coventry_north_east")) stub_api_request_for("S61AR").to_return(api_response(:ok, "sheffield_brightside_and_hillsborough")) end it "updates the existing constituencies" do
  1. context(when Parliament has dissolved)::it#updates the existing constituencies has a flog score of 26
expect { described_class.perform_now }.to change {
  1. Identical code found in 2 nodes Locations: 0 1
[ constituency_1.reload.mp_name, constituency_2.reload.mp_name ] }.from(["Colleen Fletcher MP", "Gill Furniss"]).to([nil, nil]) end end end