Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Rails4 fixes #468

Merged
merged 26 commits into from

5 participants

@caboteria

Building on work done by @PragTob and @ferrisoxide, here are the changes that I'm using to get Surveyor to work with Rails4. Rspec runs with only one failure on my machine (but that failure is also on NUBIC/rails4), and I've cleaned up all of the deprecation warnings and fixed a bunch of stuff that shows up at run-time.

Several months ago I tried to build the NUBIC rails4 branch but I couldn't get it to run the tests cleanly so I based my work on @ferrisoxide's. I have since (March 2014) merged NUBIC/rails4, although this currently causes one spec to fail.

Thanks for surveyor, it's a useful gem!

ferrisoxide and others added some commits
@ferrisoxide ferrisoxide Merge branch 'feature/rails_4' into develop 82aa04e
@ferrisoxide ferrisoxide merged ce35340
@ferrisoxide ferrisoxide updated README fb511b2
@caboteria caboteria pin database_cleaner to version 1.0.1
The tests were failing with:
~/.rvm/gems/ruby-2.0.0-p247/gems/database_cleaner-1.1.0/lib/database_cleaner/active_record/truncation.rb:123:in `db_version': undefined local variable or method `postgresql_version' for #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x007fd28ac70df8> (NameError)

Here's the bug report: DatabaseCleaner/database_cleaner#224

Looks like it might be a while until a fix happens so for the time
being we'll pin database_cleaner to version 1.0.1 which appears to
work.
4727a82
@caboteria caboteria replace rspec stub!() with stub() to quiet deprecation warnings
DEPRECATION: stub! is deprecated. Use stub instead. Called from ~/surveyor/spec/models/dependency_spec.rb:71:in `block (2 levels) in <top (required)>'.

http://www.mail-archive.com/rspec-users@rubyforge.org/msg13270.html

   The original method was stub!, which I will confess to introducing,
   and for the wrong reasons, due to my misunderstanding of the meaning
   of ! in ruby methods.

   I recently added stub (with no !) with no particular fanfare, as I
   don't intend to remove stub! (at least not any time soon). Right now
   the docs don't make it clear, so I need to fix that - but I'd say that
   stub() is the method to use and stub!() is there for backwards
   compatibility.
8ba5e96
@caboteria caboteria replace Relation#all with other methods to quiet deprecation warnings
DEPRECATION WARNING: Relation#all is deprecated. If you want to eager-load a relation, you can call #load (e.g. `Post.where(published: true).load`). If you want to get an array of records from a relation, you can call #to_a (e.g. `Post.where(published: true).to_a`). (called from to_hash at /Users/tcabot/Code/surveyor/lib/surveyor/models/dependency_condition_methods.rb:39)
b59ecfd
@caboteria caboteria refactor call to find(:first) to quiet deprecation warnings
DEPRECATION WARNING: Calling #find(:first) is deprecated. Please call #first directly instead. (called from edit at ~/surveyor/lib/surveyor/surveyor_controller_methods.rb:63)

Refactored so that we call either first() or find() depending on
whether we've got a primary key or not.
38f4b3d
@caboteria caboteria fix deprecation warnings about calling find_by with options
DEPRECATION WARNING: Calling find_by or find_by! methods with options is deprecated. Build a scope instead, e.g. User.where('age > 21').find_by_name('Jon'). (called from block in load_and_update_response_set at ~/surveyor/lib/surveyor/surveyor_controller_methods.rb:112)
50ba0fa
@caboteria caboteria fix deprecation warnings about calling scope() with a hash
DEPRECATION WARNING: Calling #scope or #default_scope with a hash is deprecated. Please use a lambda containing a scope. E.g. scope :red, -> { where(color: 'red') }. (called from included at ~/surveyor/lib/surveyor/models/answer_methods.rb:13)

We use instance_eval because we need the scope lambda to run in the
context of the including Class, not the Module in which the code is
defined.
ade06ea
@caboteria caboteria fix deprecation warnings relating to has_many declarations
DEPRECATION WARNING: The following options in your ResponseSet.has_many :responses declaration are deprecated: :order. Please use a scope block instead.

We use instance_eval because we need the scope lambda to run in the
context of the including Class, not the Module in which the code is
defined.
33a9f62
@caboteria caboteria removed "unloadable" declarations
They were causing circular dependency errors in development when
classes changed and had to be recompiled.  Turns out they're no longer
needed for Rails 4:

   thoughtbot/clearance#276
   thoughtbot/clearance#277

In development if I change one of the classes it recompiles, even
without the "unloadable" declaration, and I no longer get circular
dependency errors.
d6dbce5
@caboteria caboteria move images to where sprockets expects them to be
Sprockets expects images in an engine to be in an [engine name]
directory, but the jquery ui images weren't.

The jquery ui stylesheet had to change, too, to reference images
starting at "/" rather than relative URL's.
940b299
@caboteria caboteria fix code that figures out if the asset pipeline is enabled
The Rails3-compatible algorithm to figure out if the asset pipeline is
doesn't work with Rails4.  Quite frankly, the new one doesn't seem as
clean as the old one, but hopefully this code will work in all cases.

rails/rails#10334

Note that the specs didn't seem to test both cases, or else the image
path is now the same whether the pipeline is enabled or not, but in
any case the specs don't need to determine whether the pipeline is
enabled, they can use the same path in all cases.
0f56592
@caboteria caboteria added a dependency on rails-observers
This used to be part of core Rails but in 4.0 was moved into its own
gem, so we need to indicate that we depend on it.  Otherwise, in an
eager_load=true environment we'll get:
uninitialized constant ActionController::Caching::Sweeper
9e6b9c3
@caboteria caboteria fix slow_updates monkey patch
Needed to inherit from ApplicationController.
fa6a605
@caboteria caboteria add dependency on selenium-webdriver
Without the explicit dependency the tests would crash immediately.
d00f6c2
@caboteria caboteria downgrade back to older versions of cucumber-rails and capybara
I was hoping to upgrade these to the latest versions but they're
incompatible enough that it will take some effort to upgrade them.
7cd1253
@caboteria caboteria kludge: load formtastic enhancements explicitly
Many cucumber tests were failing because the views couldn't find a
"QuietInput" class.  It has something to do with dynamic reloading of
classes but I couldn't figure it out (sorry) so I fell back to loading
the classes explicitly before each scenario.  it's a kludge but it
works.
95c3c76
@caboteria caboteria fix regexp serialization
Evidently in Rails 3.x active record would implicitly serialize Regexp
fields into YAML so for, for example, the ValidationCondition regexp
field would be implicitly converted from /[0-9a-zA-z\. #]/ to "---
!ruby/regexp '/[0-9a-zA-z\\. #]/'\n" when the model was saved.  In 4.0
this implicit serialization doesn't happen so we need to tell AR to do
it explicitly using AR's serialize method.
1ab7347
@caboteria caboteria update database_cleaner
Database cleaner used to have a bug that caused our tests to fail, but
they've released 1.2.0 which works so we no longer need to pin to the
old 1.0.1 release.
4f75a6d
@caboteria caboteria fix deprecation warnings about #find(:first)
DEPRECATION WARNING: Calling #find(:first) is deprecated. Please call #first directly instead. You have also used finder options. These are also deprecated. Please build a scope instead of using finder options. (called from block (2 levels) in <top (required)> at /Users/tcabot/Code/surveyor/features/step_definitions/parser_steps.rb:85)
963b47d
@caboteria caboteria fix deprecation warnings about the :value option
DEPRECATION WARNING: The :value option is deprecated in favour of `:input_html => { :value => '...'}` and will be removed in the next version. (called from block (2 levels) in ___sers_tcabot__ode_surveyor_app_views_partials__question_html_haml__1185397536205946121_70301830176800 at /Users/tcabot/Code/surveyor/app/views/partials/_question.html.haml:15)
a99d13f
@caboteria caboteria fix deprecation warnings about find_all_by_ dynamic finder
DEPRECATION WARNING: This dynamic method is deprecated. Please use e.g. Post.where(...).all instead. (called from block in <top (required)> at /Users/tcabot/Code/surveyor/features/step_definitions/parser_steps.rb:136)
4024b31
@caboteria caboteria fix deprecation warnings about Hash#diff
DEPRECATION WARNING: Hash#diff is no longer used inside of Rails, and is being deprecated with no replacement. If you're using it to compare hashes for the purpose of testing, please use MiniTest's assert_equal instead. (called from unparse at /Users/tcabot/Code/surveyor/lib/surveyor/unparser.rb:32)

Since Rails' Hash#diff has no replacement I cribbed the code from Rails
and added it to Surveyor::Unparser, with only the changes needed to make
it take both hashes as parameters.  Now we'll be OK when Rails removes
Hash#diff.
597f9c7
@ferrisoxide

Awesome. I've been a bit slack with regards to surveyor but I'm getting back into the swing. Keen to start contributing to the Rails 4 branch. Will definitely be helping out here over. Well done caboteria

@caboteria caboteria Merge remote-tracking branch 'refs/remotes/nubic/rails4' into rails4
Conflicts:
	Gemfile.rails_version
	app/models/survey.rb
	features/step_definitions/parser_steps.rb
	features/support/slow_updates.rb
	lib/surveyor/models/answer_methods.rb
	lib/surveyor/models/question_methods.rb
	lib/surveyor/models/response_set_methods.rb
	lib/surveyor/models/survey_methods.rb
	lib/surveyor/models/survey_section_methods.rb
	lib/surveyor/models/validation_condition_methods.rb
	lib/surveyor/surveyor_controller_methods.rb
	lib/surveyor/unparser.rb
	spec/controllers/surveyor_controller_spec.rb
	surveyor.gemspec
baaa620
@caboteria caboteria fix ResponseSet spec
It didn't account for the new access patterns so we needed to add some
additional stubs.
5281b31
@yoon yoon commented on the diff
lib/surveyor/unparser.rb
@@ -6,6 +6,11 @@ def self.unparse(survey)
survey.unparse(dsl = "")
dsl
end
+
+ # cribbed from rails source: http://apidock.com/rails/v3.2.13/Hash/diff
+ def self.hash_diff(h1, h2)
@yoon Owner
yoon added a note

@caboteria Where is this used?

I was using hash_diff in the various unparse() methods in lib/surveyor/unparser.rb (see commit 597f9c7) but it looks as if you fixed the same issue in a different way and I took your changes over mine so that code might not be used anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@yoon yoon commented on the diff
surveyor.gemspec
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
s.add_dependency('rails', '>= 3.2')
s.add_dependency('haml', '~> 4.0')
+ s.add_dependency('rails-observers', '~> 0.1')
@yoon Owner
yoon added a note

@caboteria Unless I'm mistaken, we don't need observers any more

Cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@yoon yoon commented on the diff
...r/templates/db/migrate/add_display_type_to_answers.rb
@@ -2,13 +2,13 @@
class AddDisplayTypeToAnswers < ActiveRecord::Migration
def self.up
add_column :answers, :display_type, :string
- Answer.all.each{|a| a.update_attributes(:display_type => "hidden_label") if a.hide_label == true}
+ Answer.find_each{|a| a.update_attributes(:display_type => "hidden_label") if a.hide_label == true}
@yoon Owner
yoon added a note

@caboteria I have a hard time supporting changes in migrations that people might already have in their apps. Is this absolutely necessary?

The code is functionally equivalent and doesn't cause deprecation warnings, but if you can live with the warnings then it's not necessary, at least until whatever they're warning about is removed. I don't think it should cause any trouble, though, since it will generate the same results.

doesn't cause deprecation warnings

I don't think the old way would have caused deprecation warnings either. It's a weird quirk of Rails 4 that it wants you to change some_relation.all to some_relation.to_a, but does not warn about model_class.all or support model_class.to_a.

But I agree — find_each is functionally equivalent here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@yoon yoon merged commit 5281b31 into NUBIC:master

1 check failed

Details default The Travis CI build could not complete due to an error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 11, 2013
  1. @ferrisoxide
  2. @ferrisoxide

    merged

    ferrisoxide authored
  3. @ferrisoxide

    updated README

    ferrisoxide authored
Commits on Aug 15, 2013
  1. @caboteria

    pin database_cleaner to version 1.0.1

    caboteria authored
    The tests were failing with:
    ~/.rvm/gems/ruby-2.0.0-p247/gems/database_cleaner-1.1.0/lib/database_cleaner/active_record/truncation.rb:123:in `db_version': undefined local variable or method `postgresql_version' for #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x007fd28ac70df8> (NameError)
    
    Here's the bug report: DatabaseCleaner/database_cleaner#224
    
    Looks like it might be a while until a fix happens so for the time
    being we'll pin database_cleaner to version 1.0.1 which appears to
    work.
  2. @caboteria

    replace rspec stub!() with stub() to quiet deprecation warnings

    caboteria authored
    DEPRECATION: stub! is deprecated. Use stub instead. Called from ~/surveyor/spec/models/dependency_spec.rb:71:in `block (2 levels) in <top (required)>'.
    
    http://www.mail-archive.com/rspec-users@rubyforge.org/msg13270.html
    
       The original method was stub!, which I will confess to introducing,
       and for the wrong reasons, due to my misunderstanding of the meaning
       of ! in ruby methods.
    
       I recently added stub (with no !) with no particular fanfare, as I
       don't intend to remove stub! (at least not any time soon). Right now
       the docs don't make it clear, so I need to fix that - but I'd say that
       stub() is the method to use and stub!() is there for backwards
       compatibility.
  3. @caboteria

    replace Relation#all with other methods to quiet deprecation warnings

    caboteria authored
    DEPRECATION WARNING: Relation#all is deprecated. If you want to eager-load a relation, you can call #load (e.g. `Post.where(published: true).load`). If you want to get an array of records from a relation, you can call #to_a (e.g. `Post.where(published: true).to_a`). (called from to_hash at /Users/tcabot/Code/surveyor/lib/surveyor/models/dependency_condition_methods.rb:39)
  4. @caboteria

    refactor call to find(:first) to quiet deprecation warnings

    caboteria authored
    DEPRECATION WARNING: Calling #find(:first) is deprecated. Please call #first directly instead. (called from edit at ~/surveyor/lib/surveyor/surveyor_controller_methods.rb:63)
    
    Refactored so that we call either first() or find() depending on
    whether we've got a primary key or not.
  5. @caboteria

    fix deprecation warnings about calling find_by with options

    caboteria authored
    DEPRECATION WARNING: Calling find_by or find_by! methods with options is deprecated. Build a scope instead, e.g. User.where('age > 21').find_by_name('Jon'). (called from block in load_and_update_response_set at ~/surveyor/lib/surveyor/surveyor_controller_methods.rb:112)
  6. @caboteria

    fix deprecation warnings about calling scope() with a hash

    caboteria authored
    DEPRECATION WARNING: Calling #scope or #default_scope with a hash is deprecated. Please use a lambda containing a scope. E.g. scope :red, -> { where(color: 'red') }. (called from included at ~/surveyor/lib/surveyor/models/answer_methods.rb:13)
    
    We use instance_eval because we need the scope lambda to run in the
    context of the including Class, not the Module in which the code is
    defined.
  7. @caboteria

    fix deprecation warnings relating to has_many declarations

    caboteria authored
    DEPRECATION WARNING: The following options in your ResponseSet.has_many :responses declaration are deprecated: :order. Please use a scope block instead.
    
    We use instance_eval because we need the scope lambda to run in the
    context of the including Class, not the Module in which the code is
    defined.
Commits on Aug 16, 2013
  1. @caboteria

    removed "unloadable" declarations

    caboteria authored
    They were causing circular dependency errors in development when
    classes changed and had to be recompiled.  Turns out they're no longer
    needed for Rails 4:
    
       thoughtbot/clearance#276
       thoughtbot/clearance#277
    
    In development if I change one of the classes it recompiles, even
    without the "unloadable" declaration, and I no longer get circular
    dependency errors.
  2. @caboteria

    move images to where sprockets expects them to be

    caboteria authored
    Sprockets expects images in an engine to be in an [engine name]
    directory, but the jquery ui images weren't.
    
    The jquery ui stylesheet had to change, too, to reference images
    starting at "/" rather than relative URL's.
  3. @caboteria

    fix code that figures out if the asset pipeline is enabled

    caboteria authored
    The Rails3-compatible algorithm to figure out if the asset pipeline is
    doesn't work with Rails4.  Quite frankly, the new one doesn't seem as
    clean as the old one, but hopefully this code will work in all cases.
    
    rails/rails#10334
    
    Note that the specs didn't seem to test both cases, or else the image
    path is now the same whether the pipeline is enabled or not, but in
    any case the specs don't need to determine whether the pipeline is
    enabled, they can use the same path in all cases.
Commits on Dec 27, 2013
  1. @caboteria

    added a dependency on rails-observers

    caboteria authored
    This used to be part of core Rails but in 4.0 was moved into its own
    gem, so we need to indicate that we depend on it.  Otherwise, in an
    eager_load=true environment we'll get:
    uninitialized constant ActionController::Caching::Sweeper
  2. @caboteria

    fix slow_updates monkey patch

    caboteria authored
    Needed to inherit from ApplicationController.
Commits on Dec 30, 2013
  1. @caboteria

    add dependency on selenium-webdriver

    caboteria authored
    Without the explicit dependency the tests would crash immediately.
  2. @caboteria

    downgrade back to older versions of cucumber-rails and capybara

    caboteria authored
    I was hoping to upgrade these to the latest versions but they're
    incompatible enough that it will take some effort to upgrade them.
  3. @caboteria

    kludge: load formtastic enhancements explicitly

    caboteria authored
    Many cucumber tests were failing because the views couldn't find a
    "QuietInput" class.  It has something to do with dynamic reloading of
    classes but I couldn't figure it out (sorry) so I fell back to loading
    the classes explicitly before each scenario.  it's a kludge but it
    works.
  4. @caboteria

    fix regexp serialization

    caboteria authored
    Evidently in Rails 3.x active record would implicitly serialize Regexp
    fields into YAML so for, for example, the ValidationCondition regexp
    field would be implicitly converted from /[0-9a-zA-z\. #]/ to "---
    !ruby/regexp '/[0-9a-zA-z\\. #]/'\n" when the model was saved.  In 4.0
    this implicit serialization doesn't happen so we need to tell AR to do
    it explicitly using AR's serialize method.
  5. @caboteria

    update database_cleaner

    caboteria authored
    Database cleaner used to have a bug that caused our tests to fail, but
    they've released 1.2.0 which works so we no longer need to pin to the
    old 1.0.1 release.
  6. @caboteria

    fix deprecation warnings about #find(:first)

    caboteria authored
    DEPRECATION WARNING: Calling #find(:first) is deprecated. Please call #first directly instead. You have also used finder options. These are also deprecated. Please build a scope instead of using finder options. (called from block (2 levels) in <top (required)> at /Users/tcabot/Code/surveyor/features/step_definitions/parser_steps.rb:85)
  7. @caboteria

    fix deprecation warnings about the :value option

    caboteria authored
    DEPRECATION WARNING: The :value option is deprecated in favour of `:input_html => { :value => '...'}` and will be removed in the next version. (called from block (2 levels) in ___sers_tcabot__ode_surveyor_app_views_partials__question_html_haml__1185397536205946121_70301830176800 at /Users/tcabot/Code/surveyor/app/views/partials/_question.html.haml:15)
  8. @caboteria

    fix deprecation warnings about find_all_by_ dynamic finder

    caboteria authored
    DEPRECATION WARNING: This dynamic method is deprecated. Please use e.g. Post.where(...).all instead. (called from block in <top (required)> at /Users/tcabot/Code/surveyor/features/step_definitions/parser_steps.rb:136)
  9. @caboteria

    fix deprecation warnings about Hash#diff

    caboteria authored
    DEPRECATION WARNING: Hash#diff is no longer used inside of Rails, and is being deprecated with no replacement. If you're using it to compare hashes for the purpose of testing, please use MiniTest's assert_equal instead. (called from unparse at /Users/tcabot/Code/surveyor/lib/surveyor/unparser.rb:32)
    
    Since Rails' Hash#diff has no replacement I cribbed the code from Rails
    and added it to Surveyor::Unparser, with only the changes needed to make
    it take both hashes as parameters.  Now we'll be OK when Rails removes
    Hash#diff.
Commits on Mar 24, 2014
  1. @caboteria

    Merge remote-tracking branch 'refs/remotes/nubic/rails4' into rails4

    caboteria authored
    Conflicts:
    	Gemfile.rails_version
    	app/models/survey.rb
    	features/step_definitions/parser_steps.rb
    	features/support/slow_updates.rb
    	lib/surveyor/models/answer_methods.rb
    	lib/surveyor/models/question_methods.rb
    	lib/surveyor/models/response_set_methods.rb
    	lib/surveyor/models/survey_methods.rb
    	lib/surveyor/models/survey_section_methods.rb
    	lib/surveyor/models/validation_condition_methods.rb
    	lib/surveyor/surveyor_controller_methods.rb
    	lib/surveyor/unparser.rb
    	spec/controllers/surveyor_controller_spec.rb
    	surveyor.gemspec
  2. @caboteria

    fix ResponseSet spec

    caboteria authored
    It didn't account for the new access patterns so we needed to add some
    additional stubs.
This page is out of date. Refresh to see the latest.
Showing with 105 additions and 74 deletions.
  1. +1 −1  Gemfile.rails_version
  2. +14 −6 README.md
  3. +1 −1  app/controllers/surveyor_controller.rb
  4. +1 −1  app/models/question.rb
  5. +1 −1  app/models/response_set.rb
  6. +1 −1  app/models/validation.rb
  7. +1 −1  app/views/partials/_question.html.haml
  8. +16 −16 features/step_definitions/parser_steps.rb
  9. +3 −3 features/step_definitions/surveyor_steps.rb
  10. +7 −0 features/support/env.rb
  11. +12 −10 features/support/slow_updates.rb
  12. 0  lib/assets/images/{ → surveyor}/ui-bg_flat_0_aaaaaa_40x100.png
  13. 0  lib/assets/images/{ → surveyor}/ui-bg_flat_75_ffffff_40x100.png
  14. 0  lib/assets/images/{ → surveyor}/ui-bg_glass_55_fbf9ee_1x400.png
  15. 0  lib/assets/images/{ → surveyor}/ui-bg_glass_65_ffffff_1x400.png
  16. 0  lib/assets/images/{ → surveyor}/ui-bg_glass_75_dadada_1x400.png
  17. 0  lib/assets/images/{ → surveyor}/ui-bg_glass_75_e6e6e6_1x400.png
  18. 0  lib/assets/images/{ → surveyor}/ui-bg_glass_95_fef1ec_1x400.png
  19. 0  lib/assets/images/{ → surveyor}/ui-bg_highlight-soft_75_cccccc_1x100.png
  20. 0  lib/assets/images/{ → surveyor}/ui-icons_222222_256x240.png
  21. 0  lib/assets/images/{ → surveyor}/ui-icons_2e83ff_256x240.png
  22. 0  lib/assets/images/{ → surveyor}/ui-icons_454545_256x240.png
  23. 0  lib/assets/images/{ → surveyor}/ui-icons_888888_256x240.png
  24. 0  lib/assets/images/{ → surveyor}/ui-icons_cd0a0a_256x240.png
  25. +17 −17 lib/assets/stylesheets/surveyor/jquery-ui-1.10.0.custom.css
  26. +2 −2 lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb
  27. +7 −2 lib/surveyor/helpers/asset_pipeline.rb
  28. +1 −1  lib/surveyor/models/validation_condition_methods.rb
  29. +1 −1  lib/surveyor/surveyor_controller_methods.rb
  30. +5 −0 lib/surveyor/unparser.rb
  31. +6 −0 spec/controllers/surveyor_controller_spec.rb
  32. +2 −3 spec/helpers/surveyor_helper_spec.rb
  33. +2 −3 spec/models/answer_spec.rb
  34. +1 −1  spec/models/dependency_spec.rb
  35. +1 −2  spec/models/question_spec.rb
  36. +1 −1  spec/models/validation_condition_spec.rb
  37. +1 −0  surveyor.gemspec
View
2  Gemfile.rails_version
@@ -21,4 +21,4 @@ when /^4.0/
gem 'therubyracer', platforms: :ruby
else
fail "Unsupported Rails version #{ENV['RAILS_VERSION']}"
-end
+end
View
20 README.md
@@ -17,18 +17,17 @@ without maintaining a fork.
## Requirements
-Surveyor works with:
+Please note: this fork of surveyor works with:
-* Ruby 1.9.2, and 1.9.3
-* Rails 3.1-3.2
-
-In keeping with the Rails team maintenance [policy] we no longer support Rails 3.0 (stick with v1.3.0 if you need Rails 3.0) or Ruby 1.8.7 (stick with v1.4.0 if you need Ruby 1.8.7).
+* Ruby 2.0.0 (may work on 1.9 but not tested)
+* Rails 4.0
Some key dependencies are:
* HAML
* Sass
* Formtastic
+* Protected Attributes (NB: will be removed in future version)
A more exhaustive list can be found in the [gemspec][].
@@ -39,8 +38,16 @@ A more exhaustive list can be found in the [gemspec][].
Add surveyor to your Gemfile:
- gem "surveyor"
+ gem 'surveyor', :git => 'git://github.com/ferrisoxide/surveyor.git'
+ gem 'protected_attributes'
+
+Add the following to your application.rb config section
+ config.active_record.mass_assignment_sanitizer = :strict
+ config.active_record.whitelist_attributes = true
+
+Please note, the protected_attributes gem will be removed in a future version. These config settings will also be deprecated in favour of Rails 4's Strong Parameters.
+
Bundle, install, and migrate:
bundle install
@@ -148,6 +155,7 @@ Take a look at our [screencast][] (a bit dated now).
To work on the code, fork this github project. Install [bundler][] if
you don't have it, then bundle, generate the app in `testbed`, and run the specs and features
+ $ export RAILS_VERSION=4.0
$ bundle update
$ bundle exec rake testbed
$ bundle exec rake spec
View
2  app/controllers/surveyor_controller.rb
@@ -2,4 +2,4 @@
# The "resource" is a survey attempt/session populating a response set.
class SurveyorController < ApplicationController
include Surveyor::SurveyorControllerMethods
-end
+end
View
2  app/models/question.rb
@@ -1,3 +1,3 @@
class Question < ActiveRecord::Base
include Surveyor::Models::QuestionMethods
-end
+end
View
2  app/models/response_set.rb
@@ -1,3 +1,3 @@
class ResponseSet < ActiveRecord::Base
include Surveyor::Models::ResponseSetMethods
-end
+end
View
2  app/models/validation.rb
@@ -1,3 +1,3 @@
class Validation < ActiveRecord::Base
include Surveyor::Models::ValidationMethods
-end
+end
View
2  app/views/partials/_question.html.haml
@@ -12,7 +12,7 @@
- i = response_idx
= f.semantic_fields_for i, r do |ff|
= ff.input :question_id, :as => :quiet
- = ff.input :response_group, :as => :quiet, :value => rg if g && g.display_type == "repeater"
+ = ff.input :response_group, :as => :quiet, :input_html => {:value => rg} if g && g.display_type == "repeater"
= ff.input :api_id, :as => :quiet
= ff.input :answer_id, :as => :select, :collection => q.answers.map{|a| [a.text, a.id]}, :include_blank => (renderer != :slider), :label => q.text, :input_html => { :disabled => disabled }
- else # :default, :inline, :inline_default
View
32 features/step_definitions/parser_steps.rb
@@ -27,28 +27,28 @@
Then /^there should be (\d+) survey(?:s?) with:$/ do |x, table|
Survey.count.should == x.to_i
table.hashes.each do |hash|
- Survey.first(:conditions => hash).should_not be_nil
+ Survey.where(hash).first.should_not be_nil
end
end
Then /^there should be (\d+) translations with$/ do |x, table|
SurveyTranslation.count.should == x.to_i
table.hashes.each do |hash|
- SurveyTranslation.first(:conditions => hash).should_not be_nil
+ SurveyTranslation.where(hash).first.should_not be_nil
end
end
Then /^there should be (\d+) section(?:s?) with:$/ do |x, table|
SurveySection.count.should == x.to_i
table.hashes.each do |hash|
- SurveySection.first(:conditions => hash).should_not be_nil
+ SurveySection.where(hash).first.should_not be_nil
end
end
Then /^there should be (\d+) question groups with:$/ do |x, table|
QuestionGroup.count.should == x.to_i
table.hashes.each do |hash|
- QuestionGroup.first(:conditions => hash).should_not be_nil
+ QuestionGroup.where(hash).first.should_not be_nil
end
end
@@ -60,7 +60,7 @@
if hash.has_key?("is_mandatory")
hash["is_mandatory"] = (hash["is_mandatory"] == "true" ? true : (hash["is_mandatory"] == "false" ? false : hash["is_mandatory"]))
end
- result = Question.first(:conditions => hash)
+ result = Question.where(hash).first
puts hash if result.nil?
result.should_not be_nil
end
@@ -68,21 +68,21 @@
Then /^there should be (\d+) question(?:s?) with a correct answer$/ do |x|
Question.count(:conditions => "correct_answer_id NOT NULL").should == x.to_i
- Question.all(:conditions => "correct_answer_id NOT NULL").compact.map(&:correct_answer).compact.size.should == x.to_i
+ Question.where("correct_answer_id NOT NULL").compact.map(&:correct_answer).compact.size.should == x.to_i
end
Then /^there should be (\d+) answer(?:s?) with:$/ do |x, table|
Answer.count.should == x.to_i
table.hashes.each do |hash|
hash["reference_identifier"] = nil if hash["reference_identifier"] == "nil"
- Answer.first(:conditions => hash).should_not be_nil
+ Answer.where(hash).first.should_not be_nil
end
end
Then /^there should be (\d+) dependenc(?:y|ies) with:$/ do |x, table|
Dependency.count.should == x.to_i
table.hashes.each do |hash|
- Dependency.first(:conditions => hash).should_not be_nil
+ Dependency.where(hash).first.should_not be_nil
end
end
@@ -97,14 +97,14 @@
hash.merge!({ :question_id => question.id })
if hash.has_key?("answer_reference")
- answer = Answer.first(:conditions => { :question_id => question.id, :reference_identifier => hash.delete("answer_reference") })
+ answer = Answer.where(:question_id => question.id, :reference_identifier => hash.delete("answer_reference")).first
answer.should_not be_nil
hash.merge!({ :answer_id => answer.id })
end
end
- d = DependencyCondition.first(:conditions => hash)
+ d = DependencyCondition.where(hash).first
d.should_not be_nil
d.question.should_not be_nil
d.answer.should_not be_nil unless d.operator.match(/^count[<>=!]{1,2}\d+/)
@@ -115,7 +115,7 @@
Then /^there should be (\d+) validation(?:s?) with:$/ do |x, table|
Validation.count.should == x.to_i
table.hashes.each do |hash|
- Validation.first(:conditions => hash).should_not be_nil
+ Validation.where(hash).first.should_not be_nil
end
end
@@ -123,7 +123,7 @@
ValidationCondition.count.should == x.to_i
table.hashes.each do |hash|
hash["integer_value"] = nil if hash["integer_value"] == "nil"
- ValidationCondition.first(:conditions => hash).should_not be_nil
+ ValidationCondition.where(hash).first.should_not be_nil
end
end
@@ -133,13 +133,13 @@
end
Then /^(\d+) dependencies should depend on questions$/ do |x|
- arr = Dependency.find_all_by_question_group_id(nil)
- arr.size.should == 2
+ arr = Dependency.where(:question_group_id => nil)
+ arr.count.should == 2
arr.each{|d| d.question.should_not be_nil}
end
Then /^(\d+) dependencies should depend on question groups$/ do |x|
- arr = Dependency.find_all_by_question_id(nil)
- arr.size.should == 2
+ arr = Dependency.where(:question_id => nil)
+ arr.count.should == 2
arr.each{|d| d.question_group.should_not be_nil}
end
View
6 features/step_definitions/surveyor_steps.rb
@@ -45,12 +45,12 @@
if hash.keys == ["answer"]
a = Answer.find_by_text(hash["answer"])
a.should_not be_nil
- Response.first(:conditions => {:answer_id => a.id}).should_not be_nil
+ Response.where(:answer_id => a.id).first.should_not be_nil
else
if !(a = hash.delete("answer")).blank? and !(answer = Answer.find_by_text(a)).blank?
- Response.first(:conditions => hash.merge({:answer_id => answer.id})).should_not be_nil
+ Response.where(hash.merge({:answer_id => answer.id})).first.should_not be_nil
elsif
- Response.first(:conditions => hash).should_not be_nil
+ Response.where(hash).first.should_not be_nil
end
end
end
View
7 features/support/env.rb
@@ -48,6 +48,13 @@
Before do |scenario|
Rails.logger.info "\n\nBeginning scenario #{scenario.file_colon_line} \"#{scenario.title}\""
+ # SMELL: this is a kludge, and I'm not sure why we need to do this,
+ # but if we don't, many cucumber tests fail because the app can't
+ # find the QuietInput class, which is a custom surveyor formtastic
+ # enhancement. This page suggested this kludge, but there should be
+ # a cleaner way to handle this.
+ # https://github.com/jonleighton/spring/issues/95
+ Dir["app/inputs/*_input.rb"].each { |f| require File.basename(f) }
end
require "json_spec/cucumber"
View
22 features/support/slow_updates.rb
@@ -1,13 +1,15 @@
-# # It appears that rails caches the filter chain after the first request. We
-# # can't wait and only apply this if any @slow_updates scenarios are executed.
-# class SurveyorController
-# before_filter(:only => :update) do
-# if $delay_updates
-# Rails.logger.info "Slowing things down."
-# sleep 2
-# end
-# end
-# end
+require_relative '../../app/controllers/surveyor_controller'
+
+# It appears that rails caches the filter chain after the first request. We
+# can't wait and only apply this if any @slow_updates scenarios are executed.
+class SurveyorController < ApplicationController
+ before_filter(:only => :update) do
+ if $delay_updates
+ Rails.logger.info "Slowing things down."
+ sleep 2
+ end
+ end
+end
# Before('@slow_updates') do
# $delay_updates = true
View
0  ...ets/images/ui-bg_flat_0_aaaaaa_40x100.png → ...s/surveyor/ui-bg_flat_0_aaaaaa_40x100.png
File renamed without changes
View
0  ...ts/images/ui-bg_flat_75_ffffff_40x100.png → .../surveyor/ui-bg_flat_75_ffffff_40x100.png
File renamed without changes
View
0  ...ts/images/ui-bg_glass_55_fbf9ee_1x400.png → .../surveyor/ui-bg_glass_55_fbf9ee_1x400.png
File renamed without changes
View
0  ...ts/images/ui-bg_glass_65_ffffff_1x400.png → .../surveyor/ui-bg_glass_65_ffffff_1x400.png
File renamed without changes
View
0  ...ts/images/ui-bg_glass_75_dadada_1x400.png → .../surveyor/ui-bg_glass_75_dadada_1x400.png
File renamed without changes
View
0  ...ts/images/ui-bg_glass_75_e6e6e6_1x400.png → .../surveyor/ui-bg_glass_75_e6e6e6_1x400.png
File renamed without changes
View
0  ...ts/images/ui-bg_glass_95_fef1ec_1x400.png → .../surveyor/ui-bg_glass_95_fef1ec_1x400.png
File renamed without changes
View
0  .../ui-bg_highlight-soft_75_cccccc_1x100.png → .../ui-bg_highlight-soft_75_cccccc_1x100.png
File renamed without changes
View
0  ...assets/images/ui-icons_222222_256x240.png → ...ages/surveyor/ui-icons_222222_256x240.png
File renamed without changes
View
0  ...assets/images/ui-icons_2e83ff_256x240.png → ...ages/surveyor/ui-icons_2e83ff_256x240.png
File renamed without changes
View
0  ...assets/images/ui-icons_454545_256x240.png → ...ages/surveyor/ui-icons_454545_256x240.png
File renamed without changes
View
0  ...assets/images/ui-icons_888888_256x240.png → ...ages/surveyor/ui-icons_888888_256x240.png
File renamed without changes
View
0  ...assets/images/ui-icons_cd0a0a_256x240.png → ...ages/surveyor/ui-icons_cd0a0a_256x240.png
File renamed without changes
View
34 lib/assets/stylesheets/surveyor/jquery-ui-1.10.0.custom.css
@@ -527,7 +527,7 @@ button.ui-button::-moz-focus-inner {
height: 100%;
}
.ui-progressbar .ui-progressbar-overlay {
- background: url("images/animated-overlay.gif");
+ background: url("/images/animated-overlay.gif");
height: 100%;
filter: alpha(opacity=25);
opacity: 0.25;
@@ -798,7 +798,7 @@ body .ui-tooltip {
}
.ui-widget-content {
border: 1px solid #aaaaaa;
- background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;
+ background: #ffffff url(/images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;
color: #222222;
}
.ui-widget-content a {
@@ -806,7 +806,7 @@ body .ui-tooltip {
}
.ui-widget-header {
border: 1px solid #aaaaaa;
- background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;
+ background: #cccccc url(/images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;
color: #222222;
font-weight: bold;
}
@@ -820,7 +820,7 @@ body .ui-tooltip {
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default {
border: 1px solid #d3d3d3;
- background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x;
+ background: #e6e6e6 url(/images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x;
font-weight: normal;
color: #555555;
}
@@ -837,7 +837,7 @@ body .ui-tooltip {
.ui-widget-content .ui-state-focus,
.ui-widget-header .ui-state-focus {
border: 1px solid #999999;
- background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x;
+ background: #dadada url(/images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x;
font-weight: normal;
color: #212121;
}
@@ -852,7 +852,7 @@ body .ui-tooltip {
.ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active {
border: 1px solid #aaaaaa;
- background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;
+ background: #ffffff url(/images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;
font-weight: normal;
color: #212121;
}
@@ -869,7 +869,7 @@ body .ui-tooltip {
.ui-widget-content .ui-state-highlight,
.ui-widget-header .ui-state-highlight {
border: 1px solid #fcefa1;
- background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x;
+ background: #fbf9ee url(/images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x;
color: #363636;
}
.ui-state-highlight a,
@@ -881,7 +881,7 @@ body .ui-tooltip {
.ui-widget-content .ui-state-error,
.ui-widget-header .ui-state-error {
border: 1px solid #cd0a0a;
- background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;
+ background: #fef1ec url(/images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;
color: #cd0a0a;
}
.ui-state-error a,
@@ -928,27 +928,27 @@ body .ui-tooltip {
}
.ui-icon,
.ui-widget-content .ui-icon {
- background-image: url(images/ui-icons_222222_256x240.png);
+ background-image: url(/images/ui-icons_222222_256x240.png);
}
.ui-widget-header .ui-icon {
- background-image: url(images/ui-icons_222222_256x240.png);
+ background-image: url(/images/ui-icons_222222_256x240.png);
}
.ui-state-default .ui-icon {
- background-image: url(images/ui-icons_888888_256x240.png);
+ background-image: url(/images/ui-icons_888888_256x240.png);
}
.ui-state-hover .ui-icon,
.ui-state-focus .ui-icon {
- background-image: url(images/ui-icons_454545_256x240.png);
+ background-image: url(/images/ui-icons_454545_256x240.png);
}
.ui-state-active .ui-icon {
- background-image: url(images/ui-icons_454545_256x240.png);
+ background-image: url(/images/ui-icons_454545_256x240.png);
}
.ui-state-highlight .ui-icon {
- background-image: url(images/ui-icons_2e83ff_256x240.png);
+ background-image: url(/images/ui-icons_2e83ff_256x240.png);
}
.ui-state-error .ui-icon,
.ui-state-error-text .ui-icon {
- background-image: url(images/ui-icons_cd0a0a_256x240.png);
+ background-image: url(/images/ui-icons_cd0a0a_256x240.png);
}
/* positioning */
@@ -1160,14 +1160,14 @@ body .ui-tooltip {
/* Overlays */
.ui-widget-overlay {
- background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
+ background: #aaaaaa url(/images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
opacity: .3;
filter: Alpha(Opacity=30);
}
.ui-widget-shadow {
margin: -8px 0 0 -8px;
padding: 8px;
- background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
+ background: #aaaaaa url(/images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
opacity: .3;
filter: Alpha(Opacity=30);
border-radius: 8px;
View
4 lib/generators/surveyor/templates/db/migrate/add_display_type_to_answers.rb
@@ -2,13 +2,13 @@
class AddDisplayTypeToAnswers < ActiveRecord::Migration
def self.up
add_column :answers, :display_type, :string
- Answer.all.each{|a| a.update_attributes(:display_type => "hidden_label") if a.hide_label == true}
+ Answer.find_each{|a| a.update_attributes(:display_type => "hidden_label") if a.hide_label == true}
@yoon Owner
yoon added a note

@caboteria I have a hard time supporting changes in migrations that people might already have in their apps. Is this absolutely necessary?

The code is functionally equivalent and doesn't cause deprecation warnings, but if you can live with the warnings then it's not necessary, at least until whatever they're warning about is removed. I don't think it should cause any trouble, though, since it will generate the same results.

doesn't cause deprecation warnings

I don't think the old way would have caused deprecation warnings either. It's a weird quirk of Rails 4 that it wants you to change some_relation.all to some_relation.to_a, but does not warn about model_class.all or support model_class.to_a.

But I agree — find_each is functionally equivalent here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
remove_column :answers, :hide_label
end
def self.down
add_column :answers, :hide_label, :boolean
- Answer.all.each{|a| a.update_attributes(:hide_label => true) if a.display_type == "hidden_label"}
+ Answer.find_each{|a| a.update_attributes(:hide_label => true) if a.display_type == "hidden_label"}
remove_column :answers, :display_type
end
end
View
9 lib/surveyor/helpers/asset_pipeline.rb
@@ -4,9 +4,14 @@ module AssetPipeline
##
# Returns whether or not the asset pipeline is present and enabled.
#
- # The detection scheme used here was ripped from jquery-rails.
+ # With Rails4 it appears that assets.enabled is false if
+ # --skip-sprockets is specified when creating the application,
+ # but the assets.enabled option is nil in the default case
+ # (i.e., pipeline enabled).
def asset_pipeline_enabled?
- ::Rails.version >= "3.1" && ::Rails.application.config.assets.enabled
+ return false unless Rails.configuration.respond_to?('assets')
+ assets = Rails.configuration.assets
+ assets.enabled.nil? || assets.enabled
end
end
end
View
2  lib/surveyor/models/validation_condition_methods.rb
@@ -37,4 +37,4 @@ def is_valid?(response)
end
end
end
-end
+end
View
2  lib/surveyor/surveyor_controller_methods.rb
@@ -16,7 +16,7 @@ module SurveyorControllerMethods
# Actions
def new
- @surveys_by_access_code = Survey.order("created_at DESC, survey_version DESC").all.group_by(&:access_code)
+ @surveys_by_access_code = Survey.order("created_at DESC, survey_version DESC").group_by(&:access_code)
redirect_to surveyor_index unless surveyor_index == surveyor.available_surveys_path
end
View
5 lib/surveyor/unparser.rb
@@ -6,6 +6,11 @@ def self.unparse(survey)
survey.unparse(dsl = "")
dsl
end
+
+ # cribbed from rails source: http://apidock.com/rails/v3.2.13/Hash/diff
+ def self.hash_diff(h1, h2)
@yoon Owner
yoon added a note

@caboteria Where is this used?

I was using hash_diff in the various unparse() methods in lib/surveyor/unparser.rb (see commit 597f9c7) but it looks as if you fixed the same issue in a different way and I took your changes over mine so that code might not be used anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ h1.dup.delete_if { |k, v| h2[k] == v }.merge!(h2.dup.delete_if { |k, v| h1.has_key?(k) })
+ end
end
end
View
6 spec/controllers/surveyor_controller_spec.rb
@@ -90,6 +90,12 @@ def do_get(params = {})
response.should be_success
response.should render_template('show')
end
+ it "finds ResponseSet with includes" do
+ ResponseSet.should_receive(:includes).with(:responses => [:question, :answer]).and_return(response_set)
+ response_set.should_receive(:where).with(:access_code => "pdq").and_return(response_set)
+ response_set.should_receive(:first).and_return(response_set)
+ do_get
+ end
it "redirects for missing response set" do
do_get :response_set_code => "DIFFERENT"
response.should redirect_to(available_surveys_path)
View
5 spec/helpers/surveyor_helper_spec.rb
@@ -2,7 +2,6 @@
describe SurveyorHelper do
context "numbering" do
- let(:asset_directory){ asset_pipeline_enabled? ? "assets" : "images" }
before do
ActionController::Base.helpers.config.assets_dir = "public" unless asset_pipeline_enabled?
end
@@ -15,7 +14,7 @@
helper.q_text(q1).should == "<span class='qnum'>1) </span>#{q1.text}"
helper.q_text(q2).should == q2.text
helper.q_text(q3).should == q3.text
- helper.q_text(q4).should == %Q(<img alt="Something" src="/#{asset_directory}/something.jpg" />)
+ helper.q_text(q4).should == %Q(<img alt="Something" src="/images/something.jpg" />)
helper.q_text(q5).should == q5.text
end
end
@@ -115,4 +114,4 @@ def rc_to_as(type_sym)
helper.rc_to_as(:date).should == :string # back to string
end
end
-end
+end
View
5 spec/models/answer_spec.rb
@@ -97,14 +97,13 @@
end
context "for views" do
- let(:asset_directory){ asset_pipeline_enabled? ? "assets" : "images" }
before do
ActionController::Base.helpers.config.assets_dir = "public" unless asset_pipeline_enabled?
end
it "#text_for with #display_type == image" do
answer.text = "rails.png"
answer.display_type = :image
- answer.text_for.should == %(<img alt="Rails" src="/#{asset_directory}/rails.png" />)
+ answer.text_for.should == %(<img alt="Rails" src="/images/rails.png" />)
end
it "#text_for with #display_type == hidden_label" do
answer.text = "Red"
@@ -145,4 +144,4 @@
answer.text_for(:post).should == "after|extra"
end
end
-end
+end
View
2  spec/models/dependency_spec.rb
@@ -87,4 +87,4 @@
@dependency.destroy
dc_ids.each{|id| DependencyCondition.find_by_id(id).should == nil}
end
-end
+end
View
3  spec/models/question_spec.rb
@@ -145,14 +145,13 @@
end
context "for views" do
- let(:asset_directory){ asset_pipeline_enabled? ? "assets" : "images" }
before do
ActionController::Base.helpers.config.assets_dir = "public" unless asset_pipeline_enabled?
end
it "#text_for with #display_type == image" do
question.text = "rails.png"
question.display_type = :image
- question.text_for.should == %(<img alt="Rails" src="/#{asset_directory}/rails.png" />)
+ question.text_for.should == %(<img alt="Rails" src="/images/rails.png" />)
end
it "#help_text_for"
it "#text_for preserves strings" do
View
2  spec/models/validation_condition_spec.rb
@@ -95,4 +95,4 @@ def test_var(v_hash, a_hash, r_hash, ca_hash, cr_hash)
test_var({:operator => "=~"}, {:response_class => "date"}, {:datetime_value => Date.today}, {:response_class => "date"}, {:datetime_value => Date.today + 1}).should be_false
test_var({:operator => "=~"}, {:response_class => "string"}, {:string_value => "donuts"}, {:response_class => "string"}, {:string_value => "donuts"}).should be_false
end
-end
+end
View
1  surveyor.gemspec
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
s.add_dependency('rails', '>= 3.2')
s.add_dependency('haml', '~> 4.0')
+ s.add_dependency('rails-observers', '~> 0.1')
@yoon Owner
yoon added a note

@caboteria Unless I'm mistaken, we don't need observers any more

Cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
s.add_dependency('sass')
s.add_dependency('formtastic', '~> 2.2.1') # 2.1 requries actionpack 3.0
s.add_dependency('uuidtools', '~> 2.1')
Something went wrong with that request. Please try again.