Skip to content

Commit

Permalink
start bringing things inline with rails 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgolick committed Feb 4, 2009
1 parent 68a9a5f commit 02f2fa2
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions .specification
2 changes: 2 additions & 0 deletions lib/resource_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require_dependency 'application'

module ResourceController
ACTIONS = [:index, :show, :new_action, :create, :edit, :update, :destroy].freeze
SINGLETON_ACTIONS = (ACTIONS - [:index]).freeze
Expand Down
4 changes: 1 addition & 3 deletions lib/resource_controller/base.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
require_dependency 'application'

module ResourceController

# == ResourceController::Base
#
# Inherit from this class to create your RESTful controller. See the README for usage.
#
class Base < ApplicationController
class Base < ::ApplicationController
unloadable

def self.inherited(subclass)
Expand Down
4 changes: 2 additions & 2 deletions lib/resource_controller/singleton.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ module ResourceController
#
# Inherit from this class to create your RESTful singleton controller. See the README for usage.
#
class Singleton < ApplicationController
class Singleton < ::ApplicationController
unloadable

def self.inherited(subclass)
super
subclass.class_eval { resource_controller :singleton }
end
end
end
end
5 changes: 3 additions & 2 deletions test/config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# ENV['RAILS_ENV'] ||= 'production'

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION = '2.3.0' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Expand All @@ -20,7 +20,7 @@
# config.plugins = %W( exception_notification ssl_requirement )

# Add additional load paths for your own custom dirs
config.load_paths += %W( #{RAILS_ROOT}/../lib )
# config.load_paths += %W( #{RAILS_ROOT}/../lib )

# Force all environments to use the same logger level
# (by default production uses :info, the others :debug)
Expand All @@ -29,6 +29,7 @@
# Use the database for sessions instead of the file system
# (create the session table with 'rake db:sessions:create')
# config.action_controller.session_store = :active_record_store
config.gem "resource_controller", :version => "10.0.0"

# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
Expand Down
2 changes: 1 addition & 1 deletion test/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'test_help'
require 'mocha'

class Test::Unit::TestCase
class ActiveSupport::TestCase
self.use_transactional_fixtures = true
self.use_instantiated_fixtures = false

Expand Down
1 change: 1 addition & 0 deletions test/vendor/gems/resource_controller-10.0.0

5 comments on commit 02f2fa2

@TMorgan99
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • config.gem "resource_controller", :version => "10.0.0"

How is this test supposed to work, since only 0.6.6 has been released?

@jamesgolick
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works because of the symlink in test/vendor/gems. The reason for the ultra high version number is to force it to use the symlink, avoiding collisions with any local gems.

@TMorgan99
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, if I plugin to a rails app, how to I prepare to run the test suite?
This is how far I got ...

rm -fr q ; time rails q -q
cd q
plugin install git://github.com/jamesgolick/resource_controller.git
cd vendor/plugins/resource_controller/test/
gem install -v=2.3.2 rails
-- next, rake suggested the following was needed.
rake gems:refresh_specs
rake gems
-- resource_controller shows up! as [F] frozen at 10.0.0
-- I don't have a source for thoughtbot-shoulda, so I patched the config.gem directive
vim ./config/environment.rb -- change 'thoughtbot-shoulda' to 'shoulda'

rake db:migrate test
112 tests, 151 assertions, 0 failures, 0 errors
/test/functional/photos_controller_test.rb:14: undefined method `should_be_restful' for PhotosControllerTest:Class (NoMethodError)
Errors running test:functionals!

surely, you have a better way ...

@jamesgolick
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why you're trying to run the tests under a rails app. If you're wanting to hack on r_c, I'd recommend doing that in a separate repository.

As for missing should_be_restful, you'll have to grab shoulda and build a gem from an older revision. They removed it from the framework, and I just don't think it's worth rewriting all the tests.

@TMorgan99
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've inherited a project that was using r_c.
I am now using
gem 'thoughtbot-shoulda', { :version => '= 2.9.0', :env=> :test, :lib => 'shoulda/rails', :source => "http://gems.github.com" }

Why?
When installed, it breaks rake test:plugins
I'm now showing
475 tests, 786 assertions, 0 failures, 32 errors

Please sign in to comment.