spec_support 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -36,7 +36,7 @@ are required. A nice way to produce them automatically
36
36
  from the FactoryGirl factories is:
37
37
 
38
38
  def valid_attributes
39
- FactoryGirl.build(:full_contact).delete_nil_values
39
+ FactoryGirl.build(:full_contact).attributes.delete_nil_values
40
40
  end
41
41
 
42
42
  The reason the nil values need to be removed is to allow
@@ -45,3 +45,14 @@ ActiveRecord when executing the create in the controller.
45
45
  Specifically, without the delete_nil_values, this error results:
46
46
 
47
47
  null value in column "created_at" violates not-null constraint
48
+
49
+ == factory_hash
50
+
51
+ This is a combined function that executes the
52
+
53
+ .attributes.delete_nil_values
54
+
55
+ shown above as valid_attributes on a ActiveRecord model
56
+ (typically produced with FactoryGirl)
57
+
58
+
@@ -5,3 +5,11 @@ class Hash
5
5
  end
6
6
 
7
7
  end
8
+
9
+ class Object
10
+
11
+ def factory_hash(m)
12
+ m.attributes.delete_nil_values
13
+ end
14
+
15
+ end
@@ -1,3 +1,3 @@
1
1
  module SpecSupport
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require 'ostruct'
2
3
 
3
4
  describe "delete_nil_values" do
4
5
 
@@ -18,3 +19,12 @@ describe "delete_nil_values" do
18
19
  end
19
20
 
20
21
  end
22
+
23
+ describe "factory_hash" do
24
+
25
+ it "yields a non_nil values" do
26
+ m = OpenStruct.new(:attributes => {:a => 'c', :b => nil})
27
+ factory_hash(m).should == {:a => 'c'}
28
+ end
29
+
30
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spec_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
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-05-04 00:00:00.000000000 Z
12
+ date: 2012-06-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -34,17 +34,17 @@ executables: []
34
34
  extensions: []
35
35
  extra_rdoc_files: []
36
36
  files:
37
- - lib/spec_support/version.rb
38
37
  - lib/spec_support/check_all_columns.rb
38
+ - lib/spec_support/version.rb
39
39
  - lib/spec_support/delete_nil_values.rb
40
40
  - lib/spec_support.rb
41
41
  - lib/tasks/spec_support_tasks.rake
42
42
  - MIT-LICENSE
43
43
  - Rakefile
44
44
  - README.rdoc
45
- - spec/spec_helper.rb
46
- - spec/delete_nil_values_spec.rb
47
45
  - spec/file_spec.rb
46
+ - spec/delete_nil_values_spec.rb
47
+ - spec/spec_helper.rb
48
48
  homepage: http://github.com/petervandenabeele/spec_support
49
49
  licenses: []
50
50
  post_install_message:
@@ -59,7 +59,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
59
59
  version: '0'
60
60
  segments:
61
61
  - 0
62
- hash: 35890817
62
+ hash: -975297039
63
63
  required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  version: '0'
69
69
  segments:
70
70
  - 0
71
- hash: 35890817
71
+ hash: -975297039
72
72
  requirements: []
73
73
  rubyforge_project:
74
74
  rubygems_version: 1.8.23
@@ -76,6 +76,6 @@ signing_key:
76
76
  specification_version: 3
77
77
  summary: spec/support for common cases
78
78
  test_files:
79
- - spec/spec_helper.rb
80
- - spec/delete_nil_values_spec.rb
81
79
  - spec/file_spec.rb
80
+ - spec/delete_nil_values_spec.rb
81
+ - spec/spec_helper.rb