Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
how to test with and without strong_parameters?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Gary Weaver  
View profile  
 More options Oct 22 2012, 4:38 pm
From: Gary Weaver <garyswea...@gmail.com>
Date: Mon, 22 Oct 2012 13:38:53 -0700 (PDT)
Local: Mon, Oct 22 2012 4:38 pm
Subject: how to test with and without strong_parameters?

Recently integrated a patch for strong_parameters into a fork of
active_admin and wanted to add tests for it, but I'm not sure what the best
way of adding tests is for something that can optionally support
strong_parameters.

For those that are trying to write tests that support controller
functionality with and without strong_parameters in their gem, how do you
do that? (I guess this question will apply to those wanting to support both
rails 3 and 4 in a gem and be able to test controller additions without
having to have a separate fork for rails 4).

Is there a switch for enabling and disabling strong_parameters such that it
could be disabled and then just enable it for a single test?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gary Weaver  
View profile  
 More options Oct 29 2012, 12:05 pm
From: Gary Weaver <garyswea...@gmail.com>
Date: Mon, 29 Oct 2012 09:05:07 -0700 (PDT)
Local: Mon, Oct 29 2012 12:05 pm
Subject: Re: how to test with and without strong_parameters?

Just wanted to follow-up on this thread, even though it was answered in
another.

A feature addition to disable SP, somewhat similar to how whitelisting was
enabled/disabled in Rails 3 was turned down (who knows- maybe that will be
reconsidered at some point, but dhh said no). But for SP, in your tests
that use Rails 3.2, you may just be able to have models that and some that
don't include ActiveModel::ForbiddenAttributesProtection:
include ::ActiveModel::ForbiddenAttributesProtection

or something that was suggested was to use the appraisal gem:
https://github.com/thoughtbot/appraisal

And some projects like ActiveAdmin also have their own method to test with
different gemsets by including logic in the Gemfile, e.g. in v0.5.0's
Gemfile (in https://github.com/gregbell/active_admin/tree/v0.5.0):

ACTIVE_ADMIN_PATH = File.dirname(__FILE__) unless defined?(ACTIVE_ADMIN_PATH)

require File.expand_path('spec/support/detect_rails_version', ACTIVE_ADMIN_PATH)

rails_version = detect_rails_version
gem 'rails',          rails_version
#...

case rails_version
when /^3\.0/
  # Do nothing, bundler should figure it out
when /^3\.(1|2)/
  # These are the gems you have to have for Rails 3.1 to be happy
  gem 'sass-rails'
  gem 'uglifier'
else
  raise "Rails #{rails_version} is not supported yet"
end


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »