Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed gem tests

  • Loading branch information...
commit 94048b352e9abd759cc1c20b93c3b49480178bfe 1 parent 29b1b68
@shell authored
View
7 Gemfile
@@ -2,4 +2,9 @@ source 'https://rubygems.org'
gemspec
-gem 'activesupport', '~> 3.2.0'
+gem 'rake'
+gem 'activesupport', '~> 3.2.0'
+
+group :test do
+ gem 'actionpack'
+end
View
2  README.md
@@ -45,4 +45,4 @@ Provided methods:
## TODO
## Author
-Copyright (c) 2011 Vladimir Penkin, released under the MIT license
+Copyright (c) 2011 Vladimir Penkin, released under the MIT license
View
14 Rakefile
@@ -1,2 +1,16 @@
#!/usr/bin/env rake
require "bundler/gem_tasks"
+
+require 'rake'
+require 'rake/testtask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the rails3_before_render plugin.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.libs << 'test'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
View
6 lib/rails3_before_render.rb
@@ -1,8 +1,4 @@
require 'rails3_before_render/version'
require 'active_support/concern'
require 'rails3_before_render/before_render'
-require 'rails3_before_render/before_render_instance'
-
-module Rails3BeforeRender
-
-end
+require 'rails3_before_render/before_render_instance'
View
24 lib/rails3_before_render/before_render.rb
@@ -1,33 +1,31 @@
module Rails3BeforeRender
module BeforeRender
-
extend ActiveSupport::Concern
module ClassMethods
-
def append_before_render_filter(*names, &blk)
- _insert_callbacks(names, blk) do |name, options|
- set_callback(:render, :before, name, options)
- end
+ _insert_callbacks(names, blk) do |name, options|
+ set_callback(:render, :before, name, options)
+ end
end
def prepend_before_render_filter(*names, &blk)
- _insert_callbacks(names, blk) do |name, options|
- set_callback(:render, :before, name, options.merge(:prepend => true))
- end
- end
-
+ _insert_callbacks(names, blk) do |name, options|
+ set_callback(:render, :before, name, options.merge(:prepend => true))
+ end
+ end
+
def skip_before_render_filter(*names, &blk)
- _insert_callbacks(names, blk) do |name, options|
+ _insert_callbacks(names, blk) do |name, options|
skip_callback(:render, :before, name, options)
- end
+ end
end
alias_method :before_render, :append_before_render_filter
alias_method :prepend_before_render, :prepend_before_render_filter
alias_method :skip_before_render, :skip_before_render_filter
end
-
+
end
end
View
6 lib/rails3_before_render/before_render_instance.rb
@@ -1,6 +1,5 @@
module Rails3BeforeRender
- module BeforeRenderInstance
-
+ module BeforeRenderInstance
extend ActiveSupport::Concern
included do
@@ -13,7 +12,8 @@ def render_with_before_render_filter *opts, &blk
render_without_before_render_filter(*opts, &blk)
end
end
-
+
end
end
+
ActionController::Base.send :include, Rails3BeforeRender::BeforeRenderInstance
View
2  lib/rails3_before_render/version.rb
@@ -1,3 +1,3 @@
module Rails3BeforeRender
- VERSION = "1.0.0"
+ VERSION = "0.2.0"
end
View
8 test/test_helper.rb
@@ -1,8 +1,10 @@
require 'rubygems'
+
require 'test/unit'
require 'active_support'
-require 'ruby-debug'
ENV["RAILS_ENV"] = "test"
-require File.expand_path('../../../../../config/environment', __FILE__)
-require 'rails/test_help'
+require 'action_pack'
+require 'action_controller'
+require File.expand_path('../../lib/rails3_before_render', __FILE__)
+# require 'rails/test_help'
Please sign in to comment.
Something went wrong with that request. Please try again.