koujou 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = koujou
1
+ = Koujou
2
2
 
3
3
  * http://github.com/mleung/koujou
4
4
 
data/koujou.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{koujou}
5
- s.version = "0.1.0"
5
+ s.version = "0.1.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Michael Leung"]
data/lib/koujou.rb CHANGED
@@ -11,7 +11,7 @@ require 'koujou/validation_reflection'
11
11
  require 'koujou/custom_validation'
12
12
 
13
13
  module Koujou
14
- VERSION = '0.1.0'
14
+ VERSION = '0.1.1'
15
15
  end
16
16
 
17
17
  if ENV["RAILS_ENV"] == "test"
@@ -43,9 +43,9 @@ module Koujou #:nodoc:
43
43
 
44
44
  set_required_attributes!(instance, attributes)
45
45
  set_unique_attributes!(instance, attributes)
46
- set_confirmation_attributes!(instance, attributes)
47
46
  set_length_validated_attributes!(instance, attributes)
48
47
  set_inclusion_validated_attributes!(instance, attributes)
48
+ set_confirmation_attributes!(instance, attributes)
49
49
  create_associations(instance, recursed_from_model)
50
50
  CustomValidation.stub_custom_validations!(instance)
51
51
 
@@ -49,8 +49,6 @@ module Koujou #:nodoc:
49
49
  retval = format_if_sequenced(Faker::Address.us_state)
50
50
  elsif @validation.name.to_s.match(/zip|postal/)
51
51
  retval = format_if_sequenced(Faker::Address.zip_code)
52
- elsif @validation.name.to_s == 'password' || @validation.name.to_s == 'password_confirmation'
53
- retval = 'koujourama'
54
52
  else
55
53
  # If we don't match any standard stuff, just return a regular bs lorem string comprised of 10 words.
56
54
  # 10 is sort of a "magic number" I might make a constant for that.
@@ -82,6 +80,10 @@ module Koujou #:nodoc:
82
80
  DateTime.now
83
81
  end
84
82
 
83
+ def generate_date
84
+ DateTime.now.to_date
85
+ end
86
+
85
87
  def generate_boolean
86
88
  true
87
89
  end
data/test/test_builder.rb CHANGED
@@ -41,6 +41,11 @@ class TestBuilder < Test::Unit::TestCase
41
41
  assert_not_nil u.password_confirmation
42
42
  end
43
43
 
44
+ should 'have the same value for password_confirmation as password' do
45
+ u = User.koujou
46
+ assert_equal u.password, u.password_confirmation
47
+ end
48
+
44
49
  should 'allow me to override the model attributes' do
45
50
  namae = 'One Factory to Rule them all'
46
51
  p = Post.koujou(true, :name => namae)
@@ -52,32 +52,6 @@ class TestDataGenerator < Test::Unit::TestCase
52
52
  assert Koujou::DataGenerator.new(false, @validation).generate_data_for_column_type
53
53
  end
54
54
  end
55
-
56
- context 'on generate for attributes that are not columns' do
57
- setup do
58
- @validation = mock("ActiveRecord::Reflection::MacroReflection")
59
- @validation.expects(:active_record).once.returns(User)
60
- end
61
-
62
- should 'always generate "koujourama" for passwords' do
63
- @validation.expects(:name).at_least_once.returns('password')
64
- assert_equal "koujourama", Koujou::DataGenerator.new(false, @validation).generate_data_for_column_type
65
- end
66
-
67
- should 'always generate "koujourama" for password confirmations' do
68
- @validation.expects(:name).at_least_once.returns('password_confirmation')
69
- assert_equal "koujourama", Koujou::DataGenerator.new(false, @validation).generate_data_for_column_type
70
- end
71
-
72
- should 'always generate the same for password and password confirmations' do
73
- @validation.expects(:name).at_least_once.returns('password')
74
- password = Koujou::DataGenerator.new(false, @validation).generate_data_for_column_type
75
- @validation.expects(:active_record).once.returns(User)
76
- @validation.expects(:name).at_least_once.returns('password_confirmation')
77
- password_confirmation = Koujou::DataGenerator.new(false, @validation).generate_data_for_column_type
78
- assert_equal password, password_confirmation
79
- end
80
- end
81
55
 
82
56
  context 'on generate with a required length' do
83
57
  setup do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: koujou
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Leung
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-12 00:00:00 +00:00
12
+ date: 2010-04-14 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency