Project

General

Profile

« Previous | Next » 

Revision 85a97146

Added by Dominic Cleal about 8 years ago

fixes #13244 - update Rails to 4.2.6

- Add responders gem to support class-level respond_to usage
- http://edgeguides.rubyonrails.org/4_2_release_notes.html#respond-with-class-level-respond-to
- Replace foreigner with native Rails 4.2 FK support
- uses a patch from Rails 5 to support Foreigner's
`foreign_key_exists?` helper for full compatibility
- `foreign_keys` should be avoided in favour of the higher level
methods as it throws a NotImplementedError on sqlite3
- Update DB adapter versions to match ActiveRecord
- Enable exceptions from after_commit handlers to detect more errors
- Change deprecated application config settings
- Remove test:lib chaining on rake test task
- 4.2 runs lib tasks automatically now, as test:run is redefined
to all _test files within test/ rather than units+functionals.
The task is still needed for the jenkins:* tasks.
- Fix deprecation of mailer #deliver method, change to #deliver_now
- Change CSRF test to use generated, not static tokens
- 4.2 changes CSRF tokens to be different on every request and
validated against the session, so use its generator to test the
controller behaviour instead of hardcoding tokens.
- Change test execution order to random

View differences:

test/unit/audit_mailer_test.rb
end
test 'Audit mail subject should be Audit summary' do
assert_not_nil(AuditMailer.summary(@options).deliver.subject)
assert_includes(AuditMailer.summary(@options).deliver.subject, _("Audit summary"))
assert_not_nil(AuditMailer.summary(@options).deliver_now.subject)
assert_includes(AuditMailer.summary(@options).deliver_now.subject, _("Audit summary"))
end
test 'Audit mail should support two mime-types' do
# text is first, html second
assert_equal(AuditMailer.summary(@options).deliver.body.parts.length, 2)
assert_equal(AuditMailer.summary(@options).deliver.body.parts.first.content_type, "text/plain; charset=UTF-8")
assert_equal(AuditMailer.summary(@options).deliver.body.parts.last.content_type, "text/html; charset=UTF-8")
assert_includes(AuditMailer.summary(@options).deliver.body.parts.last.body, "<body")
assert_equal(AuditMailer.summary(@options).deliver_now.body.parts.length, 2)
assert_equal(AuditMailer.summary(@options).deliver_now.body.parts.first.content_type, "text/plain; charset=UTF-8")
assert_equal(AuditMailer.summary(@options).deliver_now.body.parts.last.content_type, "text/html; charset=UTF-8")
assert_includes(AuditMailer.summary(@options).deliver_now.body.parts.last.body, "<body")
end
test 'Audit mail should display query results' do
@options[:query] = "action != #{@audit.action}"
refute_includes(AuditMailer.summary(@options).deliver.body.parts.first.body, "#{@audit.action}d")
refute_includes(AuditMailer.summary(@options).deliver_now.body.parts.first.body, "#{@audit.action}d")
end
test 'Audit mail should display total count of audits' do
@options[:time] = '1973-01-13 00:12'
count = Audit.all.count
number_of = Setting[:entries_per_page] > count ? count : Setting[:entries_per_page]
assert_includes(AuditMailer.summary(@options).deliver.body.parts.first.body, "Displaying #{number_of} of #{count} audits")
assert_includes(AuditMailer.summary(@options).deliver_now.body.parts.first.body, "Displaying #{number_of} of #{count} audits")
end
test 'Audit html mail should include link to query' do
@options[:time] = '1970-01-01'
@options[:query] = 'action = create'
query_should_be = CGI.escape(%(#{@options[:query]} and time >= "#{@options[:time]}"))
assert_includes(AuditMailer.summary(@options).deliver.body.parts.last.body, query_should_be)
assert_includes(AuditMailer.summary(@options).deliver_now.body.parts.last.body, query_should_be)
end
end

Also available in: Unified diff