base10-spec-assist 0.5.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.
- data/VERSION.yml +4 -0
- data/lib/spec_assist.rb +56 -0
- data/test/spec_assist_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +57 -0
data/VERSION.yml
ADDED
data/lib/spec_assist.rb
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module SpecAssist
|
|
2
|
+
LORUM = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummynibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi."
|
|
3
|
+
|
|
4
|
+
def check_nullness(fields)
|
|
5
|
+
fields.each do |method|
|
|
6
|
+
it "should not allow #{method} to be nil" do
|
|
7
|
+
@obj.send( method.to_s + '=', nil )
|
|
8
|
+
@obj.should_not be_valid
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def check_min_length(fields, length)
|
|
14
|
+
fields.each do |method|
|
|
15
|
+
it "should require #{method} to be at least #{length.to_s} chars." do
|
|
16
|
+
min = length.to_i - 1
|
|
17
|
+
@obj.send( method.to_s + '=', get_string(min) )
|
|
18
|
+
|
|
19
|
+
@obj.should_not be_valid
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def check_max_length(fields, length)
|
|
25
|
+
fields.each do |method|
|
|
26
|
+
it "should require #{method} to be #{length.to_s} chars or less." do
|
|
27
|
+
max = length.to_i + 1
|
|
28
|
+
@obj.send( method.to_s + '=', get_string(max) )
|
|
29
|
+
|
|
30
|
+
@obj.should_not be_valid
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def check_unique_field(a, b, field)
|
|
36
|
+
b.send( field.to_s + '=', a.send( field ) )
|
|
37
|
+
b.should_not be_valid
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def get_string(length=255)
|
|
41
|
+
str = LORUM[0, length.to_i]
|
|
42
|
+
return str
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def varchar32
|
|
46
|
+
return get_string(33)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def varchar100
|
|
50
|
+
return get_string(103)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def varchar255
|
|
54
|
+
return get_string(260)
|
|
55
|
+
end
|
|
56
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: base10-spec-assist
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.5.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Nathan L. Walls
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2009-01-27 00:00:00 -08:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies: []
|
|
15
|
+
|
|
16
|
+
description: TODO
|
|
17
|
+
email: nathan@rexluther.com
|
|
18
|
+
executables: []
|
|
19
|
+
|
|
20
|
+
extensions: []
|
|
21
|
+
|
|
22
|
+
extra_rdoc_files: []
|
|
23
|
+
|
|
24
|
+
files:
|
|
25
|
+
- VERSION.yml
|
|
26
|
+
- lib/spec_assist.rb
|
|
27
|
+
- test/spec_assist_test.rb
|
|
28
|
+
- test/test_helper.rb
|
|
29
|
+
has_rdoc: true
|
|
30
|
+
homepage: http://github.com/base10/spec-assist
|
|
31
|
+
post_install_message:
|
|
32
|
+
rdoc_options:
|
|
33
|
+
- --inline-source
|
|
34
|
+
- --charset=UTF-8
|
|
35
|
+
require_paths:
|
|
36
|
+
- lib
|
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - ">="
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: "0"
|
|
42
|
+
version:
|
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: "0"
|
|
48
|
+
version:
|
|
49
|
+
requirements: []
|
|
50
|
+
|
|
51
|
+
rubyforge_project:
|
|
52
|
+
rubygems_version: 1.2.0
|
|
53
|
+
signing_key:
|
|
54
|
+
specification_version: 2
|
|
55
|
+
summary: Initial commit
|
|
56
|
+
test_files: []
|
|
57
|
+
|