File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ def self.expose(*args, &block)
7171 raise ArgumentError , "You may not use block-setting on multi-attribute exposures." if block_given?
7272 end
7373
74+ raise ArgumentError , "You may not use block-setting when also using " if block_given? && options [ :format_with ] . respond_to? ( :call )
75+
7476 options [ :proc ] = block if block_given?
7577
7678 args . each do |attribute |
Original file line number Diff line number Diff line change 2424 expect { subject . expose :name , :email , :as => :foo } . to raise_error ( ArgumentError )
2525 expect { subject . expose :name , :as => :foo } . not_to raise_error
2626 end
27+
28+ it 'should make sure that :format_with as a proc can not be used with a block' do
29+ expect { subject . expose :name , :format_with => Proc . new { } do |object , options | end } . to raise_error ( ArgumentError )
30+ end
2731 end
2832
2933 context 'with a block' do
You can’t perform that action at this time.
0 commit comments