aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
Commit message (Collapse)AuthorAgeLines
* Update the helpful model schema annotationsMark Longair2013-11-01-19/+22
| | | | These are regenerated with "bundle exec annotate"
* Add data to test example given in #1143Louise Crow2013-10-21-11/+14
| | | | This causes several specs to fail.
* Merge remote-tracking branch 'origin/fix-aborted-transaction' into ↵Louise Crow2013-10-07-19/+4
|\ | | | | | | rails-3-develop
| * Factor out a 'with_duplicate_xapian_job_creation' helperMark Longair2013-10-07-19/+4
| | | | | | | | | | | | | | | | | | | | In a subsequent commit, we will want to wrap an additional section of code with the addition and removal of a hook that creates a duplicate xapian job, so it's useful for this to be factored out. This commit introduces a 'with_duplicate_xapian_job_creation' method that can be passed a block which will be run with the forced duplicate xapian job creation.
* | Merge branch 'feature/email-subject-cleanup' into rails-3-developLouise Crow2013-10-07-0/+10
|\ \ | |/ |/|
| * Move special case to whatdotheyknow-themeLouise Crow2013-10-04-0/+10
| | | | | | | | | | Apart from anything else, we don't want translators to have to worry about the special case text. See https://github.com/mysociety/whatdotheyknow-theme/commit/2078febca5181ce3b1a9c0fae0123ae5f6448718 for the corresponding change to whatdotheyknow-theme.
* | Fix upcasing of a non-US-ASCII first letter under Ruby 1.8Mark Longair2013-10-04-0/+11
| | | | | | | | | | | | | | | | In the rare circumstance that someone created a public body whose name started with a lower case letter outside [a-z] with Alaveteli running under Ruby 1.8, the letter would not be upcased correctly before saving to the first_letter column. This commit fixes that by using a Unicode-aware upcase function.
* | Add to fixtures a public body with an accented initial letterMark Longair2013-10-04-7/+7
|/ | | | | | | | | | | | | | | | | This adds a public body called "Åčçèñtéd Authority" in the Czech locale (cs) so that we can create tests that exercise, for example, searching based on an initial letter that has a multi-byte representation in UTF-8. An old test for "add mass tags" in the admin needed to be updated since it implicitly assumed that all the public bodies in the fixtures had translations in the :en locale. The tests for loading CSV files of public bodies also needed to be updated, since they were assuming that public body names only contained letters in [A-Za-z ]. Since Unicode character classes aren't easily available in Ruby 1.8 and it makes little difference to the test, the character class is replaced by '.'.
* Fix typoLouise Crow2013-09-19-1/+1
|
* Handle salutations with regexp special characters.Louise Crow2013-09-19-0/+10
| | | | Fixes #1104.
* Merge branch 'hotfix/0.13.0.3' into rails-3-developLouise Crow2013-09-18-0/+37
|\
| * Restrict old_unclassified methods to normal prominence.0.13.0.3hotfix/0.13.0.3Louise Crow2013-09-18-0/+37
| | | | | | | | Fixes #1082.
* | Merge branch 'feature/hide-individual-responses' into rails-3-developLouise Crow2013-09-17-11/+622
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Gemfile app/views/admin_request/edit_outgoing.html.erb config/packages doc/CHANGES.md doc/INSTALL.md spec/models/info_request_spec.rb spec/models/public_body_spec.rb
| * | Exclude hidden responses when calculating old_unclassifiedLouise Crow2013-09-16-7/+13
| | | | | | | | | | | | | | | Make old_unclassified_params method consistent with last_public_response_event and associated methods.
| * | Only include public messages in who_can_followup_toLouise Crow2013-09-16-0/+37
| | |
| * | Add public criteria for message event access methodsLouise Crow2013-09-16-2/+61
| | | | | | | | | | | | | | | | | | | | | get_last_response_event and get_last_outgoing_event are used in various places to determine which events to link to, use in queries etc. Restrict them to refer to the last publicly visible event of the relevant type, and rename them to make that clear.
| * | InfoRequestEvent.indexed_by_search consults OutgoingMessage.Louise Crow2013-09-16-1/+18
| | |
| * | Move indexed_by_search to MessageProminenceLouise Crow2013-09-16-2/+23
| | | | | | | | | | | | Add some tests that it's working on the outgoing message model.
| * | Add some tests for user_can_view? on outgoing message.Louise Crow2013-09-16-0/+52
| | |
| * | Don't index hidden and requester_only incoming messages.Louise Crow2013-09-16-0/+64
| | |
| * | Adding prominence_reason to IncomingMessage.Louise Crow2013-09-16-0/+1
| | |
| * | Refactor common logic about prominence and access.Louise Crow2013-09-16-1/+1
| | | | | | | | | | | | Move it into the Ability module.
| * | Add a method to ask whether a user can view an incoming message.Louise Crow2013-09-16-0/+57
| | |
| * | Add response_event helperLouise Crow2013-09-16-0/+12
| | | | | | | | | | | | | | | Add a convenience method for getting the 'response' event associated with an incoming message.
| * | Add prominence to incoming message.Louise Crow2013-09-16-0/+21
| | |
| * | Re-annotate models with database fieldsLouise Crow2013-09-16-0/+264
| | |
* | | Merge branch 'feature/issue-902-fix' into rails-3-developLouise Crow2013-09-17-0/+22
|\ \ \
| * | | Allow a unicode-only title in validationLouise Crow2013-09-17-0/+22
| | | |
* | | | Merge branch 'feature/issue-555-fix' into rails-3-developLouise Crow2013-09-17-0/+31
|\ \ \ \ | |/ / / |/| | |
| * | | Add a failing spec for handling a race conditionLouise Crow2013-09-17-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The spec uses a hook method to simulate the insertion of an acts_as_xapian_job in another process for the model. Credit to: http://stackoverflow.com/questions/2017587/simulating-race-conditions-in-rspec-unit-tests Conflicts: vendor/plugins/acts_as_xapian/lib/acts_as_xapian.rb
* | | | Save cached columns once updated.Louise Crow2013-09-05-1/+6
| | | |
* | | | Don't dirty every attribute in checking for whitespace.Louise Crow2013-09-05-15/+31
|/ / / | | | | | | | | | | | | | | | | | | Check to see if the stripped version is different before setting it on the record. If we don't do this, the subsequent call to write_attribute in Globalize3 which uses attribute_will_change! means we're storing versions when there hasn't really been any change.
* | / Improve calculation of PublicBody statistics columnsMark Longair2013-08-20-0/+66
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | On PublicBody, we don't need to update info_requests_count because that's already done with :counter_cache. On the other hand, info_requests_successful_count and info_requests_not_held_count can't be updated easily with counter_cache (since they need conditions to be attached). Instead we update them in post_save and post_destroy, as suggested here: http://blog.douglasfshearer.com/post/17495285851/custom-counter-cache-with-conditions This also adds tests to ensure that the after_(save|destroy) callbacks are called and that they modify the counts correctly.
* | Merge branch 'feature/further-request-event-fixes' into rails-3-developLouise Crow2013-08-15-3/+50
|\ \
| * | Make admin edits affect info_request_event described_states.Louise Crow2013-08-15-0/+21
| | | | | | | | | | | | | | | | | | | | | Make sure that admin edits changing the described state of an info request are reflected in the latest_status and status values of info request events so that the info requests are retrieved correctly in status-based searches.
| * | Allow 'edit' and 'status_update' calculated states to propagate.Louise Crow2013-08-15-3/+29
| |/ | | | | | | | | | | | | | | Update test expectations and add further test to explicitly show that we want the described status from a status update to be propagated to a preceding response, as well as being filled in in the status update itself (which is mostly to deal with the case where there isn't a preceding response). Make those changes to calculate_event_states
* / Update tests for changes to fixture file.Louise Crow2013-08-14-14/+18
|/
* Merge branch 'feature/localisation-fixes' into rails-3-developLouise Crow2013-07-29-1/+7
|\
| * Prepare the xapian database before running tests that rely on it existing.Louise Crow2013-07-29-0/+5
| |
| * Add loading of raw emails - test depends on this.Louise Crow2013-07-23-0/+1
| |
| * Use AlaveteliConfiguration wrapper in test so we can be more specific about ↵Louise Crow2013-07-23-1/+1
| | | | | | | | the method to be stubbed and avoid side effects.
* | Prevent erroneous internal error messages with multibyte characters under ↵Louise Crow2013-07-25-1/+12
| | | | | | | | ruby 1.8 by using mb_chars for length comparison - it counts multibyte characters.
* | Merge remote-tracking branch ↵Louise Crow2013-07-23-0/+203
|\ \ | |/ |/| | | | | | | | | 'openaustralia_github/tests_set_described_state' into rails-3-develop Conflicts: spec/models/info_request_spec.rb
| * How we would handle event states if we added a state_update event whenever a ↵Matthew Landauer2013-04-20-17/+41
| | | | | | | | user classifies a request
| * Access events in tests as an arrayMatthew Landauer2013-04-20-42/+43
| |
| * Test case that shows up event states bug in ↵Matthew Landauer2013-04-18-1/+18
| | | | | | | | https://www.whatdotheyknow.com/details/request/family_support_worker_redundanci
| * Test case that shows up event states bug in ↵Matthew Landauer2013-04-18-0/+20
| | | | | | | | https://www.whatdotheyknow.com/request/human_rights_and_deprivation_of
| * Testing an internal reviewMatthew Landauer2013-04-18-109/+131
| |
| * Add test for events in another situationMatthew Landauer2013-04-15-0/+28
| |
| * Check event_type in testsMatthew Landauer2013-04-15-0/+7
| |