Merge pull request #273 from AyuntamientoMadrid/census-api-271
Rename UserApi to CensusApi. Fixes #271
This commit is contained in:
@@ -18,7 +18,7 @@ class Letter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def address
|
def address
|
||||||
@address ||= UserApi.new(user).address
|
@address ||= CensusApi.new(user).address
|
||||||
end
|
end
|
||||||
|
|
||||||
def letter_requested!
|
def letter_requested!
|
||||||
@@ -50,4 +50,4 @@ class Letter
|
|||||||
district: address[:nombre_distrito] }
|
district: address[:nombre_distrito] }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ class Residence
|
|||||||
|
|
||||||
self.date_of_birth = date_to_string(date_of_birth)
|
self.date_of_birth = date_to_string(date_of_birth)
|
||||||
|
|
||||||
residency = UserApi.new(self)
|
residency = CensusApi.new(self)
|
||||||
errors.add(:residence_in_madrid, false) unless residency.valid?
|
errors.add(:residence_in_madrid, false) unless residency.valid?
|
||||||
|
|
||||||
self.date_of_birth = string_to_date(date_of_birth)
|
self.date_of_birth = string_to_date(date_of_birth)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class UserApi
|
class CensusApi
|
||||||
attr_accessor :client, :citizen, :response
|
attr_accessor :client, :citizen, :response
|
||||||
|
|
||||||
def initialize(citizen)
|
def initialize(citizen)
|
||||||
@@ -13,13 +13,13 @@ feature 'Verify Letter' do
|
|||||||
expect(page).to have_content "You will receive a letter to your home address"
|
expect(page).to have_content "You will receive a letter to your home address"
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Error accessing address from UserApi" do
|
scenario "Error accessing address from CensusApi" do
|
||||||
user = create(:user, residence_verified_at: Time.now, confirmed_phone: "611111111")
|
user = create(:user, residence_verified_at: Time.now, confirmed_phone: "611111111")
|
||||||
|
|
||||||
login_as(user)
|
login_as(user)
|
||||||
visit new_letter_path
|
visit new_letter_path
|
||||||
|
|
||||||
allow_any_instance_of(UserApi).to receive(:address).and_return(nil)
|
allow_any_instance_of(CensusApi).to receive(:address).and_return(nil)
|
||||||
|
|
||||||
click_button "Send me a letter"
|
click_button "Send me a letter"
|
||||||
|
|
||||||
@@ -57,4 +57,4 @@ feature 'Verify Letter' do
|
|||||||
expect(URI.parse(current_url).path).to eq(new_sms_path)
|
expect(URI.parse(current_url).path).to eq(new_sms_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user