Skip to content

Commit

Permalink
Add test for context proc arity validation
Browse files Browse the repository at this point in the history
  • Loading branch information
justincampbell committed May 17, 2019
1 parent dae0e6d commit 2a0b57a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/unit/encrypted_model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
}.to raise_error(Vault::Rails::ValidationFailedError)
end

it "raises an exception if a proc is passed to :context without an arity of 1" do
expect {
klass.vault_attribute(:foo, context: ->() { })
}.to raise_error(Vault::Rails::ValidationFailedError, /1 argument/i)
end

it "defines a getter" do
klass.vault_attribute(:foo)
expect(klass.instance_methods).to include(:foo)
Expand Down

0 comments on commit 2a0b57a

Please sign in to comment.