Permalink
Browse files

Merge pull request #60 from spectator/rails4

Rails 4 support
  • Loading branch information...
2 parents a9c5f7a + f2157ba commit 01a1c848951ba801846505bfbceb57f380fa450a @josevalim josevalim committed Mar 1, 2013
View
5 .gitignore
@@ -0,0 +1,5 @@
+*.gem
+.bundle
+*.lock
+pkg/*
+.ruby-version
View
2 .travis.yml
@@ -3,8 +3,10 @@ rvm:
- 1.9.3
- ree
- jruby-18mode
+ - 2.0.0
gemfile:
- gemfiles/Gemfile-rails.3.1.x
+ - gemfiles/Gemfile-rails.3.2.x
- Gemfile
notifications:
recipients:
View
4 CHANGELOG.md
@@ -1,3 +1,7 @@
+## Unreleased
+
+* Support for Rails 4.0 onward
+
## 0.9.3
* Fix url generation for namespaced models
View
9 Gemfile
@@ -1,10 +1,7 @@
-source :rubygems
+source 'https://rubygems.org'
gemspec
-# Fixed 3.2.1 because 3.2.2 is broken
-gem 'railties', '~> 3.2.3'
-
+gem 'railties', '~> 4.0.0.beta1'
+gem 'activemodel', '~> 4.0.0.beta1'
gem 'mocha'
-
-gem 'ruby-debug', :platform => :mri_18
View
76 Gemfile.lock
@@ -1,76 +0,0 @@
-PATH
- remote: .
- specs:
- responders (0.9.3)
- railties (~> 3.1)
-
-GEM
- remote: http://rubygems.org/
- specs:
- actionpack (3.2.8)
- activemodel (= 3.2.8)
- activesupport (= 3.2.8)
- builder (~> 3.0.0)
- erubis (~> 2.7.0)
- journey (~> 1.0.4)
- rack (~> 1.4.0)
- rack-cache (~> 1.2)
- rack-test (~> 0.6.1)
- sprockets (~> 2.1.3)
- activemodel (3.2.8)
- activesupport (= 3.2.8)
- builder (~> 3.0.0)
- activesupport (3.2.8)
- i18n (~> 0.6)
- multi_json (~> 1.0)
- builder (3.0.3)
- columnize (0.3.6)
- erubis (2.7.0)
- hike (1.2.1)
- i18n (0.6.1)
- journey (1.0.4)
- json (1.7.5)
- linecache (0.46)
- rbx-require-relative (> 0.0.4)
- metaclass (0.0.1)
- mocha (0.10.4)
- metaclass (~> 0.0.1)
- multi_json (1.3.6)
- rack (1.4.1)
- rack-cache (1.2)
- rack (>= 0.4)
- rack-ssl (1.3.2)
- rack
- rack-test (0.6.2)
- rack (>= 1.0)
- railties (3.2.8)
- actionpack (= 3.2.8)
- activesupport (= 3.2.8)
- rack-ssl (~> 1.3.2)
- rake (>= 0.8.7)
- rdoc (~> 3.4)
- thor (>= 0.14.6, < 2.0)
- rake (0.9.2.2)
- rbx-require-relative (0.0.9)
- rdoc (3.12)
- json (~> 1.4)
- ruby-debug (0.10.4)
- columnize (>= 0.1)
- ruby-debug-base (~> 0.10.4.0)
- ruby-debug-base (0.10.4)
- linecache (>= 0.3)
- sprockets (2.1.3)
- hike (~> 1.2)
- rack (~> 1.0)
- tilt (~> 1.1, != 1.3.0)
- thor (0.16.0)
- tilt (1.3.3)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- mocha
- railties (~> 3.2.3)
- responders!
- ruby-debug
View
3 gemfiles/Gemfile-rails.3.1.x
@@ -1,6 +1,5 @@
-source :rubygems
+source 'https://rubygems.org'
gem 'responders', :path => '..'
-
gem 'railties', '~> 3.1.0'
gem 'mocha'
View
6 gemfiles/Gemfile-rails.3.2.x
@@ -0,0 +1,6 @@
+source 'https://rubygems.org'
+
+gem 'responders', :path => '..'
+# Fixed 3.2.3 because 3.2.2 is broken.
+gem 'railties', '~> 3.2.3'
+gem 'mocha'
View
6 responders.gemspec
@@ -6,10 +6,10 @@ Gem::Specification.new do |s|
s.name = "responders"
s.version = Responders::VERSION.dup
s.platform = Gem::Platform::RUBY
- s.summary = "A set of Rails 3 responders to dry up your application"
+ s.summary = "A set of Rails responders to dry up your application"
s.email = "contact@plataformatec.com.br"
s.homepage = "http://github.com/plataformatec/responders"
- s.description = "A set of Rails 3 responders to dry up your application"
+ s.description = "A set of Rails responders to dry up your application"
s.authors = ['José Valim']
s.rubyforge_project = "responders"
@@ -18,5 +18,5 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.require_paths = ["lib"]
- s.add_dependency "railties", "~> 3.1"
+ s.add_dependency "railties", ">= 3.1"
end
View
2 test/collection_responder_test.rb
@@ -28,7 +28,7 @@ def with_location
end
def isolated_namespace
- respond_with MyEngine::Business.new
+ respond_with MyEngine::Business
end
def uncountable
View
4 test/flash_responder_test.rb
@@ -181,13 +181,13 @@ def test_never_set_flash_now
# If we have flash.now, it's always marked as used.
def assert_flash_now(k)
- assert flash.instance_variable_get(:@used).to_a.include?(k.to_sym),
+ assert flash.used_keys.include?(k.to_sym),
"Expected #{k} to be in flash.now, but it's not."
end
def assert_not_flash_now(k)
assert flash[k], "Expected #{k} to be set"
- assert !flash.instance_variable_get(:@used).include?(k.to_sym),
+ assert !flash.used_keys.include?(k.to_sym),
"Expected #{k} to not be in flash.now, but it is."
end
end
View
2 test/http_cache_responder_test.rb
@@ -51,7 +51,7 @@ def test_returns_not_modified_if_return_is_cache_is_still_valid
@request.env["HTTP_IF_MODIFIED_SINCE"] = Time.utc(2009, 6).httpdate
get :single
assert_equal 304, @response.status
- assert_equal " ", @response.body
+ assert_includes [" ", ""], @response.body
end
def test_refreshes_last_modified_if_cache_is_expired
View
24 test/test_helper.rb
@@ -11,6 +11,7 @@
require 'active_support'
require 'action_controller'
require 'active_model'
+require 'rails/engine'
require 'rails/railtie'
$:.unshift File.expand_path('../../lib', __FILE__)
@@ -22,8 +23,8 @@
Responders::Routes = ActionDispatch::Routing::RouteSet.new
Responders::Routes.draw do
resources :news
- match '/admin/:action', :controller => "admin/addresses"
- match '/:controller(/:action(/:id))'
+ get '/admin/:action', :controller => "admin/addresses"
+ get '/:controller(/:action(/:id))'
end
class ApplicationController < ActionController::Base
@@ -39,6 +40,17 @@ class ActiveSupport::TestCase
end
end
+module ActionDispatch
+ class Flash
+ class FlashHash
+ def used_keys
+ # Rails 3 || Rails 4
+ @used || @discard
+ end
+ end
+ end
+end
+
class Model
include ActiveModel::Conversion
include ActiveModel::Validations
@@ -70,10 +82,8 @@ class News < Model
end
module MyEngine
- def self.use_relative_model_naming?
- true
- end
-
- class Business < Model
+ class Business < Rails::Engine
+ isolate_namespace MyEngine
+ extend ActiveModel::Naming
end
end

0 comments on commit 01a1c84

Please sign in to comment.