jordanbyron/mission_of_mercy — pull request #71 by brentvatne (2012-01-21 02:39:56+00:00)
Title: Add last address button

With respect to Issue #31

## Comments to consider

### New dependencies in test

I went ahead and added capybara and database_cleaner as test dependencies, in order to be able to write integration tests using the capybara api.

My reasoning for this is that there was no infrastructure in place for integration tests, and this app runs very slowly on my local machine. Integration tests were important to enable me to test javascript behaviour without having to manually click around the page and wait for each load (each test would take me about 2 minutes; it takes about as long with capybara but I do not have to do it manually). The integration testing support file was adapted from PuzzleNode.

### Send previous patients information along with original request

There are two options I see for getting the previous patients data:
1. Add a JSON string at the top of the file that contains all relevant information
2. Make an AJAX call when the button is pressed to fetch the patient's data

I went for the first option because it was very straightforward to implement and the asynchronous version does not add much except reduced performance and more code. We have already queried the object and loaded it into memory on each request, so I figure we might as send over all of that information with the original request, rather than query for it again if it is needed. The data overhead for adding this is minimal, especially considering the networked environment this application will be operating in. That said, if you think this is not a good idea I would be interested in hearing why.

### Hide the button if there is no previous user
I couldn't decide between disabling it or hiding it, so I just picked one to move along. Any preference?

Run the tests with:
`rake test TEST=test/integration/check_in_test.rb`