morse_spec_helpers 0.0.15 → 0.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1f254943bb6c5c50fbdf4c60e204dd06bbb7fcd
4
- data.tar.gz: d3d1126477ffdd07bcba3607889c62291e1d6c83
3
+ metadata.gz: b1845d75d9389d20fd422f3b762cce42b0147df7
4
+ data.tar.gz: 047293471013733919b465daed958993b2b6a57a
5
5
  SHA512:
6
- metadata.gz: 1a2dc5c557e2b35b88cf37cba40917619b55fac91adf1b9a7d6d29d4ca0134562cf1c5bcee750badf0bd316c0c9d956300a178d9ff9a81834e9b52a21c5bdc94
7
- data.tar.gz: eab3593c35064ce2951d2b226acaac58d8e22806196146447748c07ab14170d42f1e33b9aec63d791e5de2e8b349eb640890881a4db1c2a0c111f21283a24db6
6
+ metadata.gz: 36c8b302b967e6090e7b886202d491dde52f7afb5870e0c8a50dd40c9b5d9602dcd64bf6b956cc2126ecf0d8a1291b8f3352b63cc7729e2eed4b1f52840b68ed
7
+ data.tar.gz: a919ab898d7d0e8910a3a9a6fccb9a013478f8588bb8d0a6c41d7efa51e12bcd27981a4312175977ce34db829e4bad7257164ea3bcb733c229cdc56b8a757b63
@@ -94,6 +94,28 @@ module MorseSpecHelpers
94
94
  end
95
95
  end
96
96
 
97
+ def mandatory_email(method)
98
+ context "#{method} is a mandatory email" do
99
+ it "should reject a blank #{method}" do
100
+ @instance.send("#{method}=","")
101
+ expect(@instance).not_to be_valid
102
+ end
103
+ it "should reject a badly formatted email for #{method}" do
104
+ @instance.send("#{method}=","test@test")
105
+ expect(@instance).to_not be_valid
106
+ end
107
+ it "should accept a properly formatted email for #{method}" do
108
+ @instance.send("#{method}=","test@test.com")
109
+ expect(@instance).to be_valid
110
+ end
111
+ it "should reject a normal string for #{method}" do
112
+ @instance.send("#{method}=","test")
113
+ expect(@instance).to_not be_valid
114
+ end
115
+ mandatory_thing(method)
116
+ end
117
+ end
118
+
97
119
  def mandatory_float(method)
98
120
  context "#{method} is a mandatory float" do
99
121
  it "should reject a blank #{method}" do
@@ -334,6 +356,28 @@ module MorseSpecHelpers
334
356
  end
335
357
  end
336
358
 
359
+ def optional_email(method)
360
+ context "#{method} is an optional email" do
361
+ it "should make a blank #{method} nil" do
362
+ @instance.send("#{method}=","")
363
+ expect(@instance).to be_valid
364
+ expect(@instance.send(method)).to be_nil
365
+ end
366
+ it "should reject a badly formatted email for #{method}" do
367
+ @instance.send("#{method}=","test@test")
368
+ expect(@instance).to_not be_valid
369
+ end
370
+ it "should accept a properly formatted email for #{method}" do
371
+ @instance.send("#{method}=","test@test.com")
372
+ expect(@instance).to be_valid
373
+ end
374
+ it "should reject a normal string for #{method}" do
375
+ @instance.send("#{method}=","test")
376
+ expect(@instance).to_not be_valid
377
+ end
378
+ end
379
+ end
380
+
337
381
  def optional_float(method)
338
382
  context "#{method} is an optional float" do
339
383
  exists(method)
@@ -1,3 +1,3 @@
1
1
  module MorseSpecHelpers
2
- VERSION = "0.0.15"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: morse_spec_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Terry S
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-22 00:00:00.000000000 Z
11
+ date: 2015-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler