Permalink
Browse files

rails 3.1 support

  • Loading branch information...
1 parent e44b54d commit 62fcad66dc8adaf713f4c3049853fd1a6176cdcc Francis Hwang committed Jul 31, 2011
Showing with 230 additions and 112 deletions.
  1. +12 −12 .gitignore
  2. +5 −14 Rakefile
  3. +1 −1 lib/admin_assistant.rb
  4. +6 −1 lib/admin_assistant/has_many_column.rb
  5. +5 −1 lib/admin_assistant/polymorphic_belongs_to_column.rb
  6. 0 {rails_3_test → rails_3_0}/.gitignore
  7. 0 {rails_3_test → rails_3_0}/Gemfile
  8. +1 −1 {rails_3_test → rails_3_0}/Gemfile.lock
  9. 0 {rails_3_test → rails_3_0}/README
  10. 0 {rails_3_test → rails_3_0}/Rakefile
  11. 0 {rails_3_test → rails_3_0}/app/controllers/admin/appointments2_controller.rb
  12. 0 {rails_3_test → rails_3_0}/app/controllers/admin/appointments_controller.rb
  13. 0 {rails_3_test → rails_3_0}/app/controllers/admin/blog_posts2_controller.rb
  14. 0 {rails_3_test → rails_3_0}/app/controllers/admin/blog_posts3_controller.rb
  15. 0 {rails_3_test → rails_3_0}/app/controllers/admin/blog_posts4_controller.rb
  16. 0 {rails_3_test → rails_3_0}/app/controllers/admin/blog_posts5_controller.rb
  17. 0 {rails_3_test → rails_3_0}/app/controllers/admin/blog_posts6_controller.rb
  18. 0 {rails_3_test → rails_3_0}/app/controllers/admin/blog_posts_controller.rb
  19. 0 {rails_3_test → rails_3_0}/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb
  20. 0 {rails_3_test → rails_3_0}/app/controllers/admin/blog_posts_read_only_controller.rb
  21. 0 {rails_3_test → rails_3_0}/app/controllers/admin/bookmarks_controller.rb
  22. 0 {rails_3_test → rails_3_0}/app/controllers/admin/comments2_controller.rb
  23. 0 {rails_3_test → rails_3_0}/app/controllers/admin/comments_controller.rb
  24. 0 {rails_3_test → rails_3_0}/app/controllers/admin/images2_controller.rb
  25. 0 {rails_3_test → rails_3_0}/app/controllers/admin/images_controller.rb
  26. 0 {rails_3_test → rails_3_0}/app/controllers/admin/misconfigured1_controller.rb
  27. 0 {rails_3_test → rails_3_0}/app/controllers/admin/not_migrated_yets_controller.rb
  28. 0 {rails_3_test → rails_3_0}/app/controllers/admin/product_categories2_controller.rb
  29. 0 {rails_3_test → rails_3_0}/app/controllers/admin/product_categories_controller.rb
  30. 0 {rails_3_test → rails_3_0}/app/controllers/admin/television_airings_controller.rb
  31. 0 {rails_3_test → rails_3_0}/app/controllers/admin/television_time_slots_controller.rb
  32. 0 {rails_3_test → rails_3_0}/app/controllers/admin/users2_controller.rb
  33. 0 {rails_3_test → rails_3_0}/app/controllers/admin/users_controller.rb
  34. 0 {rails_3_test → rails_3_0}/app/controllers/application_controller.rb
  35. 0 {rails_3_test → rails_3_0}/app/controllers/blog_posts_controller.rb
  36. 0 {rails_3_test → rails_3_0}/app/helpers/admin/appointments_helper.rb
  37. 0 {rails_3_test → rails_3_0}/app/helpers/admin/blog_posts2_helper.rb
  38. 0 {rails_3_test → rails_3_0}/app/helpers/admin/blog_posts3_helper.rb
  39. 0 {rails_3_test → rails_3_0}/app/helpers/admin/blog_posts4_helper.rb
  40. 0 {rails_3_test → rails_3_0}/app/helpers/admin/blog_posts6_helper.rb
  41. 0 {rails_3_test → rails_3_0}/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb
  42. 0 {rails_3_test → rails_3_0}/app/helpers/admin/blog_posts_helper.rb
  43. 0 {rails_3_test → rails_3_0}/app/helpers/admin/blog_posts_read_only_helper.rb
  44. 0 {rails_3_test → rails_3_0}/app/helpers/admin/bookmarks_helper.rb
  45. 0 {rails_3_test → rails_3_0}/app/helpers/admin/comments2_helper.rb
  46. 0 {rails_3_test → rails_3_0}/app/helpers/admin/comments_helper.rb
  47. 0 {rails_3_test → rails_3_0}/app/helpers/admin/images2_helper.rb
  48. 0 {rails_3_test → rails_3_0}/app/helpers/admin/images_helper.rb
  49. 0 {rails_3_test → rails_3_0}/app/helpers/admin/misconfigured1_helper.rb
  50. 0 {rails_3_test → rails_3_0}/app/helpers/admin/not_migrated_yets_helper.rb
  51. 0 {rails_3_test → rails_3_0}/app/helpers/admin/product_categories2_helper.rb
  52. 0 {rails_3_test → rails_3_0}/app/helpers/admin/product_categories_helper.rb
  53. 0 {rails_3_test → rails_3_0}/app/helpers/admin/television_airings_helper.rb
  54. 0 {rails_3_test → rails_3_0}/app/helpers/admin/television_time_slots_helper.rb
  55. 0 {rails_3_test → rails_3_0}/app/helpers/admin/users2_helper.rb
  56. 0 {rails_3_test → rails_3_0}/app/helpers/admin/users_helper.rb
  57. 0 {rails_3_test → rails_3_0}/app/helpers/application_helper.rb
  58. 0 {rails_3_test → rails_3_0}/app/models/appointment.rb
  59. 0 {rails_3_test → rails_3_0}/app/models/blog_post.rb
  60. 0 {rails_3_test → rails_3_0}/app/models/blog_post_tag.rb
  61. 0 {rails_3_test → rails_3_0}/app/models/bookmark.rb
  62. 0 {rails_3_test → rails_3_0}/app/models/comment.rb
  63. 0 {rails_3_test → rails_3_0}/app/models/image.rb
  64. 0 {rails_3_test → rails_3_0}/app/models/not_migrated_yet.rb
  65. 0 {rails_3_test → rails_3_0}/app/models/product.rb
  66. 0 {rails_3_test → rails_3_0}/app/models/product_category.rb
  67. 0 {rails_3_test → rails_3_0}/app/models/tag.rb
  68. 0 {rails_3_test → rails_3_0}/app/models/television_airing.rb
  69. 0 {rails_3_test → rails_3_0}/app/models/television_time_slot.rb
  70. 0 {rails_3_test → rails_3_0}/app/models/user.rb
  71. 0 {rails_3_test → rails_3_0}/app/views/admin/appointments/_subject_input.html.erb
  72. 0 {rails_3_test → rails_3_0}/app/views/admin/appointments2/_time_input.html.erb
  73. 0 {rails_3_test → rails_3_0}/app/views/admin/blog_posts2/_after_form.html.erb
  74. 0 {rails_3_test → rails_3_0}/app/views/admin/blog_posts2/_after_index.html.erb
  75. 0 {rails_3_test → rails_3_0}/app/views/admin/blog_posts2/_after_tags_input.html.erb
  76. 0 {rails_3_test → rails_3_0}/app/views/admin/blog_posts2/_before_index.html.erb
  77. 0 {rails_3_test → rails_3_0}/app/views/admin/blog_posts5/_after_index_header.html.erb
  78. 0 {rails_3_test → rails_3_0}/app/views/admin/blog_posts_read_only/_body_for_show.html.erb
  79. 0 {rails_3_test → rails_3_0}/app/views/layouts/admin.html.erb
  80. 0 {rails_3_test → rails_3_0}/app/views/layouts/application.html.erb
  81. 0 {rails_3_test → rails_3_0}/config.ru
  82. 0 {rails_3_test → rails_3_0}/config/application.rb
  83. 0 {rails_3_test → rails_3_0}/config/boot.rb
  84. 0 {rails_3_test → rails_3_0}/config/database.yml
  85. 0 {rails_3_test → rails_3_0}/config/environment.rb
  86. +0 −1 {rails_3_test → rails_3_0}/config/environments/development.rb
  87. 0 {rails_3_test → rails_3_0}/config/environments/production.rb
  88. 0 {rails_3_test → rails_3_0}/config/environments/test.rb
  89. 0 {rails_3_test → rails_3_0}/config/initializers/backtrace_silencers.rb
  90. 0 {rails_3_test → rails_3_0}/config/initializers/inflections.rb
  91. 0 {rails_3_test → rails_3_0}/config/initializers/mime_types.rb
  92. 0 {rails_3_test → rails_3_0}/config/initializers/secret_token.rb
  93. 0 {rails_3_test → rails_3_0}/config/initializers/session_store.rb
  94. 0 {rails_3_test → rails_3_0}/config/locales/en.yml
  95. +8 −0 rails_3_0/config/routes.rb
  96. 0 {rails_3_test → rails_3_0}/db/migrate/20090213215514_create_blog_posts.rb
  97. 0 {rails_3_test → rails_3_0}/db/migrate/20090217225542_add_body_to_blog_posts.rb
  98. 0 {rails_3_test → rails_3_0}/db/migrate/20090221220917_create_tags.rb
  99. 0 {rails_3_test → rails_3_0}/db/migrate/20090221220947_create_blog_post_tags.rb
  100. 0 {rails_3_test → rails_3_0}/db/migrate/20090222162204_add_textile_to_blog_posts.rb
  101. 0 {rails_3_test → rails_3_0}/db/migrate/20090222163231_add_published_at_to_blog_posts.rb
  102. 0 {rails_3_test → rails_3_0}/db/migrate/20090301191722_create_images.rb
  103. 0 {rails_3_test → rails_3_0}/db/migrate/20090305165345_create_accounts.rb
  104. 0 {rails_3_test → rails_3_0}/db/migrate/20090307225027_rename_accounts_to_users.rb
  105. 0 {rails_3_test → rails_3_0}/db/migrate/20090307225750_add_user_id_to_blog_posts.rb
  106. 0 {rails_3_test → rails_3_0}/db/migrate/20090309185114_change_blog_posts_textile.rb
  107. 0 {rails_3_test → rails_3_0}/db/migrate/20090309193635_create_products.rb
  108. 0 {rails_3_test → rails_3_0}/db/migrate/20090309203056_create_comments.rb
  109. 0 {rails_3_test → rails_3_0}/db/migrate/20090323005947_create_file_column_images.rb
  110. 0 {rails_3_test → rails_3_0}/db/migrate/20090326160049_add_birthday_to_users.rb
  111. 0 {rails_3_test → rails_3_0}/db/migrate/20090326223606_add_state_to_users.rb
  112. 0 {rails_3_test → rails_3_0}/db/migrate/20090503134004_add_file_column_image_to_products.rb
  113. 0 {rails_3_test → rails_3_0}/db/migrate/20090617173651_create_bookmarks.rb
  114. 0 {rails_3_test → rails_3_0}/db/migrate/20090624165355_add_tags_string_to_blog_post.rb
  115. 0 {rails_3_test → rails_3_0}/db/migrate/20090625144313_add_avatar_fields_to_user.rb
  116. 0 {rails_3_test → rails_3_0}/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb
  117. 0 {rails_3_test → rails_3_0}/db/migrate/20090701171857_add_force_textile_to_users.rb
  118. 0 {rails_3_test → rails_3_0}/db/migrate/20090704163647_add_deleted_at_to_products.rb
  119. 0 {rails_3_test → rails_3_0}/db/migrate/20090704173800_add_sale_fields_to_products.rb
  120. 0 {rails_3_test → rails_3_0}/db/migrate/20090714024501_create_product_categories.rb
  121. 0 {rails_3_test → rails_3_0}/db/migrate/20090819162835_add_admin_level_to_users.rb
  122. 0 {rails_3_test → rails_3_0}/db/migrate/20091115134559_add_first_and_last_names_to_users.rb
  123. 0 {rails_3_test → rails_3_0}/db/migrate/20091221011256_add_position_to_product_categories.rb
  124. 0 {rails_3_test → rails_3_0}/db/migrate/20091222160814_create_appointments.rb
  125. 0 {rails_3_test → rails_3_0}/db/migrate/20091227224547_add_user_id_to_appointments.rb
  126. 0 {rails_3_test → rails_3_0}/db/migrate/20100214213359_create_television_time_slots.rb
  127. 0 {rails_3_test → rails_3_0}/db/migrate/20100214213451_create_television_airings.rb
  128. 0 {rails_3_test → rails_3_0}/db/migrate/20110426215702_remove_avatar_fields_from_users.rb
  129. 0 {rails_3_test → rails_3_0}/db/seeds.rb
  130. 0 {rails_3_test → rails_3_0}/doc/README_FOR_APP
  131. 0 {rails_3_test → rails_3_0}/lib/tasks/.gitkeep
  132. 0 {rails_3_test → rails_3_0}/public/404.html
  133. 0 {rails_3_test → rails_3_0}/public/422.html
  134. 0 {rails_3_test → rails_3_0}/public/500.html
  135. 0 {rails_3_test → rails_3_0}/public/favicon.ico
  136. BIN {rails_3_test → rails_3_0}/public/images/rails.png
  137. 0 {rails_3_test → rails_3_0}/public/index.html
  138. 0 {rails_3_test → rails_3_0}/public/javascripts/application.js
  139. 0 {rails_3_test → rails_3_0}/public/javascripts/jquery-1.4.4.min.js
  140. 0 {rails_3_test → rails_3_0}/public/javascripts/rails.js
  141. 0 {rails_3_test → rails_3_0}/public/robots.txt
  142. 0 {rails_3_test → rails_3_0}/public/stylesheets/.gitkeep
  143. 0 {rails_3_test → rails_3_0}/public/stylesheets/admin.css
  144. 0 {rails_3_test → rails_3_0}/public/stylesheets/scaffold.css
  145. 0 {rails_3_test → rails_3_0}/script/rails
  146. BIN {rails_3_test → rails_3_0}/test/data/ruby_throated.jpg
  147. BIN {rails_3_test → rails_3_0}/test/data/tweenbot.jpg
  148. 0 {rails_3_test → rails_3_0}/test/fixtures/placeholder.txt
  149. 0 {rails_3_test → rails_3_0}/test/integration/admin/appointments2_integration_test.rb
  150. 0 {rails_3_test → rails_3_0}/test/integration/admin/appointments_integration_test.rb
  151. +2 −2 {rails_3_test → rails_3_0}/test/integration/admin/blog_posts2_integration_test.rb
  152. 0 {rails_3_test → rails_3_0}/test/integration/admin/blog_posts3_integration_test.rb
  153. 0 {rails_3_test → rails_3_0}/test/integration/admin/blog_posts4_integration_test.rb
  154. 0 {rails_3_test → rails_3_0}/test/integration/admin/blog_posts5_integration_test.rb
  155. 0 {rails_3_test → rails_3_0}/test/integration/admin/blog_posts6_integration_test.rb
  156. 0 {rails_3_test → rails_3_0}/test/integration/admin/blog_posts_custom_new_and_edit_integration_test.rb
  157. +8 −16 {rails_3_test → rails_3_0}/test/integration/admin/blog_posts_integration_test.rb
  158. 0 {rails_3_test → rails_3_0}/test/integration/admin/blog_posts_read_only_integration_test.rb
  159. 0 {rails_3_test → rails_3_0}/test/integration/admin/bookmarks_integration_test.rb
  160. 0 {rails_3_test → rails_3_0}/test/integration/admin/comments2_integration_test.rb
  161. 0 {rails_3_test → rails_3_0}/test/integration/admin/comments_integration_test.rb
  162. 0 {rails_3_test → rails_3_0}/test/integration/admin/images2_integration_test.rb
  163. 0 {rails_3_test → rails_3_0}/test/integration/admin/images_integration_test.rb
  164. 0 {rails_3_test → rails_3_0}/test/integration/admin/misconfigured1_integration_test.rb
  165. 0 {rails_3_test → rails_3_0}/test/integration/admin/product_categories2_integration_test.rb
  166. 0 {rails_3_test → rails_3_0}/test/integration/admin/product_categories_integration_test.rb
  167. 0 {rails_3_test → rails_3_0}/test/integration/admin/television_airings_integration_test.rb
  168. 0 {rails_3_test → rails_3_0}/test/integration/admin/users2_integration_test.rb
  169. 0 {rails_3_test → rails_3_0}/test/integration/admin/users_integration_test.rb
  170. 0 {rails_3_test → rails_3_0}/test/integration/blog_posts_integration_test.rb
  171. 0 {rails_3_test → rails_3_0}/test/performance/browsing_test.rb
  172. +40 −0 {rails_3_test → rails_3_0}/test/test_helper.rb
  173. 0 {rails_3_test → rails_3_0}/vendor/plugins/.gitkeep
  174. +12 −0 rails_3_1/Gemfile
  175. +116 −0 rails_3_1/Gemfile.lock
  176. +1 −0 rails_3_1/README
  177. +1 −0 rails_3_1/Rakefile
  178. +1 −0 rails_3_1/app
  179. +1 −0 rails_3_1/config
  180. +1 −0 rails_3_1/config.ru
  181. +1 −0 rails_3_1/db
  182. +1 −0 rails_3_1/doc
  183. +1 −0 rails_3_1/lib
  184. +1 −0 rails_3_1/log
  185. +1 −0 rails_3_1/public
  186. +1 −0 rails_3_1/script
  187. +1 −0 rails_3_1/test
  188. +1 −0 rails_3_1/tmp
  189. +1 −0 rails_3_1/vendor
  190. +0 −63 rails_3_test/config/routes.rb
