action_context 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{action_context}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matthew Daubert"]
@@ -23,7 +23,6 @@ Gem::Specification.new do |s|
23
23
  "init.rb",
24
24
  "install.rb",
25
25
  "lib/action_context.rb",
26
- "pkg/action_context-0.1.2.gem",
27
26
  "rails/init.rb",
28
27
  "test/action_context_test.rb",
29
28
  "test/helper.rb",
@@ -4,6 +4,14 @@ module ActionContext
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  module ClassMethods
7
+
8
+ # Sugar to wrap set_context within before_filter
9
+ def context(context, matcher, *args)
10
+ before_filter(args) do
11
+ set_context(context, matcher)
12
+ end
13
+ end
14
+
7
15
  end
8
16
 
9
17
  module InstanceMethods
@@ -17,4 +17,17 @@ class ActionContextTest < Test::Unit::TestCase
17
17
  assert !tc.match_context(:doesntexist, "/qwerty")
18
18
  end
19
19
 
20
+ def test_context_method_adds_before_filter
21
+ assert TestController.respond_to?(:context), "ActionContext does not extend a class method named context"
22
+ tcb_class = Class.new do
23
+ include ActionContext
24
+ def self.before_filter(*args)
25
+ @@test_args = args
26
+ end
27
+ context :gimble, /^\/path/, :only => [:index, :show]
28
+ end
29
+ tcb = tcb_class.new
30
+ assert_equal tcb_class.class_variable_get('@@test_args'), [ [ { :only => [:index, :show] } ] ]
31
+ end
32
+
20
33
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matthew Daubert
@@ -35,7 +35,6 @@ files:
35
35
  - init.rb
36
36
  - install.rb
37
37
  - lib/action_context.rb
38
- - pkg/action_context-0.1.2.gem
39
38
  - rails/init.rb
40
39
  - test/action_context_test.rb
41
40
  - test/helper.rb
Binary file