create_valid 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,6 +1,36 @@
1
1
  = create_valid
2
2
 
3
- Description goes here.
3
+
4
+ == Using with shoulda
5
+
6
+ `create_valid` supports shoulda. One caveat is that to use create_valid's magic methods
7
+ from within a setup block one must first open a context.
8
+
9
+ # Wrong
10
+ class MyTest < ActiveSupport::TestCase
11
+ setup do
12
+ @user = build_valid_user # THIS WILL NOT WORK
13
+ end
14
+
15
+ should "be invalid without a name" do
16
+ @user.name = ''
17
+ assert !@user.valid?
18
+ end
19
+ end
20
+
21
+ # Correct
22
+ class MyTest < ActiveSupport::TestCase
23
+ context "a valid user" do
24
+ setup do
25
+ @user = build_valid_user
26
+ end
27
+
28
+ should "be invalid without a name" do
29
+ @user.name = ''
30
+ assert !@user.valid?
31
+ end
32
+ end
33
+ end
4
34
 
5
35
  == Note on Patches/Pull Requests
6
36
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/create_valid.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{create_valid}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jason Frame"]
12
- s.date = %q{2010-07-07}
12
+ s.date = %q{2010-07-27}
13
13
  s.email = %q{jason@onehackoranother.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
data/lib/create_valid.rb CHANGED
@@ -55,6 +55,7 @@ module CreateValid
55
55
  begin
56
56
  @stack << instance
57
57
  augment(instance, features)
58
+ merge_attributes(instance, extra_attributes)
58
59
  assert_validity(instance) if require_valid
59
60
  instance.save! if save
60
61
  ensure
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jason Frame
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-07 00:00:00 +01:00
17
+ date: 2010-07-27 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency