spec_support 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +18 -1
- data/lib/spec_support/version.rb +1 -1
- data/lib/spec_support.rb +6 -2
- metadata +73 -55
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= SpecSupport
|
2
2
|
|
3
|
-
|
3
|
+
== check_all_columns
|
4
4
|
|
5
5
|
After building a factory that fills out all the
|
6
6
|
attributes (columns) of an ActiveRecord model,
|
@@ -28,3 +28,20 @@ Example usage:
|
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
31
|
+
|
32
|
+
== delete_nil_values
|
33
|
+
|
34
|
+
In default Rspec controller specs, default values
|
35
|
+
are required. A nice way to produce them automatically
|
36
|
+
from the FactoryGirl factories is:
|
37
|
+
|
38
|
+
def valid_attributes
|
39
|
+
FactoryGirl.build(:full_contact).delete_nil_values
|
40
|
+
end
|
41
|
+
|
42
|
+
The reason the nil values need to be removed is to allow
|
43
|
+
some default key (e.g. created_at etc.) to be set by
|
44
|
+
ActiveRecord when executing the create in the controller.
|
45
|
+
Specifically, without the delete_nil_values, this error results:
|
46
|
+
|
47
|
+
null value in column "created_at" violates not-null constraint
|
data/lib/spec_support/version.rb
CHANGED
data/lib/spec_support.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
module SpecSupport
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
spec_support_path = File.join(File.expand_path(File.dirname(__FILE__)),'spec_support')
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift(spec_support_path)
|
6
|
+
|
7
|
+
require 'check_all_columns'
|
8
|
+
require 'delete_nil_values'
|
5
9
|
|
6
10
|
end
|
metadata
CHANGED
@@ -1,76 +1,94 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: spec_support
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
5
4
|
prerelease:
|
5
|
+
version: 0.0.5
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
- Peter Vandenabeele
|
7
|
+
authors:
|
8
|
+
- Peter Vandenabeele
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
12
|
+
|
13
|
+
date: 2012-03-24 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "0"
|
23
|
+
requirement: *id001
|
24
|
+
prerelease: false
|
25
|
+
type: :development
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: jruby-openssl
|
28
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
requirement: *id002
|
35
|
+
prerelease: false
|
36
|
+
type: :runtime
|
25
37
|
description: Add useful spec/support functionalities that come back in each project
|
26
|
-
email:
|
27
|
-
- peter@vandenabeele.com
|
38
|
+
email:
|
39
|
+
- peter@vandenabeele.com
|
28
40
|
executables: []
|
41
|
+
|
29
42
|
extensions: []
|
43
|
+
|
30
44
|
extra_rdoc_files: []
|
31
|
-
|
32
|
-
|
33
|
-
- lib/
|
34
|
-
- lib/
|
35
|
-
- lib/spec_support/
|
36
|
-
- lib/spec_support/
|
37
|
-
-
|
38
|
-
-
|
39
|
-
-
|
40
|
-
-
|
41
|
-
- spec/
|
42
|
-
- spec/
|
45
|
+
|
46
|
+
files:
|
47
|
+
- lib/spec_support.rb
|
48
|
+
- lib/tasks/spec_support_tasks.rake
|
49
|
+
- lib/spec_support/version.rb
|
50
|
+
- lib/spec_support/delete_nil_values.rb
|
51
|
+
- lib/spec_support/check_all_columns.rb
|
52
|
+
- MIT-LICENSE
|
53
|
+
- Rakefile
|
54
|
+
- README.rdoc
|
55
|
+
- spec/spec_helper.rb
|
56
|
+
- spec/delete_nil_values_spec.rb
|
57
|
+
- spec/file_spec.rb
|
43
58
|
homepage: http://github.com/petervandenabeele/spec_support
|
44
59
|
licenses: []
|
60
|
+
|
45
61
|
post_install_message:
|
46
62
|
rdoc_options: []
|
47
|
-
|
48
|
-
|
49
|
-
|
63
|
+
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
67
|
none: false
|
51
|
-
requirements:
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 2
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
76
|
none: false
|
60
|
-
requirements:
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
hash: 2
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
version: "0"
|
67
84
|
requirements: []
|
85
|
+
|
68
86
|
rubyforge_project:
|
69
|
-
rubygems_version: 1.8.
|
87
|
+
rubygems_version: 1.8.15
|
70
88
|
signing_key:
|
71
89
|
specification_version: 3
|
72
90
|
summary: spec/support for common cases
|
73
|
-
test_files:
|
74
|
-
- spec/spec_helper.rb
|
75
|
-
- spec/delete_nil_values_spec.rb
|
76
|
-
- spec/file_spec.rb
|
91
|
+
test_files:
|
92
|
+
- spec/spec_helper.rb
|
93
|
+
- spec/delete_nil_values_spec.rb
|
94
|
+
- spec/file_spec.rb
|