Skip to content

Commit

Permalink
Fix tests, prevent geocoding API calls during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jrunningen committed Aug 25, 2015
1 parent 35e2e4b commit 499e0a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/controllers/housing_forms_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ def setup
HousingFormsController.any_instance.stubs(:call_file_write)
HousingFormsController.any_instance.stubs(:delete_file)
PDF_FORMS.stubs(:get_field_names).returns(['Field1', 'Field2'])

# Prevent external geocoding API calls.
HousingForm.any_instance.stubs(:geocode)
end

def housing_form
Expand Down Expand Up @@ -102,8 +105,6 @@ def test_update
housing_form_update_hash = {
name: "x",
location: "x",
lat: "1",
long: "1",
}
put :update, id: housing_form, housing_form: housing_form_update_hash
assert_attributes_were_updated housing_forms(:one), housing_form_update_hash.keys
Expand Down
5 changes: 5 additions & 0 deletions test/models/housing_form_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

class HousingFormTest < ActiveSupport::TestCase

def setup
# Prevent external geocoding API calls.
HousingForm.any_instance.stubs(:geocode)
end

def housing_form
@housing_form ||= HousingForm.new
end
Expand Down

0 comments on commit 499e0a6

Please sign in to comment.