aboutsummaryrefslogtreecommitdiffstats
path: root/spec
Commit message (Collapse)AuthorAgeLines
* Merge branch 'hotfix/0.17.0.1' into rails-3-developLouise Crow2014-04-25-0/+5
|\
| * Fix for badly-formed content-disposition header.Louise Crow2014-04-25-0/+5
| | | | | | | | Taken from https://github.com/mikel/mail/pull/602
* | Merge branch 'issues/337-attachment-title' into rails-3-developGareth Rees2014-04-14-2/+541
|\ \
| * | Dynamically inject AttachmentToHTML::View contentGareth Rees2014-04-07-0/+5
| | |
| * | Remove redundant AttachmentToHTML::HTMLGareth Rees2014-04-07-24/+0
| | |
| * | Update AttachmentToHTML for new View classGareth Rees2014-04-07-6/+24
| | |
| * | Simpler AttachmentToHTML::Adapters::CouldNotConvert interfaceGareth Rees2014-04-07-40/+9
| | |
| * | Simpler AttachmentToHTML::Adapters::GoogleDocsViewer interfaceGareth Rees2014-04-07-42/+10
| | |
| * | Simpler AttachmentToHTML::Adapters::RTF interfaceGareth Rees2014-04-07-60/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TODO: We really should be testing the full output of RTF#body, but we currently want to remain consistent with Adapters::PDF as many methods are shared between the Adapters. A more correct spec might be: expected = %Q(<font size=3><font color="#000000">thisisthebody</font></font>) adapter.body.should == expected
| * | Simpler AttachmentToHTML::Adapters::PDF interfaceGareth Rees2014-04-07-56/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TODO: We really should be testing the full output of PDF#body, but inconsistencies between pdftohtml prevent sensible means of doing this. For example: adapter.body.should == %Q(\n<A name=1></a>thisisthebody<br/>\n<hr>\n) Fails because some versions (correctly!) use lower case tag names.
| * | Simpler AttachmentToHTML::Adapters::Text interfaceGareth Rees2014-04-07-73/+22
| | |
| * | Add an AttachmentToHTML::View to deal with renderingGareth Rees2014-04-07-0/+147
| | |
| * | Work around a bug in unrtfGareth Rees2014-04-01-0/+25
| | |
| * | Use AttachmentToHTML to generate FoiAttachment#body_as_htmlGareth Rees2014-03-28-2/+1
| | |
| * | Add AttachmentToHTML libraryGareth Rees2014-03-28-0/+556
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extracts the attachment processing from FoiAttachment#body_to_html AttachmentToHTML contains adapters which convert - text/plain - application/pdf - application/rtf Results are returned as an AttachmentHTML::HTML instance which contains the raw HTML and other metadata about the conversion.
* | | Merge branch 'issues/1416-csv-update-public-bodies' into rails-3-developGareth Rees2014-04-14-38/+84
|\ \ \
| * | | Handle validation errors in PublicBody.import_csvGareth Rees2014-04-14-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically using save! so that anything other than an ActiveRecord::RecordInvalid doesn't get missed Note that ActiveModel::Errors#full_messages includes the attribute key in the message. This is by design, so we should consider whether we can improve the way that we use translated validation messages.
| * | | Add missing validation to PublicBodyGareth Rees2014-04-14-0/+6
| | | | | | | | | | | | | | | | | | | | There's a unique index on public_bodies url_name, so we should have a validation for that.
| * | | Annotate modelsGareth Rees2014-04-09-38/+65
| | | | | | | | | | | | | | | | | | | | Should have been run after related migrations. Could automate this to always run after migrations.
* | | | Merge branch 'issues/1343-ip-spoofing-error' into rails-3-developGareth Rees2014-04-14-0/+11
|\ \ \ \
| * | | | Rescue from IpSpoofAttackError when using remote IPGareth Rees2014-04-14-0/+11
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some proxies seem to be setting the Client-IP HTTP header to 127.0.0.1. Rails checks that Client-IP is contained in X-Forwarded-For and raises the error. We decided to rescue in this individual case rather than adding a middleware to strip Client-IP (http://writeheavy.com/2011/07/31/when-its-ok-to-turn-of-rails-ip-spoof-checking.html#well_thats_stupid_can_we_turn_it_off) so that we don't introduce unexpected behaviour. If we start to do anything more with request.remote_ip, then we should look at doing so. See http://blog.gingerlime.com/2012/rails-ip-spoofing-vulnerabilities-and-protection for an in-depth look at this issue.
* / / / Rescue from non-numeric page parameter exceptionsGareth Rees2014-04-10-0/+8
|/ / / | | | | | | | | | | | | | | | will_paginate intentionally throws an ArgumentError when a non-numeric page parameter is used. Conveniently, they tag it with WillPaginate::InvalidPage, so here we rescue with a 404.
* | | Merge branch 'issues/1317-holding-pen-spam' into rails-3-developGareth Rees2014-04-07-0/+155
|\ \ \
| * | | Add AdminSpamAddressesController and UIGareth Rees2014-03-28-0/+91
| | | |
| * | | Ignore mail sent to known spam addressesGareth Rees2014-03-26-0/+10
| | | |
| * | | Add SpamAddress modelGareth Rees2014-03-26-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The volume of spam in the holding pen in WDTK has increased. Over a few weeks in January 2014 the pattern was roughly: - 8 were sent "To" the same address, which was a nearly valid old request address - correct hash, but missing the second hyphen. - 1 was sent "To" an invalid request address (nearly correct hash) - 1 was sent "BCC" a valid request address - 1 was sent "BCC" request@whatdotheyknow.com If a spam was sent "To" an old valid request address then it would be rejected. It's not entirely safe to just reject mails to old requests with any hash, because sometimes authorities miss out a digit in the request number, though perhaps simply getting a failure bounce would cause them to check. In any case that wouldn't trivially catch the most frequent case above as it doesn't have an obvious request number. --- We looked at greylisting and configuring the MTA with an RBL. Greylisting was rejected as it would slow down the responsiveness of the application when people email in. This could be revisited if/when emails are parsed through a queue system depending on how we find the performance there. An RBL is already configured, but this ticket refers more to where the email is sent rather than who it came from. --- We elected to: - Create spam_address model - Add code to RequestMailer.receive to check the list of spam addresses and silently discard an incoming mail if it's addressed to one of them - Add page to admin interface for adding/removing spam addresses --- Thanks to Ganesh Sittampalam for the research and Louise Crow for the implementation strategy.
* | | | Merge branch 'rails-3-develop' of ↵Louise Crow2014-04-04-0/+7
|\ \ \ \ | | | | | | | | | | | | | | | ssh://git.mysociety.org/data/git/public/alaveteli into rails-3-develop
| * \ \ \ Merge branch 'issues/1406-render-exception-error' into rails-3-developGareth Rees2014-04-02-0/+7
| |\ \ \ \
| | * | | | URL Encode the path parameter for render_exceptionGareth Rees2014-03-31-0/+7
| | | |/ / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a request is made and path is something like /%d3 we rescue this with a custom 404 template. This gets unescaped as {"path"=>"\323"}. In the case of a RouteNotFound, ApplicationController#render_exception renders the general/exception_caught template in to the default layout, which renders the general/_locale_switcher partial. This partial calls url_for – sending the full params hash as the argument – so that a user may return to the existing page in their chosen locale. The problem is that url_for tries to construct the url with the hash {:action=>"not_found", :controller=>"general", :path=>"\323"}. ApplicationController#sanitize_params re-encodes the path parameter so that it can be passed through to url_for without trouble.
* | | | | Merge branch 'feature/1310-better-track-translation' into rails-3-developLouise Crow2014-04-04-16/+235
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | Conflicts: spec/factories.rb
| * | | | Move track descriptions to a helper.Louise Crow2014-03-24-0/+29
| | | | | | | | | | | | | | | | | | | | We can access url generation methods more easily here.
| * | | | Add notices for unsubscribing from things.Louise Crow2014-03-24-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | These are full sentences, not composed on the fly, so should be easier to translate.
| * | | | Add notices for subscribing to something.Louise Crow2014-03-24-1/+61
| | | | | | | | | | | | | | | | | | | | | | | | | These notices are complete sentences, not composed on the fly, so should be easier to translate.
| * | | | Add notices for subscribing something you're subscribed to.Louise Crow2014-03-24-0/+104
| | | | | | | | | | | | | | | | | | | | | | | | | These notices are full sentences, rather than being composed of phrases, which should make them easier to translate.
| * | | | Make track factory name a bit more specific.Louise Crow2014-03-24-5/+7
| | | | |
| * | | | Make search description specs match actual casesLouise Crow2014-03-17-4/+5
| | |_|/ | |/| | | | | | | | | | | | | | | | | | In the largest Alaveteli instance, WDTK, only a fraction of tracks use filters and these specs represent those that have actually been used commonly.
* | | | Merge branch 'issues/1389-contact-form-honeypot' into rails-3-developGareth Rees2014-03-31-31/+109
|\ \ \ \ | |_|/ / |/| | |
| * | | Add honeypot spam protection to contact formGareth Rees2014-03-31-0/+17
| | | | | | | | | | | | | | | | | | | | Intercepts the request and redirects to the homepage if the comment field is filled in on the contact form.
| * | | Improve HelpControllerSpecGareth Rees2014-03-31-1/+5
| | | | | | | | | | | | | | | | | | | | - Actually assert something when getting the pages - Use named route
| * | | Tidy HelpControllerSpecGareth Rees2014-03-31-29/+41
| | | |
| * | | Add specs for ContactValidatorGareth Rees2014-03-26-2/+47
| | |/ | |/|
* / | Split factories in to individual filesGareth Rees2014-03-25-193/+227
|/ / | | | | | | | | | | | | | | | | | | | | | | Factories are loaded automatically from: - test/factories.rb - spec/factories.rb - test/factories/*.rb - spec/factories/*.rb Keeping factories per-model helps navigation, especially when they get more complex with traits and inheritance.
* | Add AdminHelper#comment_visibilityGareth Rees2014-03-25-0/+21
| | | | | | | | Get the canonical human-readable status of a comment
* | Add specs for AdminUserController#modify_comment_visibilityGareth Rees2014-03-25-0/+86
| |
* | Merge branch 'feature/1313-better-translation-markup' into rails-3-developLouise Crow2014-03-24-6/+54
|\ \
| * | Refactor event description to make it easier to translate.Louise Crow2014-03-17-6/+54
| |/ | | | | | | Closes #1313 and #365.
* | Add encoding lineLouise Crow2014-03-14-0/+1
| |
* | Rename spec files so they're run by rake spec.Louise Crow2014-03-13-0/+0
| |
* | Merge remote-tracking branch ↵Louise Crow2014-03-13-10/+10
|\ \ | | | | | | | | | 'opennewzealand_github/feature/handle-undefined-conversion' into rails-3-develop
| * | needs _spec.rb to be run by `rake spec`Rowan Crawford2014-03-01-0/+0
| | |