Merge pull request #273 from AyuntamientoMadrid/census-api-271

Rename UserApi to CensusApi. Fixes #271
This commit is contained in:
Juanjo Bazán
2015-08-28 15:42:57 +02:00
4 changed files with 8 additions and 8 deletions

View File

@@ -18,7 +18,7 @@ class Letter
end
def address
@address ||= UserApi.new(user).address
@address ||= CensusApi.new(user).address
end
def letter_requested!
@@ -50,4 +50,4 @@ class Letter
district: address[:nombre_distrito] }
end
end
end

View File

@@ -36,10 +36,10 @@ class Residence
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?
self.date_of_birth = string_to_date(date_of_birth)
end
end
end

View File

@@ -1,4 +1,4 @@
class UserApi
class CensusApi
attr_accessor :client, :citizen, :response
def initialize(citizen)

View File

@@ -13,13 +13,13 @@ feature 'Verify Letter' do
expect(page).to have_content "You will receive a letter to your home address"
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")
login_as(user)
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"
@@ -57,4 +57,4 @@ feature 'Verify Letter' do
expect(URI.parse(current_url).path).to eq(new_sms_path)
end
end
end