diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-09-08 15:38:51 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-09-08 15:38:51 -0300 |
commit | 670281c6b2e9b9e8c51a140f2a5f66b251f1b84b (patch) | |
tree | ab141872d72e010c8a0fe371d22a00914c97e1eb /activeresource | |
parent | 39e4e76d15233bb1cb0b778d920f54efe86bb4f0 (diff) | |
parent | 1a0f822037c408a392ffa7b6e1ecbe5951ab48db (diff) | |
download | rails-670281c6b2e9b9e8c51a140f2a5f66b251f1b84b.tar.gz rails-670281c6b2e9b9e8c51a140f2a5f66b251f1b84b.tar.bz2 rails-670281c6b2e9b9e8c51a140f2a5f66b251f1b84b.zip |
Merge commit 'rails/master'
Conflicts:
activerecord/lib/active_record/associations.rb
Diffstat (limited to 'activeresource')
-rw-r--r-- | activeresource/Rakefile | 4 | ||||
-rw-r--r-- | activeresource/activeresource.gemspec | 7 | ||||
-rw-r--r-- | activeresource/lib/active_resource/observing.rb | 13 | ||||
-rw-r--r-- | activeresource/test/cases/observing_test.rb | 2 | ||||
-rw-r--r-- | activeresource/test/cases/validations_test.rb | 3 |
5 files changed, 24 insertions, 5 deletions
diff --git a/activeresource/Rakefile b/activeresource/Rakefile index 6234b159cd..54c3fe44c6 100644 --- a/activeresource/Rakefile +++ b/activeresource/Rakefile @@ -34,11 +34,12 @@ Rake::TestTask.new { |t| t.verbose = true t.warning = true } + task :isolated_test do ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME')) activesupport_path = "#{File.dirname(__FILE__)}/../activesupport/lib" Dir.glob("test/**/*_test.rb").all? do |file| - system(ruby, "-Ilib:test:#{activesupport_path}", file) + system(ruby, '-w', "-Ilib:test:#{activesupport_path}", file) end or raise "Failures" end @@ -74,6 +75,7 @@ spec = Gem::Specification.new do |s| end s.add_dependency('activesupport', '= 3.0.pre' + PKG_BUILD) + s.add_dependency('activemodel', '= 3.0.pre' + PKG_BUILD) s.require_path = 'lib' s.autorequire = 'active_resource' diff --git a/activeresource/activeresource.gemspec b/activeresource/activeresource.gemspec index 0ce1a71d5a..c3bb6e3622 100644 --- a/activeresource/activeresource.gemspec +++ b/activeresource/activeresource.gemspec @@ -7,11 +7,11 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["David Heinemeier Hansson"] s.autorequire = %q{active_resource} - s.date = %q{2009-08-31} + s.date = %q{2009-09-01} s.description = %q{Wraps web resources in model classes that can be manipulated through XML over REST.} s.email = %q{david@loudthinking.com} s.extra_rdoc_files = ["README"] - s.files = ["Rakefile", "README", "CHANGELOG", "lib/active_resource", "lib/active_resource/base.rb", "lib/active_resource/connection.rb", "lib/active_resource/custom_methods.rb", "lib/active_resource/exceptions.rb", "lib/active_resource/formats", "lib/active_resource/formats/json_format.rb", "lib/active_resource/formats/xml_format.rb", "lib/active_resource/formats.rb", "lib/active_resource/http_mock.rb", "lib/active_resource/observing.rb", "lib/active_resource/validations.rb", "lib/active_resource/version.rb", "lib/active_resource.rb", "lib/activeresource.rb", "test/abstract_unit.rb", "test/cases", "test/cases/authorization_test.rb", "test/cases/base", "test/cases/base/custom_methods_test.rb", "test/cases/base/equality_test.rb", "test/cases/base/load_test.rb", "test/cases/base_errors_test.rb", "test/cases/base_test.rb", "test/cases/finder_test.rb", "test/cases/format_test.rb", "test/cases/observing_test.rb", "test/cases/validations_test.rb", "test/connection_test.rb", "test/fixtures", "test/fixtures/beast.rb", "test/fixtures/customer.rb", "test/fixtures/person.rb", "test/fixtures/project.rb", "test/fixtures/proxy.rb", "test/fixtures/street_address.rb", "test/setter_trap.rb", "examples/simple.rb"] + s.files = ["Rakefile", "README", "CHANGELOG", "lib/active_resource", "lib/active_resource/base.rb", "lib/active_resource/connection.rb", "lib/active_resource/custom_methods.rb", "lib/active_resource/exceptions.rb", "lib/active_resource/formats", "lib/active_resource/formats/json_format.rb", "lib/active_resource/formats/xml_format.rb", "lib/active_resource/formats.rb", "lib/active_resource/http_mock.rb", "lib/active_resource/observing.rb", "lib/active_resource/validations.rb", "lib/active_resource/version.rb", "lib/active_resource.rb", "lib/activeresource.rb", "test/abstract_unit.rb", "test/cases", "test/cases/authorization_test.rb", "test/cases/base", "test/cases/base/custom_methods_test.rb", "test/cases/base/equality_test.rb", "test/cases/base/load_test.rb", "test/cases/base_errors_test.rb", "test/cases/base_test.rb", "test/cases/finder_test.rb", "test/cases/format_test.rb", "test/cases/observing_test.rb", "test/cases/validations_test.rb", "test/connection_test.rb", "test/debug.log", "test/fixtures", "test/fixtures/beast.rb", "test/fixtures/customer.rb", "test/fixtures/person.rb", "test/fixtures/project.rb", "test/fixtures/proxy.rb", "test/fixtures/street_address.rb", "test/setter_trap.rb", "examples/simple.rb"] s.homepage = %q{http://www.rubyonrails.org} s.rdoc_options = ["--main", "README"] s.require_paths = ["lib"] @@ -25,10 +25,13 @@ Gem::Specification.new do |s| if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<activesupport>, ["= 3.0.pre"]) + s.add_runtime_dependency(%q<activemodel>, ["= 3.0.pre"]) else s.add_dependency(%q<activesupport>, ["= 3.0.pre"]) + s.add_dependency(%q<activemodel>, ["= 3.0.pre"]) end else s.add_dependency(%q<activesupport>, ["= 3.0.pre"]) + s.add_dependency(%q<activemodel>, ["= 3.0.pre"]) end end diff --git a/activeresource/lib/active_resource/observing.rb b/activeresource/lib/active_resource/observing.rb index 94836f4bb1..3c74d49c80 100644 --- a/activeresource/lib/active_resource/observing.rb +++ b/activeresource/lib/active_resource/observing.rb @@ -4,7 +4,18 @@ module ActiveResource include ActiveModel::Observing included do - wrap_with_notifications :create, :save, :update, :destroy + %w( create save update destroy ).each do |method| + class_eval(<<-EOS, __FILE__, __LINE__ + 1) + def #{method}_with_notifications(*args, &block) + notify_observers(:before_#{method}) + if result = #{method}_without_notifications(*args, &block) + notify_observers(:after_#{method}) + end + result + end + EOS + alias_method_chain(method, :notifications) + end end end end diff --git a/activeresource/test/cases/observing_test.rb b/activeresource/test/cases/observing_test.rb index 334b256772..9599ff7b0f 100644 --- a/activeresource/test/cases/observing_test.rb +++ b/activeresource/test/cases/observing_test.rb @@ -1,4 +1,6 @@ require 'abstract_unit' +require 'fixtures/person' +require 'active_support/core_ext/hash/conversions' class ObservingTest < Test::Unit::TestCase cattr_accessor :history diff --git a/activeresource/test/cases/validations_test.rb b/activeresource/test/cases/validations_test.rb index a8ab7d64e7..c05f625fb7 100644 --- a/activeresource/test/cases/validations_test.rb +++ b/activeresource/test/cases/validations_test.rb @@ -1,5 +1,6 @@ require 'abstract_unit' -require "fixtures/project" +require 'fixtures/project' +require 'active_support/core_ext/hash/conversions' # The validations are tested thoroughly under ActiveModel::Validations # This test case simply makes sur that they are all accessible by |