Skip to content

Commit

Permalink
Fix the specs with the Rails 5 branch and the clear search button (#671)
Browse files Browse the repository at this point in the history
Fix clear search button to work with Rails 5
  • Loading branch information
danbee committed Oct 19, 2016
1 parent e533a60 commit 73d4d55
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions Appraisals
@@ -1,5 +1,6 @@
appraise "sass-3-4" do
gem "sass", "3.4.0"
gem "rails-controller-testing"
end

appraise "rails42" do
Expand Down
4 changes: 4 additions & 0 deletions app/helpers/administrate/application_helper.rb
Expand Up @@ -36,5 +36,9 @@ def svg_tag(asset, svg_id, options = {})
def sanitized_order_params
params.permit(:search, :id, :order, :page, :per_page, :direction)
end

def clear_search_params
params.except(:search, :page).permit(:order, :direction, :per_page)
end
end
end
2 changes: 1 addition & 1 deletion app/views/administrate/application/_search.html.erb
Expand Up @@ -14,7 +14,7 @@
Press enter to search
</span>
<span class="search__clear">
<%= link_to params.except(:search) do %>
<%= link_to clear_search_params do %>
<%= svg_tag "administrate/cancel.svg", "cancel-search", width: 16, height: 16 %>
<% end %>
</span>
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails42.gemfile
Expand Up @@ -5,6 +5,7 @@ source "https://rubygems.org"
gem "administrate-field-image", :git => "https://github.com/thoughtbot/administrate-field-image.git", :branch => "rails-5"
gem "bourbon", "~> 4.2"
gem "delayed_job_active_record"
gem "faker"
gem "high_voltage"
gem "markdown-rails"
gem "pg"
Expand All @@ -23,7 +24,6 @@ group :development, :test do
gem "byebug"
gem "dotenv-rails"
gem "factory_girl_rails"
gem "faker"
gem "i18n-tasks"
gem "pry-rails"
gem "rspec-rails", "~> 3.5.0"
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails50.gemfile
Expand Up @@ -5,6 +5,7 @@ source "https://rubygems.org"
gem "administrate-field-image", :git => "https://github.com/thoughtbot/administrate-field-image.git", :branch => "rails-5"
gem "bourbon", "~> 4.2"
gem "delayed_job_active_record"
gem "faker"
gem "high_voltage"
gem "markdown-rails"
gem "pg"
Expand All @@ -24,7 +25,6 @@ group :development, :test do
gem "byebug"
gem "dotenv-rails"
gem "factory_girl_rails"
gem "faker"
gem "i18n-tasks"
gem "pry-rails"
gem "rspec-rails", "~> 3.5.0"
Expand Down
3 changes: 2 additions & 1 deletion gemfiles/sass_3_4.gemfile
Expand Up @@ -5,12 +5,14 @@ source "https://rubygems.org"
gem "administrate-field-image", :git => "https://github.com/thoughtbot/administrate-field-image.git", :branch => "rails-5"
gem "bourbon", "~> 4.2"
gem "delayed_job_active_record"
gem "faker"
gem "high_voltage"
gem "markdown-rails"
gem "pg"
gem "redcarpet"
gem "unicorn"
gem "sass", "3.4.0"
gem "rails-controller-testing"

group :development do
gem "web-console", ">= 2.1.3"
Expand All @@ -23,7 +25,6 @@ group :development, :test do
gem "byebug"
gem "dotenv-rails"
gem "factory_girl_rails"
gem "faker"
gem "i18n-tasks"
gem "pry-rails"
gem "rspec-rails", "~> 3.5.0"
Expand Down
6 changes: 1 addition & 5 deletions spec/example_app/config/application.rb
Expand Up @@ -28,11 +28,7 @@ class Application < Rails::Application
generate.view_specs false
end

if Rails::VERSION::MAJOR < 5
config.action_controller.action_on_unpermitted_parameters = :raise
else
config.action_controller.action_on_unpermitted_parameters = :log
end
config.action_controller.action_on_unpermitted_parameters = :raise

# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
Expand Down

0 comments on commit 73d4d55

Please sign in to comment.