exposure 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
@@ -32,14 +32,14 @@ module Exposure
32
32
 
33
33
  options[:if] ||= []
34
34
 
35
- only_methods = options.delete(:only)
36
- except_methods = options.delete(:except)
35
+ only_methods = Array.wrap(options.delete(:only))
36
+ except_methods = Array.wrap(options.delete(:except))
37
37
 
38
- if only_methods
38
+ if only_methods.any?
39
39
  options[:if] << Proc.new {|c| only_methods.include?(c.action_name.intern) }
40
40
  end
41
41
 
42
- if except_methods
42
+ if except_methods.any?
43
43
  options[:if] << Proc.new {|c| !except_methods.include?(c.action_name.intern) }
44
44
  end
45
45
 
@@ -43,4 +43,18 @@ describe "callbacks'", :type => :controller do
43
43
  get(:new)
44
44
  should assign_to(:callback_called).with(3)
45
45
  end
46
+
47
+ it "can call callbacks for specific formats as an array" do
48
+ PiratesController.after :assign, :first_callback_called, :second_callback_called, :only => [:create, :new]
49
+ PiratesController.after :assign, :third_callback_called, :except => [:new]
50
+ get(:new)
51
+ should assign_to(:callback_called).with(2)
52
+ end
53
+
54
+ it "can call callbacks for a specific format as symbol" do
55
+ PiratesController.after :assign, :first_callback_called, :second_callback_called, :only => :new
56
+ PiratesController.after :assign, :third_callback_called, :except => :new
57
+ get(:new)
58
+ should assign_to(:callback_called).with(2)
59
+ end
46
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exposure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trek Glowacki