assert 2.9.0 → 2.10.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.
@@ -66,6 +66,10 @@ module Assert
66
66
  self.type_cast(Random.url_string(host, length), :string)
67
67
  end
68
68
 
69
+ def email(domain = nil, length = nil)
70
+ self.type_cast(Random.email_string(domain, length), :string)
71
+ end
72
+
69
73
  def binary
70
74
  self.type_cast(Random.binary, :binary)
71
75
  end
@@ -146,6 +150,11 @@ module Assert
146
150
  File.join(host.to_s, self.dir_path_string(length))
147
151
  end
148
152
 
153
+ def self.email_string(domain = nil, length = nil)
154
+ domain ||= "#{self.string(5)}.com"
155
+ "#{self.string(length)}@#{domain}"
156
+ end
157
+
149
158
  def self.binary
150
159
  [ self.integer(10000) ].pack('N*')
151
160
  end
@@ -1,3 +1,3 @@
1
1
  module Assert
2
- VERSION = "2.9.0"
2
+ VERSION = "2.10.0"
3
3
  end
@@ -11,7 +11,7 @@ module Assert::Factory
11
11
  should have_imeths :date, :time, :datetime
12
12
  should have_imeths :string, :text, :slug, :hex
13
13
  should have_imeths :file_name, :dir_path, :file_path
14
- should have_imeths :path, :url
14
+ should have_imeths :path, :url, :email
15
15
  should have_imeths :binary, :boolean
16
16
  should have_imeths :type_cast, :type_converter
17
17
 
@@ -130,6 +130,21 @@ module Assert::Factory
130
130
  assert_equal 2, subject.url('', 1).length # plus leading '/'
131
131
  end
132
132
 
133
+ should "return a random email string using `email`" do
134
+ e = subject.email
135
+ assert_kind_of String, e
136
+ assert_match /\A\w+@\w+\.com\Z/, e
137
+ end
138
+
139
+ should "allow passing a custom domain to `email`" do
140
+ e = subject.email('example.org')
141
+ assert_match /@example\.org\Z/, e
142
+ end
143
+
144
+ should "allow passing a mailbox length using `email`" do
145
+ assert_equal 2, subject.email(nil, 2).split('@').first.size
146
+ end
147
+
133
148
  should "return a random binary string using `binary`" do
134
149
  assert_kind_of String, subject.binary
135
150
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assert
3
3
  version: !ruby/object:Gem::Version
4
- hash: 43
4
+ hash: 39
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
- - 9
8
+ - 10
9
9
  - 0
10
- version: 2.9.0
10
+ version: 2.10.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly Redding
@@ -16,12 +16,12 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2014-03-05 00:00:00 Z
19
+ date: 2014-03-25 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- prerelease: false
23
22
  type: :runtime
24
- requirement: &id001 !ruby/object:Gem::Requirement
23
+ name: ansi
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ~>
@@ -31,8 +31,8 @@ dependencies:
31
31
  - 1
32
32
  - 3
33
33
  version: "1.3"
34
- version_requirements: *id001
35
- name: ansi
34
+ prerelease: false
35
+ requirement: *id001
36
36
  description: Test::Unit style testing framework, just better than Test::Unit.
37
37
  email:
38
38
  - kelly@kellyredding.com
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  requirements: []
143
143
 
144
144
  rubyforge_project:
145
- rubygems_version: 1.8.24
145
+ rubygems_version: 1.8.15
146
146
  signing_key:
147
147
  specification_version: 3
148
148
  summary: Test::Unit style testing framework, just better than Test::Unit.