spec_support 0.0.2
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/MIT-LICENSE +20 -0
- data/README.rdoc +30 -0
- data/Rakefile +14 -0
- data/lib/spec_support.rb +5 -0
- data/lib/spec_support/check_all_columns.rb +7 -0
- data/lib/spec_support/version.rb +3 -0
- data/lib/tasks/spec_support_tasks.rake +4 -0
- metadata +80 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2011 Vandesco bvba (http://vandesco.be)
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
= SpecSupport
|
2
|
+
|
3
|
+
= check_all_columns
|
4
|
+
|
5
|
+
After building a factory that fills out all the
|
6
|
+
attributes (columns) of an ActiveRecord model,
|
7
|
+
I want to make sure all attributes/columns
|
8
|
+
actually have data.
|
9
|
+
|
10
|
+
This aids in avoiding the gotcha where a belongs_to
|
11
|
+
has a name that is not exactly matching with the _id
|
12
|
+
column, which goes undetected in many naive tests
|
13
|
+
(a simple build on the belongs_to will pass, a save
|
14
|
+
will pass, a reload and reading back the belongs_to
|
15
|
+
will pass and indicate correct values (because
|
16
|
+
reload does not touch values that are not actually
|
17
|
+
columns). Reading all the _id columns is one way
|
18
|
+
to detect this issue.
|
19
|
+
|
20
|
+
Example usage:
|
21
|
+
|
22
|
+
describe Contact do
|
23
|
+
|
24
|
+
context "has all columns for a full factory" do
|
25
|
+
contact = FactoryGirl.create(:full_contact)
|
26
|
+
contact = Contact.find(contact.id)
|
27
|
+
check_all_columns(contact)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
|
8
|
+
Bundler::GemHelper.install_tasks
|
9
|
+
|
10
|
+
task :test do
|
11
|
+
system 'rspec spec'
|
12
|
+
end
|
13
|
+
|
14
|
+
task :default => :test
|
data/lib/spec_support.rb
ADDED
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spec_support
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Peter Vandenabeele
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &84489650 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *84489650
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: sqlite3
|
27
|
+
requirement: &84489420 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *84489420
|
36
|
+
description: Add useful spec/support functionalities that come back in each project
|
37
|
+
email:
|
38
|
+
- peter@vandenabeele.com
|
39
|
+
executables: []
|
40
|
+
extensions: []
|
41
|
+
extra_rdoc_files: []
|
42
|
+
files:
|
43
|
+
- lib/spec_support.rb
|
44
|
+
- lib/tasks/spec_support_tasks.rake
|
45
|
+
- lib/spec_support/version.rb
|
46
|
+
- lib/spec_support/check_all_columns.rb
|
47
|
+
- MIT-LICENSE
|
48
|
+
- Rakefile
|
49
|
+
- README.rdoc
|
50
|
+
homepage: http://github.com/petervandenabeele/spec_support
|
51
|
+
licenses: []
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
hash: -627478417
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
hash: -627478417
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 1.8.10
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: spec/support for common cases
|
80
|
+
test_files: []
|