View
@@ -1,16 +1,16 @@
pkg/*
-rails_*_test/db/*.sqlite3
-rails_*_test/log/*.log
-rails_*_test/db/schema.rb
-rails_*_test/public/images/*
-rails_*_test/public/javascripts/admin_assistant/*.js
-rails_*_test/public/stylesheets/admin_assistant/*.css
-rails_*_test/public/file_column_image/*
-rails_*_test/public/product/*
-rails_*_test/public/system/*
-rails_*_test/public/user/*
-rails_*_test/tmp/*
-rails_*_test/webrat-*.html
+rails_*/db/*.sqlite3
+rails_*/log/*.log
+rails_*/db/schema.rb
+rails_*/public/images/*
+rails_*/public/javascripts/admin_assistant/*.js
+rails_*/public/stylesheets/admin_assistant/*.css
+rails_*/public/file_column_image/*
+rails_*/public/product/*
+rails_*/public/system/*
+rails_*/public/user/*
+rails_*/tmp/*
+rails_*/webrat-*.html
website/_site
*.log
*~
View
@@ -26,20 +26,11 @@ end
desc 'Run all specs across all supported Rails gem versions.'
task :test do
- supported_versions = %w(3.0.6)
- locally_installed_versions =
- `gem list --local rails`.split(/\n/).
- detect { |l| l=~ /^rails / }.strip.
- gsub(/^.*\((.*)\).*$/, '\1').split(/\s*,\s*/)
- missing = supported_versions - locally_installed_versions
- if !missing.empty?
- puts "Missing Rails versions #{missing.join(',')}; please install and then re-run tests"
- else
- cmd = "cd rails_3_test && " + (
- supported_versions.map { |version|
- "echo '===== Testing #{version} =====' && RAILS_GEM_VERSION=#{version} bundle exec rake"
- }.join(" && ")
- )
+ base = Dir.pwd
+ version_dirs = %w(rails_3_0 rails_3_1)
+ version_dirs.each do |dir|
+ path = File.join(base, dir)
+ cmd = "cd #{path} && bundle exec rake"
puts cmd
puts `#{cmd}`
end
View
@@ -182,7 +182,7 @@ def url_params(a = action)
module ControllerMethods
def self.included(controller)
controller.extend ControllerClassMethods
- controller.class_inheritable_accessor :admin_assistant
+ controller.class_attribute :admin_assistant
end
end
@@ -14,8 +14,13 @@ def add_to_query_condition(ar_query_condition, search)
searchable_column_comparisons = searchable_columns.map { |column|
"LOWER(#{associated_class.table_name}.#{column.name}) like LOWER(#{sanitized_match_value})"
}
+ foreign_key = if @has_many_assoc.respond_to?(:foreign_key)
+ @has_many_assoc.foreign_key
+ else
+ @has_many_assoc.primary_key_name
+ end
condition_sql = <<-CONDITION_SQL
- #{model_class.table_name}.#{model_class.primary_key} in (select #{@has_many_assoc.primary_key_name} from #{associated_class.table_name} where #{searchable_column_comparisons.join(' or ')})
+ #{model_class.table_name}.#{model_class.primary_key} in (select #{foreign_key} from #{associated_class.table_name} where #{searchable_column_comparisons.join(' or ')})
CONDITION_SQL
ar_query_condition.sqls << condition_sql
end
@@ -44,7 +44,11 @@ def contains?(column_name)
end
def foreign_type_field
- @belongs_to_assoc.options[:foreign_type]
+ if @belongs_to_assoc.respond_to?(:foreign_type)
+ @belongs_to_assoc.foreign_type
+ else
+ @belongs_to_assoc.options[:foreign_type]
+ end
end
def match_text_fields_in_search
File renamed without changes.
File renamed without changes.
@@ -10,7 +10,7 @@ GIT
PATH
remote: ../../admin_assistant
specs:
- admin_assistant (2.0.0)
+ admin_assistant (2.0.1)
dynamic_form
will_paginate (= 3.0.pre2)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -11,7 +11,6 @@
# Show full error reports and disable caching
config.consider_all_requests_local = true
- config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
@@ -0,0 +1,8 @@
+Rails3Test::Application.routes.draw do
+ namespace :admin do
+ resources :comments
+ resources :users
+ end
+
+ resources :blog_posts
+end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -324,7 +324,7 @@ def test_index_when_there_is_one_record_and_15_or_less_users
assert_select("option[value=?]", @user.id)
end
end
-
+
# should show a link to /admin/comments/new
assert_select('td') do
assert_select(
@@ -632,7 +632,7 @@ def test_index_with_11_blog_posts
get "/admin/blog_posts2"
# should show link to page 2
- assert_select("a[href=/admin/blog_posts2?page=2]")
+ assert_will_paginate_link("/admin/blog_posts2", 2)
# should say 11 blog posts found
assert_match(/11 blog posts found/, response.body)
@@ -495,10 +495,8 @@ def test_index_pagination_with_51_records_when_looking_at_the_first_page
assert_response :success
# should have a link to the next page
- assert_select(
- "a[href=/admin/blog_posts?page=2]", 'Next &#8594;'
- )
- assert_select("a[href=/admin/blog_posts?page=2]", '2')
+ assert_will_paginate_link("/admin/blog_posts", 2, 'Next &#8594;')
+ assert_will_paginate_link("/admin/blog_posts", 2, '2')
# should not have a link to the previous page
assert_select(
@@ -522,16 +520,12 @@ def test_index_pagination_with_51_records_when_looking_at_the_second_page
assert_response :success
# should have a link to the next page
- assert_select(
- "a[href=/admin/blog_posts?page=3]", 'Next &#8594;'
- )
- assert_select("a[href=/admin/blog_posts?page=3]", '3')
+ assert_will_paginate_link("/admin/blog_posts", 3, 'Next &#8594;')
+ assert_will_paginate_link("/admin/blog_posts", 3, '3')
# should have a link to the previous page
- assert_select(
- "a[href=/admin/blog_posts?page=1]", '&#8592; Previous'
- )
- assert_select("a[href=/admin/blog_posts?page=1]", '1')
+ assert_will_paginate_link("/admin/blog_posts", 1, '&#8592; Previous')
+ assert_will_paginate_link("/admin/blog_posts", 1, '1')
# should the full number of posts found
assert_match(/51 blog posts found/, response.body)
@@ -555,10 +549,8 @@ def test_index_pagination_with_51_records_when_looking_at_the_third_page
assert_select("a[href=/admin/blog_posts?page=3]", false, '3')
# should have a link to the previous page
- assert_select(
- "a[href=/admin/blog_posts?page=2]", '&#8592; Previous'
- )
- assert_select("a[href=/admin/blog_posts?page=2]", '2')
+ assert_will_paginate_link("/admin/blog_posts", 2, '&#8592; Previous')
+ assert_will_paginate_link("/admin/blog_posts", 2, '2')
# should the full number of posts found
assert_match(/51 blog posts found/, response.body)
@@ -96,3 +96,43 @@ module Rails
config.mode = :rails
end
+class ActionController::IntegrationTest
+
+ # Rails 3.0 renders link hrefs like:
+ # /admin/comments/new?comment[blog_post_id]=1
+ # Rails 3.1 renders link hrefs like:
+ # /admin/comments/new?comment%5Bblog_post_id%5D=1
+
+ unless method_defined?(
+ :assert_select_with_preprocessed_hrefs_across_rails_versions
+ )
+ def assert_select_with_preprocessed_hrefs_across_rails_versions(*args)
+ old_args = args
+ args = []
+ args.unshift(old_args.shift)
+ until old_args.empty?
+ next_arg = old_args.shift
+ if next_arg.is_a?(String) && Rails.version =~ /^3.1/
+ next_arg.gsub!(/(\?\w+)\[/, '\1%5B')
+ next_arg.gsub!(/(\?\w+%5B\w+)\]/, '\1%5D')
+ end
+ args.push next_arg
+ end
+ assert_select_without_preprocessed_hrefs_across_rails_versions(*args)
+ end
+
+ alias_method_chain :assert_select,
+ :preprocessed_hrefs_across_rails_versions
+ end
+
+ def assert_will_paginate_link(base, page, content = nil)
+ select = []
+ if Rails.version =~ /^3.1/
+ select << "a[href=#{base}?escape=false&amp;page=#{page}]"
+ else
+ select << "a[href=#{base}?page=#{page}]"
+ end
+ select << content if content
+ assert_select(select)
+ end
+end
View
@@ -0,0 +1,12 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.1.0.rc5'
+
+gem 'admin_assistant', :path => "../../admin_assistant"
+gem 'paperclip', '2.3.11'
+gem 'sqlite3'
+
+group :development, :test do
+ gem 'json'
+ gem 'webrat', '>=0.7.2.pre', :git => 'http://github.com/kalv/webrat.git'
+end
View
@@ -0,0 +1,116 @@
+GIT
+ remote: http://github.com/kalv/webrat.git
+ revision: 66130e4b9e903e07cfa86286655bde439c7b376e
+ specs:
+ webrat (0.7.2.pre)
+ nokogiri (>= 1.2.0)
+ rack (>= 1.0)
+ rack-test (>= 0.5.3)
+
+PATH
+ remote: ../../admin_assistant
+ specs:
+ admin_assistant (2.0.1)
+ dynamic_form
+ will_paginate (= 3.0.pre2)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.0.rc5)
+ actionpack (= 3.1.0.rc5)
+ mail (~> 2.3.0)
+ actionpack (3.1.0.rc5)
+ activemodel (= 3.1.0.rc5)
+ activesupport (= 3.1.0.rc5)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.1)
+ rack-cache (~> 1.0.2)
+ rack-mount (~> 0.8.1)
+ rack-test (~> 0.6.0)
+ sprockets (~> 2.0.0.beta.12)
+ activemodel (3.1.0.rc5)
+ activesupport (= 3.1.0.rc5)
+ bcrypt-ruby (~> 2.1.4)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.0.rc5)
+ activemodel (= 3.1.0.rc5)
+ activesupport (= 3.1.0.rc5)
+ arel (~> 2.1.4)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.0.rc5)
+ activemodel (= 3.1.0.rc5)
+ activesupport (= 3.1.0.rc5)
+ activesupport (3.1.0.rc5)
+ multi_json (~> 1.0)
+ arel (2.1.4)
+ bcrypt-ruby (2.1.4)
+ builder (3.0.0)
+ dynamic_form (1.1.4)
+ erubis (2.7.0)
+ hike (1.2.0)
+ i18n (0.6.0)
+ json (1.5.3)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ multi_json (1.0.3)
+ nokogiri (1.5.0)
+ paperclip (2.3.11)
+ activerecord (>= 2.3.0)
+ activesupport (>= 2.3.2)
+ polyglot (0.3.2)
+ rack (1.3.2)
+ rack-cache (1.0.2)
+ rack (>= 0.4)
+ rack-mount (0.8.1)
+ rack (>= 1.0.0)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.1.0.rc5)
+ actionmailer (= 3.1.0.rc5)
+ actionpack (= 3.1.0.rc5)
+ activerecord (= 3.1.0.rc5)
+ activeresource (= 3.1.0.rc5)
+ activesupport (= 3.1.0.rc5)
+ bundler (~> 1.0)
+ railties (= 3.1.0.rc5)
+ railties (3.1.0.rc5)
+ actionpack (= 3.1.0.rc5)
+ activesupport (= 3.1.0.rc5)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2)
+ rdoc (3.9)
+ sprockets (2.0.0.beta.12)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (!= 1.3.0, ~> 1.1)
+ sqlite3 (1.3.4)
+ thor (0.14.6)
+ tilt (1.3.2)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.29)
+ will_paginate (3.0.pre2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ admin_assistant!
+ json
+ paperclip (= 2.3.11)
+ rails (= 3.1.0.rc5)
+ sqlite3
+ webrat (>= 0.7.2.pre)!
View
View
View
View
View
View
View
View
View
View
View
View
View
View
Oops, something went wrong.

0 comments on commit 62fcad6

Please sign in to comment.