Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Ensure test compatibility with Rails 3.2.x/4.0.x/4.1.x #44

Merged
merged 3 commits into from

2 participants

@tardate
Collaborator

As I started looking into (some other) bug, I first found I couldn't run the tests because of some recent Rails internals restructuring.

A couple of commits here that get me back to the point where I get green tests on Rails 3.2.x, 4.0.x and 4.1.x

NB: I pulled in #40 as part of the pull request

ktdreyer and others added some commits
@ktdreyer ktdreyer require timeout in tests
When running "testrb test/test_rails_autolink.rb", the test suite fails:

  NameError: uninitialized constant TestRailsAutolink::Timeout

Explicitly load the timeout gem during the tests to fix this error.
da6ff3c
@tardate tardate refactor Gemfile/tests to revive ability to run against Rails 3.2.x, …
…4.0.x, 4.1.x

* simplify required modules for tests to avoid version-specific breakage because of internal Rails refactoring
* Gemfile has notes on dependencies - it's not automatic
* mintiest pegged down for Rails 3.2.x to avoid assert_dom_equal issue
* if rails_autolink/helpers included before action_view/helpers, it was obscuring helper methods
6244a80
@tardate tardate make test_auto_link_email_addres_with_especial_chars work on Rails 3.x
 
* original from pull request #31
5e25346
@tardate tardate merged commit 5e25346 into tenderlove:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 7, 2013
  1. @ktdreyer

    require timeout in tests

    ktdreyer authored
    When running "testrb test/test_rails_autolink.rb", the test suite fails:
    
      NameError: uninitialized constant TestRailsAutolink::Timeout
    
    Explicitly load the timeout gem during the tests to fix this error.
Commits on Apr 17, 2014
  1. @tardate

    refactor Gemfile/tests to revive ability to run against Rails 3.2.x, …

    tardate authored
    …4.0.x, 4.1.x
    
    * simplify required modules for tests to avoid version-specific breakage because of internal Rails refactoring
    * Gemfile has notes on dependencies - it's not automatic
    * mintiest pegged down for Rails 3.2.x to avoid assert_dom_equal issue
    * if rails_autolink/helpers included before action_view/helpers, it was obscuring helper methods
  2. @tardate

    make test_auto_link_email_addres_with_especial_chars work on Rails 3.x

    tardate authored
     
    * original from pull request #31
This page is out of date. Refresh to see the latest.
Showing with 21 additions and 13 deletions.
  1. +9 −2 Gemfile
  2. +12 −11 test/test_rails_autolink.rb
View
11 Gemfile
@@ -1,6 +1,13 @@
source 'https://rubygems.org'
+# To test on latest Rails release, use the following:
gem 'rails'
-gem 'arel'
-gem 'rack'
gem 'minitest'
+
+# To test on Rails 4.0.x release, use the following e.g. for 4.0.1:
+# gem 'rails', '= 4.0.1'
+# gem 'minitest'
+
+# To test on Rails 3.2.x, use the following e.g. for 3.2.17:
+# gem 'rails', '= 3.2.17'
+# gem 'minitest', '= 4.2'
View
23 test/test_rails_autolink.rb
@@ -2,20 +2,16 @@
require "minitest/autorun"
require "rails"
-require "rails_autolink/helpers"
require 'erb'
require 'cgi'
-require 'active_support/core_ext/class/attribute_accessors'
+require 'active_support'
+require 'active_support/core_ext'
require 'action_pack'
-require 'action_view/helpers/capture_helper'
-require 'action_view/helpers/sanitize_helper'
-require 'action_view/helpers/url_helper'
-require 'action_view/helpers/tag_helper'
-require 'active_support/core_ext/module/attribute_accessors'
-require 'active_support/core_ext/string/encoding'
+require 'action_view'
+require 'action_view/helpers'
require 'action_dispatch/testing/assertions'
-require 'action_view/helpers/text_helper'
-require 'action_view/helpers/output_safety_helper'
+require 'timeout'
+require "rails_autolink/helpers"
class TestRailsAutolink < MiniTest::Unit::TestCase
include ActionView::Helpers::CaptureHelper
@@ -174,7 +170,12 @@ def test_auto_link_email_address
def test_auto_link_email_addres_with_especial_chars
email_raw = "and&re$la*+r-a.o'rea=l~ly@tenderlovemaking.com"
- email_sanitized = "and&amp;re$la*+r-a.o&#39;rea=l~ly@tenderlovemaking.com"
+ email_sanitized = if Rails.version =~ /^3/
+ # mail_to changed the number base it rendered HTML encoded characters at some point
+ "and&amp;re$la*+r-a.o&#x27;rea=l~ly@tenderlovemaking.com"
+ else
+ "and&amp;re$la*+r-a.o&#39;rea=l~ly@tenderlovemaking.com"
+ end
email_result = %{<a href="mailto:#{email_raw}">#{email_sanitized}</a>}
assert_equal email_result, auto_link(email_raw)
assert !auto_link_email_addresses(email_result).html_safe?, 'should not be html safe'
Something went wrong with that request. Please try again.