formeze 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/formeze.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'formeze'
3
- s.version = '1.1.2'
3
+ s.version = '1.1.3'
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.authors = ['Tim Craft']
6
6
  s.email = ['mail@timcraft.com']
data/lib/formeze.rb CHANGED
@@ -196,9 +196,9 @@ module Formeze
196
196
 
197
197
  self.class.fields.each do |field|
198
198
  if field.is_a?(GuardCondition)
199
- instance_eval(&field.block) ? next : return
199
+ instance_eval(&field.block) ? next : break
200
200
  elsif field.is_a?(HaltingCondition)
201
- instance_eval(&field.block) ? return : next
201
+ instance_eval(&field.block) ? break : next
202
202
  end
203
203
 
204
204
  unless form_data.has_key?(field.key)
data/spec/formeze_spec.rb CHANGED
@@ -323,6 +323,18 @@ class FormWithGuardCondition
323
323
  end
324
324
  end
325
325
 
326
+ describe 'FormWithGuardCondition' do
327
+ before do
328
+ @form = FormWithGuardCondition.new(false)
329
+ end
330
+
331
+ describe 'parse method' do
332
+ it 'should raise an exception when there is an unexpected key' do
333
+ proc { @form.parse('account_name=Something&foo=bar') }.must_raise(Formeze::KeyError)
334
+ end
335
+ end
336
+ end
337
+
326
338
  describe 'FormWithGuardCondition with business_account set to true' do
327
339
  before do
328
340
  @form = FormWithGuardCondition.new(true)
@@ -364,6 +376,18 @@ class FormWithHaltingCondition
364
376
  end
365
377
  end
366
378
 
379
+ describe 'FormWithHaltingCondition' do
380
+ before do
381
+ @form = FormWithHaltingCondition.new
382
+ end
383
+
384
+ describe 'parse method' do
385
+ it 'should raise an exception when there is an unexpected key' do
386
+ proc { @form.parse('delivery_address=123+Main+St&same_address=yes&foo=bar') }.must_raise(Formeze::KeyError)
387
+ end
388
+ end
389
+ end
390
+
367
391
  describe 'FormWithHaltingCondition after parsing input with same_address set and no billing address' do
368
392
  before do
369
393
  @form = FormWithHaltingCondition.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formeze
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-09 00:00:00.000000000Z
12
+ date: 2012-04-10 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: A little library for handling form data/input
15
15
  email: