shoulda-activemodel 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. data/lib/shoulda/active_model.rb +16 -0
  2. data/lib/shoulda/active_model/assertions.rb +61 -0
  3. data/lib/shoulda/active_model/helpers.rb +31 -0
  4. data/lib/shoulda/active_model/macros.rb +268 -0
  5. data/lib/shoulda/active_model/matchers.rb +30 -0
  6. data/lib/shoulda/active_model/matchers/allow_value_matcher.rb +102 -0
  7. data/lib/shoulda/active_model/matchers/ensure_inclusion_of_matcher.rb +87 -0
  8. data/lib/shoulda/active_model/matchers/ensure_length_of_matcher.rb +141 -0
  9. data/lib/shoulda/active_model/matchers/validate_acceptance_of_matcher.rb +41 -0
  10. data/lib/shoulda/active_model/matchers/validate_format_of_matcher.rb +67 -0
  11. data/lib/shoulda/active_model/matchers/validate_numericality_of_matcher.rb +39 -0
  12. data/lib/shoulda/active_model/matchers/validate_presence_of_matcher.rb +60 -0
  13. data/lib/shoulda/active_model/matchers/validate_uniqueness_of_matcher.rb +148 -0
  14. data/lib/shoulda/active_model/matchers/validation_matcher.rb +57 -0
  15. data/test/fail_macros.rb +39 -0
  16. data/test/matchers/active_model/ensure_inclusion_of_matcher_test.rb +80 -0
  17. data/test/matchers/active_model/ensure_length_of_matcher_test.rb +158 -0
  18. data/test/matchers/active_model/validate_acceptance_of_matcher_test.rb +44 -0
  19. data/test/matchers/active_model/validate_format_of_matcher_test.rb +39 -0
  20. data/test/matchers/active_model/validate_numericality_of_matcher_test.rb +52 -0
  21. data/test/matchers/active_model/validate_presence_of_matcher_test.rb +86 -0
  22. data/test/matchers/active_model/validate_uniqueness_of_matcher_test.rb +147 -0
  23. data/test/model_builder.rb +106 -0
  24. data/test/rspec_test.rb +207 -0
  25. data/test/test_helper.rb +20 -0
  26. metadata +106 -0
@@ -0,0 +1,20 @@
1
+ # Load the environment
2
+ ENV['RAILS_ENV'] = 'test'
3
+
4
+ # Load the testing framework
5
+ require 'test/unit'
6
+ require 'shoulda'
7
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
8
+ require 'shoulda/active_model'
9
+ require 'active_support/core_ext/kernel/requires'
10
+ require 'active_support/test_case'
11
+ require 'active_record'
12
+
13
+ ActiveRecord::Base.establish_connection(
14
+ :adapter => "sqlite3",
15
+ :database => ":memory:"
16
+ )
17
+
18
+ require 'test/fail_macros'
19
+ require 'test/model_builder'
20
+
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shoulda-activemodel
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 2
10
+ version: 0.0.2
11
+ platform: ruby
12
+ authors:
13
+ - Kaid
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-06-14 00:00:00 +08:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: shoulda
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 35
30
+ segments:
31
+ - 2
32
+ - 11
33
+ - 0
34
+ version: 2.11.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: "Usage: just require 'shoulda/active_model', and include Shoulda::ActiveModel::Matchers in your test suite."
38
+ email: kaid@kaid.me
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files: []
44
+
45
+ files:
46
+ - lib/shoulda/active_model.rb
47
+ - lib/shoulda/active_model/assertions.rb
48
+ - lib/shoulda/active_model/helpers.rb
49
+ - lib/shoulda/active_model/macros.rb
50
+ - lib/shoulda/active_model/matchers.rb
51
+ - lib/shoulda/active_model/matchers/allow_value_matcher.rb
52
+ - lib/shoulda/active_model/matchers/ensure_inclusion_of_matcher.rb
53
+ - lib/shoulda/active_model/matchers/ensure_length_of_matcher.rb
54
+ - lib/shoulda/active_model/matchers/validate_acceptance_of_matcher.rb
55
+ - lib/shoulda/active_model/matchers/validate_format_of_matcher.rb
56
+ - lib/shoulda/active_model/matchers/validate_numericality_of_matcher.rb
57
+ - lib/shoulda/active_model/matchers/validate_presence_of_matcher.rb
58
+ - lib/shoulda/active_model/matchers/validate_uniqueness_of_matcher.rb
59
+ - lib/shoulda/active_model/matchers/validation_matcher.rb
60
+ - test/fail_macros.rb
61
+ - test/model_builder.rb
62
+ - test/rspec_test.rb
63
+ - test/test_helper.rb
64
+ - test/matchers/active_model/ensure_length_of_matcher_test.rb
65
+ - test/matchers/active_model/validate_acceptance_of_matcher_test.rb
66
+ - test/matchers/active_model/validate_format_of_matcher_test.rb
67
+ - test/matchers/active_model/validate_numericality_of_matcher_test.rb
68
+ - test/matchers/active_model/validate_presence_of_matcher_test.rb
69
+ - test/matchers/active_model/validate_uniqueness_of_matcher_test.rb
70
+ - test/matchers/active_model/ensure_inclusion_of_matcher_test.rb
71
+ has_rdoc: true
72
+ homepage: http://github.com/kaid/shoulda-activemodel
73
+ licenses: []
74
+
75
+ post_install_message:
76
+ rdoc_options: []
77
+
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ hash: 3
95
+ segments:
96
+ - 0
97
+ version: "0"
98
+ requirements: []
99
+
100
+ rubyforge_project:
101
+ rubygems_version: 1.3.7
102
+ signing_key:
103
+ specification_version: 3
104
+ summary: Based on TomK32's shoulda hack. Working with activemodel.
105
+ test_files: []
106
+