carlosbrando-remarkable 0.0.99 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -5
- data/Manifest.txt +53 -35
- data/PostInstall.txt +1 -6
- data/README.rdoc +109 -15
- data/Rakefile +29 -29
- data/lib/remarkable/active_record/README.markdown +378 -0
- data/lib/remarkable/active_record/active_record.rb +12 -11
- data/lib/remarkable/active_record/helpers.rb +215 -5
- data/lib/remarkable/active_record/macros/associations/association_matcher.rb +242 -0
- data/lib/remarkable/active_record/macros/callbacks/callback_matcher.rb +46 -0
- data/lib/remarkable/active_record/macros/database/column_matcher.rb +122 -0
- data/lib/remarkable/active_record/macros/database/index_matcher.rb +103 -0
- data/lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb +52 -0
- data/lib/remarkable/active_record/macros/validations/ensure_value_in_list_matcher.rb +83 -0
- data/lib/remarkable/active_record/macros/validations/ensure_value_in_range_matcher.rb +172 -0
- data/lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb +54 -0
- data/lib/remarkable/active_record/macros/validations/have_instance_methods_matcher.rb +54 -0
- data/lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb +94 -0
- data/lib/remarkable/active_record/macros/validations/have_readonly_attributes_matcher.rb +48 -0
- data/lib/remarkable/active_record/macros/validations/protect_attributes_matcher.rb +51 -0
- data/lib/remarkable/active_record/macros/validations/validate_acceptance_of_matcher.rb +79 -0
- data/lib/remarkable/active_record/macros/validations/validate_associated_matcher.rb +177 -0
- data/lib/remarkable/active_record/macros/validations/validate_confirmation_of_matcher.rb +74 -0
- data/lib/remarkable/active_record/macros/validations/validate_exclusion_of_matcher.rb +38 -0
- data/lib/remarkable/active_record/macros/validations/validate_format_of_matcher.rb +33 -0
- data/lib/remarkable/active_record/macros/validations/validate_inclusion_of_matcher.rb +45 -0
- data/lib/remarkable/active_record/macros/validations/validate_length_of_matcher.rb +248 -0
- data/lib/remarkable/active_record/macros/validations/validate_numericality_of_matcher.rb +206 -0
- data/lib/remarkable/active_record/macros/validations/validate_presence_of_matcher.rb +72 -0
- data/lib/remarkable/active_record/macros/validations/validate_uniqueness_of_matcher.rb +222 -0
- data/lib/remarkable/active_record/macros.rb +52 -0
- data/lib/remarkable/assertions.rb +29 -0
- data/lib/remarkable/controller/README.markdown +147 -0
- data/lib/remarkable/controller/controller.rb +11 -6
- data/lib/remarkable/controller/helpers.rb +4 -38
- data/lib/remarkable/controller/macros/assign_matcher.rb +85 -0
- data/lib/remarkable/controller/macros/filter_params_matcher.rb +63 -0
- data/lib/remarkable/controller/macros/metadata_matcher.rb +63 -0
- data/lib/remarkable/controller/macros/render_with_layout_matcher.rb +75 -0
- data/lib/remarkable/controller/macros/respond_with_content_type_matcher.rb +60 -0
- data/lib/remarkable/controller/macros/respond_with_matcher.rb +62 -0
- data/lib/remarkable/controller/macros/return_from_session_matcher.rb +58 -0
- data/lib/remarkable/controller/macros/route_matcher.rb +75 -0
- data/lib/remarkable/controller/macros/set_the_flash_to_matcher.rb +60 -0
- data/lib/remarkable/controller/macros.rb +78 -0
- data/lib/remarkable/dsl.rb +239 -0
- data/lib/remarkable/example/example_methods.rb +27 -7
- data/lib/remarkable/helpers.rb +28 -0
- data/lib/remarkable/matcher_base.rb +64 -0
- data/lib/remarkable/private_helpers.rb +10 -115
- data/lib/remarkable/rails.rb +27 -0
- data/lib/remarkable.rb +13 -5
- data/remarkable.gemspec +43 -0
- data/spec/controllers/posts_controller_spec.rb +58 -4
- data/spec/controllers/users_controller_spec.rb +1 -0
- data/spec/fixtures/fleas.yml +10 -0
- data/spec/fixtures/users.yml +7 -0
- data/spec/models/address_spec.rb +44 -0
- data/spec/models/dog_spec.rb +64 -3
- data/spec/models/flea_spec.rb +30 -0
- data/spec/models/post_spec.rb +36 -2
- data/spec/models/product_spec.rb +73 -8
- data/spec/models/tag_spec.rb +2 -2
- data/spec/models/tagging_spec.rb +24 -0
- data/spec/models/user_spec.rb +206 -21
- data/spec/other/custom_macros_spec.rb +27 -0
- data/spec/other/my_own_matcher_spec.rb +11 -0
- data/spec/other/private_helpers_spec.rb +31 -0
- data/spec/rails_root/app/controllers/posts_controller.rb +2 -0
- data/spec/rails_root/app/models/address.rb +2 -2
- data/spec/rails_root/app/models/flea.rb +4 -0
- data/spec/rails_root/app/models/pets/dog.rb +12 -0
- data/spec/rails_root/app/models/product.rb +7 -5
- data/spec/rails_root/app/models/tagging.rb +2 -0
- data/spec/rails_root/app/models/user.rb +20 -5
- data/spec/rails_root/app/views/layouts/posts.rhtml +8 -6
- data/spec/rails_root/config/database.yml +1 -2
- data/spec/rails_root/config/environment.rb +3 -1
- data/spec/rails_root/config/environments/{sqlite3.rb → test.rb} +0 -0
- data/spec/rails_root/config/locales/en.yml +8 -0
- data/spec/rails_root/db/migrate/001_create_users.rb +2 -2
- data/spec/rails_root/db/migrate/005_create_dogs.rb +1 -0
- data/spec/rails_root/db/migrate/011_add_fleas_color.rb +10 -0
- data/spec/rails_root/db/migrate/012_add_fleas_address.rb +10 -0
- data/spec/rails_root/spec/remarkable_macros/.keep +0 -0
- data/spec/rails_root/vendor/plugins/my_plugin/remarkable_macros/.keep +0 -0
- data/spec/spec_helper.rb +0 -2
- metadata +63 -43
- data/lib/remarkable/active_record/macros/associations/belong_to.rb +0 -81
- data/lib/remarkable/active_record/macros/associations/have_and_belong_to_many.rb +0 -77
- data/lib/remarkable/active_record/macros/associations/have_many.rb +0 -160
- data/lib/remarkable/active_record/macros/associations/have_one.rb +0 -133
- data/lib/remarkable/active_record/macros/database/have_db_column.rb +0 -81
- data/lib/remarkable/active_record/macros/database/have_db_columns.rb +0 -73
- data/lib/remarkable/active_record/macros/database/have_indices.rb +0 -75
- data/lib/remarkable/active_record/macros/validations/allow_values_for.rb +0 -103
- data/lib/remarkable/active_record/macros/validations/ensure_length_at_least.rb +0 -97
- data/lib/remarkable/active_record/macros/validations/ensure_length_in_range.rb +0 -134
- data/lib/remarkable/active_record/macros/validations/ensure_length_is.rb +0 -106
- data/lib/remarkable/active_record/macros/validations/ensure_value_in_range.rb +0 -117
- data/lib/remarkable/active_record/macros/validations/have_class_methods.rb +0 -74
- data/lib/remarkable/active_record/macros/validations/have_instance_methods.rb +0 -74
- data/lib/remarkable/active_record/macros/validations/have_named_scope.rb +0 -148
- data/lib/remarkable/active_record/macros/validations/have_readonly_attributes.rb +0 -81
- data/lib/remarkable/active_record/macros/validations/only_allow_numeric_values_for.rb +0 -89
- data/lib/remarkable/active_record/macros/validations/protect_attributes.rb +0 -89
- data/lib/remarkable/active_record/macros/validations/require_acceptance_of.rb +0 -94
- data/lib/remarkable/active_record/macros/validations/require_attributes.rb +0 -94
- data/lib/remarkable/active_record/macros/validations/require_unique_attributes.rb +0 -146
- data/lib/remarkable/controller/macros/assign_to.rb +0 -110
- data/lib/remarkable/controller/macros/filter_params.rb +0 -52
- data/lib/remarkable/controller/macros/redirect_to.rb +0 -24
- data/lib/remarkable/controller/macros/render_a_form.rb +0 -23
- data/lib/remarkable/controller/macros/render_template.rb +0 -18
- data/lib/remarkable/controller/macros/render_with_layout.rb +0 -61
- data/lib/remarkable/controller/macros/respond_with.rb +0 -86
- data/lib/remarkable/controller/macros/respond_with_content_type.rb +0 -45
- data/lib/remarkable/controller/macros/return_from_session.rb +0 -45
- data/lib/remarkable/controller/macros/route.rb +0 -91
- data/lib/remarkable/controller/macros/set_the_flash_to.rb +0 -58
- data/spec/rails_root/app/models/dog.rb +0 -5
data/History.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
* 2.2.0
|
2
|
+
* Added support to ALL ActiveRecord validations
|
3
|
+
* Some code refactoring to simplify Remarkable Base
|
2
4
|
|
3
|
-
* 1
|
4
|
-
*
|
5
|
-
* All macros of Shoulda have been ported to RSpec.
|
6
|
-
* Two syntaxes of macros have been added: Shoulda and RSpec.
|
5
|
+
* 2.1.5
|
6
|
+
* Added new method should_render_page_with_metadata with tests
|
data/Manifest.txt
CHANGED
@@ -5,51 +5,61 @@ README.rdoc
|
|
5
5
|
Rakefile
|
6
6
|
init.rb
|
7
7
|
lib/remarkable.rb
|
8
|
+
lib/remarkable/active_record/README.markdown
|
8
9
|
lib/remarkable/active_record/active_record.rb
|
9
10
|
lib/remarkable/active_record/helpers.rb
|
10
|
-
lib/remarkable/active_record/macros
|
11
|
-
lib/remarkable/active_record/macros/associations/
|
12
|
-
lib/remarkable/active_record/macros/
|
13
|
-
lib/remarkable/active_record/macros/
|
14
|
-
lib/remarkable/active_record/macros/database/
|
15
|
-
lib/remarkable/active_record/macros/
|
16
|
-
lib/remarkable/active_record/macros/
|
17
|
-
lib/remarkable/active_record/macros/validations/
|
18
|
-
lib/remarkable/active_record/macros/validations/
|
19
|
-
lib/remarkable/active_record/macros/validations/
|
20
|
-
lib/remarkable/active_record/macros/validations/
|
21
|
-
lib/remarkable/active_record/macros/validations/
|
22
|
-
lib/remarkable/active_record/macros/validations/
|
23
|
-
lib/remarkable/active_record/macros/validations/
|
24
|
-
lib/remarkable/active_record/macros/validations/
|
25
|
-
lib/remarkable/active_record/macros/validations/
|
26
|
-
lib/remarkable/active_record/macros/validations/
|
27
|
-
lib/remarkable/active_record/macros/validations/
|
28
|
-
lib/remarkable/active_record/macros/validations/
|
29
|
-
lib/remarkable/active_record/macros/validations/
|
30
|
-
lib/remarkable/active_record/macros/validations/
|
11
|
+
lib/remarkable/active_record/macros.rb
|
12
|
+
lib/remarkable/active_record/macros/associations/association_matcher.rb
|
13
|
+
lib/remarkable/active_record/macros/callbacks/callback_matcher.rb
|
14
|
+
lib/remarkable/active_record/macros/database/column_matcher.rb
|
15
|
+
lib/remarkable/active_record/macros/database/index_matcher.rb
|
16
|
+
lib/remarkable/active_record/macros/validations/allow_mass_assignment_of_matcher.rb
|
17
|
+
lib/remarkable/active_record/macros/validations/ensure_value_in_list_matcher.rb
|
18
|
+
lib/remarkable/active_record/macros/validations/ensure_value_in_range_matcher.rb
|
19
|
+
lib/remarkable/active_record/macros/validations/have_class_methods_matcher.rb
|
20
|
+
lib/remarkable/active_record/macros/validations/have_instance_methods_matcher.rb
|
21
|
+
lib/remarkable/active_record/macros/validations/have_named_scope_matcher.rb
|
22
|
+
lib/remarkable/active_record/macros/validations/have_readonly_attributes_matcher.rb
|
23
|
+
lib/remarkable/active_record/macros/validations/protect_attributes_matcher.rb
|
24
|
+
lib/remarkable/active_record/macros/validations/validate_acceptance_of_matcher.rb
|
25
|
+
lib/remarkable/active_record/macros/validations/validate_associated_matcher.rb
|
26
|
+
lib/remarkable/active_record/macros/validations/validate_confirmation_of_matcher.rb
|
27
|
+
lib/remarkable/active_record/macros/validations/validate_exclusion_of_matcher.rb
|
28
|
+
lib/remarkable/active_record/macros/validations/validate_format_of_matcher.rb
|
29
|
+
lib/remarkable/active_record/macros/validations/validate_inclusion_of_matcher.rb
|
30
|
+
lib/remarkable/active_record/macros/validations/validate_length_of_matcher.rb
|
31
|
+
lib/remarkable/active_record/macros/validations/validate_numericality_of_matcher.rb
|
32
|
+
lib/remarkable/active_record/macros/validations/validate_presence_of_matcher.rb
|
33
|
+
lib/remarkable/active_record/macros/validations/validate_uniqueness_of_matcher.rb
|
34
|
+
lib/remarkable/assertions.rb
|
35
|
+
lib/remarkable/controller/README.markdown
|
31
36
|
lib/remarkable/controller/controller.rb
|
32
37
|
lib/remarkable/controller/helpers.rb
|
33
|
-
lib/remarkable/controller/macros
|
34
|
-
lib/remarkable/controller/macros/
|
35
|
-
lib/remarkable/controller/macros/
|
36
|
-
lib/remarkable/controller/macros/
|
37
|
-
lib/remarkable/controller/macros/
|
38
|
-
lib/remarkable/controller/macros/
|
39
|
-
lib/remarkable/controller/macros/
|
40
|
-
lib/remarkable/controller/macros/
|
41
|
-
lib/remarkable/controller/macros/
|
42
|
-
lib/remarkable/controller/macros/
|
43
|
-
lib/remarkable/
|
38
|
+
lib/remarkable/controller/macros.rb
|
39
|
+
lib/remarkable/controller/macros/assign_matcher.rb
|
40
|
+
lib/remarkable/controller/macros/filter_params_matcher.rb
|
41
|
+
lib/remarkable/controller/macros/metadata_matcher.rb
|
42
|
+
lib/remarkable/controller/macros/render_with_layout_matcher.rb
|
43
|
+
lib/remarkable/controller/macros/respond_with_content_type_matcher.rb
|
44
|
+
lib/remarkable/controller/macros/respond_with_matcher.rb
|
45
|
+
lib/remarkable/controller/macros/return_from_session_matcher.rb
|
46
|
+
lib/remarkable/controller/macros/route_matcher.rb
|
47
|
+
lib/remarkable/controller/macros/set_the_flash_to_matcher.rb
|
48
|
+
lib/remarkable/dsl.rb
|
44
49
|
lib/remarkable/example/example_methods.rb
|
50
|
+
lib/remarkable/helpers.rb
|
51
|
+
lib/remarkable/matcher_base.rb
|
45
52
|
lib/remarkable/private_helpers.rb
|
53
|
+
lib/remarkable/rails.rb
|
46
54
|
rails/init.rb
|
55
|
+
remarkable.gemspec
|
47
56
|
script/console
|
48
57
|
script/destroy
|
49
58
|
script/generate
|
50
59
|
spec/controllers/posts_controller_spec.rb
|
51
60
|
spec/controllers/users_controller_spec.rb
|
52
61
|
spec/fixtures/addresses.yml
|
62
|
+
spec/fixtures/fleas.yml
|
53
63
|
spec/fixtures/friendships.yml
|
54
64
|
spec/fixtures/posts.yml
|
55
65
|
spec/fixtures/products.yml
|
@@ -65,6 +75,9 @@ spec/models/product_spec.rb
|
|
65
75
|
spec/models/tag_spec.rb
|
66
76
|
spec/models/tagging_spec.rb
|
67
77
|
spec/models/user_spec.rb
|
78
|
+
spec/other/custom_macros_spec.rb
|
79
|
+
spec/other/my_own_matcher_spec.rb
|
80
|
+
spec/other/private_helpers_spec.rb
|
68
81
|
spec/rails_root/app/controllers/application.rb
|
69
82
|
spec/rails_root/app/controllers/posts_controller.rb
|
70
83
|
spec/rails_root/app/controllers/users_controller.rb
|
@@ -72,9 +85,9 @@ spec/rails_root/app/helpers/application_helper.rb
|
|
72
85
|
spec/rails_root/app/helpers/posts_helper.rb
|
73
86
|
spec/rails_root/app/helpers/users_helper.rb
|
74
87
|
spec/rails_root/app/models/address.rb
|
75
|
-
spec/rails_root/app/models/dog.rb
|
76
88
|
spec/rails_root/app/models/flea.rb
|
77
89
|
spec/rails_root/app/models/friendship.rb
|
90
|
+
spec/rails_root/app/models/pets/dog.rb
|
78
91
|
spec/rails_root/app/models/post.rb
|
79
92
|
spec/rails_root/app/models/product.rb
|
80
93
|
spec/rails_root/app/models/tag.rb
|
@@ -94,9 +107,10 @@ spec/rails_root/app/views/users/show.rhtml
|
|
94
107
|
spec/rails_root/config/boot.rb
|
95
108
|
spec/rails_root/config/database.yml
|
96
109
|
spec/rails_root/config/environment.rb
|
97
|
-
spec/rails_root/config/environments/
|
110
|
+
spec/rails_root/config/environments/test.rb
|
98
111
|
spec/rails_root/config/initializers/new_rails_defaults.rb
|
99
112
|
spec/rails_root/config/initializers/shoulda.rb
|
113
|
+
spec/rails_root/config/locales/en.yml
|
100
114
|
spec/rails_root/config/routes.rb
|
101
115
|
spec/rails_root/db/migrate/001_create_users.rb
|
102
116
|
spec/rails_root/db/migrate/002_create_posts.rb
|
@@ -108,16 +122,20 @@ spec/rails_root/db/migrate/007_create_fleas.rb
|
|
108
122
|
spec/rails_root/db/migrate/008_create_dogs_fleas.rb
|
109
123
|
spec/rails_root/db/migrate/009_create_products.rb
|
110
124
|
spec/rails_root/db/migrate/010_create_friendships.rb
|
125
|
+
spec/rails_root/db/migrate/011_add_fleas_color.rb
|
126
|
+
spec/rails_root/db/migrate/012_add_fleas_address.rb
|
111
127
|
spec/rails_root/db/schema.rb
|
112
128
|
spec/rails_root/log/.keep
|
113
|
-
spec/rails_root/log/
|
129
|
+
spec/rails_root/log/test.log
|
114
130
|
spec/rails_root/public/.htaccess
|
115
131
|
spec/rails_root/public/404.html
|
116
132
|
spec/rails_root/public/422.html
|
117
133
|
spec/rails_root/public/500.html
|
118
134
|
spec/rails_root/script/console
|
119
135
|
spec/rails_root/script/generate
|
136
|
+
spec/rails_root/spec/remarkable_macros/.keep
|
120
137
|
spec/rails_root/vendor/plugins/.keep
|
138
|
+
spec/rails_root/vendor/plugins/my_plugin/remarkable_macros/.keep
|
121
139
|
spec/rcov.opts
|
122
140
|
spec/spec.opts
|
123
141
|
spec/spec_helper.rb
|
data/PostInstall.txt
CHANGED
data/README.rdoc
CHANGED
@@ -1,32 +1,126 @@
|
|
1
|
-
=
|
1
|
+
= Simplifying tests!
|
2
2
|
|
3
|
-
|
3
|
+
Remarkable is a framework for Rspec matchers.
|
4
4
|
|
5
|
-
|
5
|
+
Matchers are a powerful tool for DRYing and simplifying tests and if you are using Rspec on Rails, you are already using them for a long long time (redirect_to and be_success for example).
|
6
6
|
|
7
|
-
|
7
|
+
But the creation of matchers should not be in hand of few, but spreaded to millions. :)
|
8
8
|
|
9
|
-
|
9
|
+
If not enough, Remarkable also makes easy your matchers become macros and have even cleaner tests.
|
10
10
|
|
11
|
-
|
11
|
+
== Current Features
|
12
12
|
|
13
|
-
|
13
|
+
Here are some of the things that make Remarkable special (and we are working on even more):
|
14
14
|
|
15
|
-
|
15
|
+
* <b>All</b> ActiveRecord validation macros with support to <b>all</b> options;
|
16
|
+
* More Rails macros (all currently Shoulda macros are ported);
|
17
|
+
* It has two different test syntaxes: one for those who like the RSpec style and another for those who like macro (Shoulda) style;
|
18
|
+
* It's a gem;
|
19
|
+
* Tests;
|
20
|
+
* More tests;
|
21
|
+
* And a few more tests.
|
16
22
|
|
17
|
-
|
23
|
+
Unlike other similar projects, Remarkable is the only one that tests itself, and this is a big difference, believe me!
|
18
24
|
|
19
|
-
|
25
|
+
How can we trust in a project that has no tests? How do you ensure that the last commit didn't break anything?
|
20
26
|
|
21
|
-
==
|
27
|
+
== Synopsis
|
22
28
|
|
23
|
-
|
29
|
+
All Remarkable macros can be accessed in two different ways. For those who prefer the Shoulda style, let’s look at some model tests:
|
24
30
|
|
25
|
-
|
31
|
+
describe Post do
|
32
|
+
fixtures :all
|
33
|
+
|
34
|
+
should_belong_to :user
|
35
|
+
should_belong_to :owner
|
36
|
+
should_belong_to :user, :owner
|
37
|
+
|
38
|
+
should_have_many :tags, :through => :taggings
|
39
|
+
should_have_many :through_tags, :through => :taggings
|
40
|
+
should_have_many :tags, :through_tags, :through => :taggings
|
41
|
+
|
42
|
+
should_validate_uniqueness_of :title
|
43
|
+
should_validate_presence_of :body, :message => /wtf/
|
44
|
+
should_validate_presence_of :title
|
45
|
+
should_validate_numericality_of :user_id
|
46
|
+
end
|
47
|
+
|
48
|
+
Notice how you declare your macros with the same name as you do in Rails! This is great because most of the time you won't have to check the documentation (just pay attention that <tt>has_many</tt> becomes <tt>have_many</tt> and <tt>validates</tt> become <tt>validate</tt> according to english grammar).
|
49
|
+
|
50
|
+
The syntax above is similar with Shoulda, but those who likes more the Rspec way can simply do:
|
51
|
+
|
52
|
+
describe Post do
|
53
|
+
fixtures :all
|
54
|
+
|
55
|
+
it { should belong_to(:user) }
|
56
|
+
it { should belong_to(:owner) }
|
57
|
+
it { should belong_to(:user, :owner) }
|
58
|
+
|
59
|
+
it { should have_many(:tags, :through => :taggings) }
|
60
|
+
it { should have_many(:through_tags, :through => :taggings) }
|
61
|
+
it { should have_many(:tags, :through_tags, :through => :taggings) }
|
62
|
+
|
63
|
+
it { should validate_uniqueness_of(:title) }
|
64
|
+
it { should validate_presence_of(:body, :message => /wtf/) }
|
65
|
+
it { should validate_presence_of(:title) }
|
66
|
+
it { should validate_numericality_of(:user_id) }
|
67
|
+
end
|
68
|
+
|
69
|
+
== Macros
|
70
|
+
|
71
|
+
=== Here are all the available macros:
|
72
|
+
|
73
|
+
ActiveRecord macros: http://wiki.github.com/carlosbrando/remarkable/active-record-macros
|
74
|
+
|
75
|
+
Controller macros: http://wiki.github.com/carlosbrando/remarkable/controller-macros
|
76
|
+
|
77
|
+
=== Pending Macros
|
78
|
+
|
79
|
+
Even more than just bringing macros to Rspec, we are bringing Rspec to macros. So let's suppose you are doing some code refactoring and you know some tests will fail while you clean the house, what do you do then?
|
80
|
+
|
81
|
+
In Rspec you could do:
|
82
|
+
|
83
|
+
xit { should validate_numericality_of(:user_id) }
|
84
|
+
|
85
|
+
Well, now you can do just the same with macros:
|
86
|
+
|
87
|
+
xvalidate_numericality_of(:user_id)
|
88
|
+
|
89
|
+
And it's even better, because it will show a nice message:
|
90
|
+
|
91
|
+
"Example disabled: should validate numericality of user_id"
|
92
|
+
|
93
|
+
Yeah!
|
94
|
+
|
95
|
+
== Install
|
96
|
+
|
97
|
+
Run the following if you haven't already:
|
98
|
+
|
99
|
+
gem sources -a http://gems.github.com
|
100
|
+
|
101
|
+
Install the gem:
|
102
|
+
|
103
|
+
sudo gem install carlosbrando-remarkable
|
104
|
+
|
105
|
+
In RAILS_ROOT/config/environment.rb:
|
106
|
+
|
107
|
+
config.gem "carlosbrando-remarkable", :lib => "remarkable", :source => "http://gems.github.com"
|
108
|
+
|
109
|
+
== Requirements
|
110
|
+
|
111
|
+
* rspec >= 1.1.12
|
112
|
+
* rspec-rails >= 1.1.12
|
113
|
+
|
114
|
+
== More information
|
115
|
+
|
116
|
+
Google group: http://groups.google.com/group/remarkable-core
|
117
|
+
Bug tracking: http://carlosbrando.lighthouseapp.com/projects/19775-remarkable/overview
|
118
|
+
|
119
|
+
== License
|
26
120
|
|
27
121
|
(The MIT License)
|
28
122
|
|
29
|
-
Copyright (c) 2008
|
123
|
+
Copyright (c) 2008 Carlos Brando
|
30
124
|
|
31
125
|
Permission is hereby granted, free of charge, to any person obtaining
|
32
126
|
a copy of this software and associated documentation files (the
|
@@ -45,4 +139,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
45
139
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
46
140
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
47
141
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
48
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
142
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
|
2
|
-
require File.dirname(__FILE__) + '/lib/remarkable'
|
3
|
-
|
4
|
-
# Generate all the Rake tasks
|
5
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
6
|
-
$hoe = Hoe.new('remarkable', Remarkable::VERSION) do |p|
|
7
|
-
p.developer('Carlos Brando', 'eduardobrando@gmail.com')
|
8
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
|
-
p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
10
|
-
p.rubyforge_name = p.name # TODO this is default value
|
11
|
-
p.extra_deps = [
|
12
|
-
['rspec','>= 1.1.
|
13
|
-
['rspec-rails','>= 1.1.
|
14
|
-
]
|
15
|
-
p.extra_dev_deps = [
|
16
|
-
['newgem', ">= #{::Newgem::VERSION}"]
|
17
|
-
]
|
18
|
-
|
19
|
-
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
20
|
-
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
21
|
-
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
22
|
-
p.rsync_args = '-av --delete --ignore-errors'
|
23
|
-
end
|
24
|
-
|
25
|
-
require 'newgem/tasks' # load /tasks/*.rake
|
26
|
-
Dir['tasks/**/*.rake'].each { |t| load t }
|
27
|
-
|
28
|
-
# TODO - want other tests/tasks run by default? Add them to the list
|
29
|
-
task :default => [:spec, :features]
|
1
|
+
%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
|
2
|
+
require File.dirname(__FILE__) + '/lib/remarkable'
|
3
|
+
|
4
|
+
# Generate all the Rake tasks
|
5
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
6
|
+
$hoe = Hoe.new('remarkable', Remarkable::VERSION) do |p|
|
7
|
+
p.developer('Carlos Brando', 'eduardobrando@gmail.com')
|
8
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
|
+
p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
10
|
+
p.rubyforge_name = p.name # TODO this is default value
|
11
|
+
p.extra_deps = [
|
12
|
+
['rspec','>= 1.1.12'],
|
13
|
+
['rspec-rails','>= 1.1.12']
|
14
|
+
]
|
15
|
+
p.extra_dev_deps = [
|
16
|
+
['newgem', ">= #{::Newgem::VERSION}"]
|
17
|
+
]
|
18
|
+
|
19
|
+
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
20
|
+
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
21
|
+
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
22
|
+
p.rsync_args = '-av --delete --ignore-errors'
|
23
|
+
end
|
24
|
+
|
25
|
+
require 'newgem/tasks' # load /tasks/*.rake
|
26
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
27
|
+
|
28
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
29
|
+
task :default => [:spec, :features]
|