Skip to content

Commit

Permalink
Skip test that fails from outdated sqlite3 on travis
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrif committed Jun 2, 2015
1 parent de412ee commit b6b1390
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Expand Up @@ -50,6 +50,3 @@ services:
- rabbitmq
addons:
postgresql: "9.3"
apt:
packages:
- sqlite3
16 changes: 9 additions & 7 deletions activerecord/test/cases/relation_test.rb
Expand Up @@ -243,7 +243,13 @@ def test_respond_to_for_non_selected_element
end

def test_select_quotes_when_using_from_clause
ensure_sqlite3_version_doesnt_include_bug
if sqlite3_version_includes_quoting_bug?
skip <<-ERROR.squish
You are using an outdated version of SQLite3 which has a bug in
quoted column names. Please update SQLite3 and rebuild the sqlite3
ruby gem
ERROR
end
quoted_join = ActiveRecord::Base.connection.quote_table_name("join")
selected = Post.select(:join).from(Post.select("id as #{quoted_join}")).map(&:join)
assert_equal Post.pluck(:id), selected
Expand Down Expand Up @@ -286,16 +292,12 @@ def test_update_all_goes_through_normal_type_casting

private

def ensure_sqlite3_version_doesnt_include_bug
def sqlite3_version_includes_quoting_bug?
if current_adapter?(:SQLite3Adapter)
selected_quoted_column_names = ActiveRecord::Base.connection.exec_query(
'SELECT "join" FROM (SELECT id AS "join" FROM posts) subquery'
).columns
assert_equal ["join"], selected_quoted_column_names, <<-ERROR.squish
You are using an outdated version of SQLite3 which has a bug in
quoted column names. Please update SQLite3 and rebuild the sqlite3
ruby gem
ERROR
["join"] != selected_quoted_column_names
end
end
end
Expand Down

0 comments on commit b6b1390

Please sign in to comment.