nimboids-shoulda 2.11.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CONTRIBUTION_GUIDELINES.rdoc +10 -0
- data/MIT-LICENSE +22 -0
- data/README.rdoc +154 -0
- data/Rakefile +74 -0
- data/bin/convert_to_should_syntax +42 -0
- data/lib/shoulda/action_controller/macros.rb +221 -0
- data/lib/shoulda/action_controller/matchers/assign_to_matcher.rb +114 -0
- data/lib/shoulda/action_controller/matchers/filter_param_matcher.rb +74 -0
- data/lib/shoulda/action_controller/matchers/redirect_to_matcher.rb +62 -0
- data/lib/shoulda/action_controller/matchers/render_template_matcher.rb +54 -0
- data/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb +99 -0
- data/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb +74 -0
- data/lib/shoulda/action_controller/matchers/respond_with_matcher.rb +85 -0
- data/lib/shoulda/action_controller/matchers/route_matcher.rb +93 -0
- data/lib/shoulda/action_controller/matchers/set_session_matcher.rb +98 -0
- data/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb +100 -0
- data/lib/shoulda/action_controller/matchers.rb +39 -0
- data/lib/shoulda/action_controller.rb +34 -0
- data/lib/shoulda/action_mailer/assertions.rb +42 -0
- data/lib/shoulda/action_mailer/matchers/have_sent_email.rb +110 -0
- data/lib/shoulda/action_mailer/matchers.rb +22 -0
- data/lib/shoulda/action_mailer.rb +13 -0
- data/lib/shoulda/active_record/assertions.rb +69 -0
- data/lib/shoulda/active_record/helpers.rb +32 -0
- data/lib/shoulda/active_record/macros.rb +457 -0
- data/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb +83 -0
- data/lib/shoulda/active_record/matchers/allow_value_matcher.rb +110 -0
- data/lib/shoulda/active_record/matchers/association_matcher.rb +275 -0
- data/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb +87 -0
- data/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb +141 -0
- data/lib/shoulda/active_record/matchers/have_db_column_matcher.rb +169 -0
- data/lib/shoulda/active_record/matchers/have_db_index_matcher.rb +112 -0
- data/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb +59 -0
- data/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb +41 -0
- data/lib/shoulda/active_record/matchers/validate_format_of_matcher.rb +65 -0
- data/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb +39 -0
- data/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb +60 -0
- data/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb +148 -0
- data/lib/shoulda/active_record/matchers/validation_matcher.rb +56 -0
- data/lib/shoulda/active_record/matchers.rb +42 -0
- data/lib/shoulda/active_record.rb +16 -0
- data/lib/shoulda/assertions.rb +79 -0
- data/lib/shoulda/autoload_macros.rb +46 -0
- data/lib/shoulda/context.rb +441 -0
- data/lib/shoulda/helpers.rb +8 -0
- data/lib/shoulda/integrations/rspec.rb +13 -0
- data/lib/shoulda/integrations/rspec2.rb +22 -0
- data/lib/shoulda/integrations/test_unit.rb +22 -0
- data/lib/shoulda/macros.rb +161 -0
- data/lib/shoulda/private_helpers.rb +13 -0
- data/lib/shoulda/proc_extensions.rb +14 -0
- data/lib/shoulda/rails.rb +8 -0
- data/lib/shoulda/tasks/list_tests.rake +29 -0
- data/lib/shoulda/tasks/yaml_to_shoulda.rake +28 -0
- data/lib/shoulda/tasks.rb +3 -0
- data/lib/shoulda/version.rb +4 -0
- data/lib/shoulda.rb +9 -0
- data/rails/init.rb +8 -0
- data/test/README +36 -0
- data/test/fail_macros.rb +55 -0
- data/test/fixtures/addresses.yml +3 -0
- data/test/fixtures/friendships.yml +0 -0
- data/test/fixtures/posts.yml +5 -0
- data/test/fixtures/products.yml +0 -0
- data/test/fixtures/taggings.yml +0 -0
- data/test/fixtures/tags.yml +9 -0
- data/test/fixtures/users.yml +6 -0
- data/test/functional/posts_controller_test.rb +121 -0
- data/test/functional/users_controller_test.rb +19 -0
- data/test/matchers/action_mailer/have_sent_email_test.rb +76 -0
- data/test/matchers/active_record/allow_mass_assignment_of_matcher_test.rb +74 -0
- data/test/matchers/active_record/allow_value_matcher_test.rb +64 -0
- data/test/matchers/active_record/association_matcher_test.rb +462 -0
- data/test/matchers/active_record/ensure_inclusion_of_matcher_test.rb +81 -0
- data/test/matchers/active_record/ensure_length_of_matcher_test.rb +158 -0
- data/test/matchers/active_record/have_db_column_matcher_test.rb +169 -0
- data/test/matchers/active_record/have_db_index_matcher_test.rb +91 -0
- data/test/matchers/active_record/have_readonly_attributes_matcher_test.rb +29 -0
- data/test/matchers/active_record/validate_acceptance_of_matcher_test.rb +44 -0
- data/test/matchers/active_record/validate_format_of_matcher_test.rb +39 -0
- data/test/matchers/active_record/validate_numericality_of_matcher_test.rb +52 -0
- data/test/matchers/active_record/validate_presence_of_matcher_test.rb +86 -0
- data/test/matchers/active_record/validate_uniqueness_of_matcher_test.rb +147 -0
- data/test/matchers/controller/assign_to_matcher_test.rb +55 -0
- data/test/matchers/controller/filter_param_matcher_test.rb +40 -0
- data/test/matchers/controller/redirect_to_matcher_test.rb +37 -0
- data/test/matchers/controller/render_template_matcher_test.rb +37 -0
- data/test/matchers/controller/render_with_layout_matcher_test.rb +47 -0
- data/test/matchers/controller/respond_with_content_type_matcher_test.rb +32 -0
- data/test/matchers/controller/respond_with_matcher_test.rb +96 -0
- data/test/matchers/controller/route_matcher_test.rb +75 -0
- data/test/matchers/controller/set_session_matcher_test.rb +48 -0
- data/test/matchers/controller/set_the_flash_matcher.rb +95 -0
- data/test/other/autoload_macro_test.rb +18 -0
- data/test/other/context_test.rb +372 -0
- data/test/other/convert_to_should_syntax_test.rb +63 -0
- data/test/other/helpers_test.rb +317 -0
- data/test/other/private_helpers_test.rb +32 -0
- data/test/other/should_test.rb +271 -0
- data/test/rails2_model_builder.rb +130 -0
- data/test/rails2_root/app/controllers/application_controller.rb +22 -0
- data/test/rails2_root/app/controllers/posts_controller.rb +87 -0
- data/test/rails2_root/app/controllers/users_controller.rb +84 -0
- data/test/rails2_root/app/helpers/application_helper.rb +3 -0
- data/test/rails2_root/app/helpers/posts_helper.rb +2 -0
- data/test/rails2_root/app/helpers/users_helper.rb +2 -0
- data/test/rails2_root/app/models/address.rb +7 -0
- data/test/rails2_root/app/models/flea.rb +11 -0
- data/test/rails2_root/app/models/friendship.rb +4 -0
- data/test/rails2_root/app/models/notifier.rb +8 -0
- data/test/rails2_root/app/models/pets/cat.rb +7 -0
- data/test/rails2_root/app/models/pets/dog.rb +10 -0
- data/test/rails2_root/app/models/post.rb +12 -0
- data/test/rails2_root/app/models/product.rb +12 -0
- data/test/rails2_root/app/models/profile.rb +2 -0
- data/test/rails2_root/app/models/registration.rb +2 -0
- data/test/rails2_root/app/models/tag.rb +8 -0
- data/test/rails2_root/app/models/tagging.rb +4 -0
- data/test/rails2_root/app/models/treat.rb +3 -0
- data/test/rails2_root/app/models/user.rb +32 -0
- data/test/rails2_root/app/views/layouts/posts.rhtml +19 -0
- data/test/rails2_root/app/views/layouts/users.rhtml +17 -0
- data/test/rails2_root/app/views/layouts/wide.html.erb +1 -0
- data/test/rails2_root/app/views/notifier/the_email.html.erb +1 -0
- data/test/rails2_root/app/views/posts/edit.rhtml +27 -0
- data/test/rails2_root/app/views/posts/index.rhtml +25 -0
- data/test/rails2_root/app/views/posts/new.rhtml +26 -0
- data/test/rails2_root/app/views/posts/show.rhtml +18 -0
- data/test/rails2_root/app/views/users/edit.rhtml +22 -0
- data/test/rails2_root/app/views/users/index.rhtml +22 -0
- data/test/rails2_root/app/views/users/new.rhtml +21 -0
- data/test/rails2_root/app/views/users/show.rhtml +13 -0
- data/test/rails2_root/config/boot.rb +110 -0
- data/test/rails2_root/config/database.yml +4 -0
- data/test/rails2_root/config/environment.rb +17 -0
- data/test/rails2_root/config/environments/test.rb +23 -0
- data/test/rails2_root/config/initializers/new_rails_defaults.rb +15 -0
- data/test/rails2_root/config/initializers/shoulda.rb +8 -0
- data/test/rails2_root/config/routes.rb +6 -0
- data/test/rails2_root/db/migrate/001_create_users.rb +19 -0
- data/test/rails2_root/db/migrate/002_create_posts.rb +13 -0
- data/test/rails2_root/db/migrate/003_create_taggings.rb +12 -0
- data/test/rails2_root/db/migrate/004_create_tags.rb +11 -0
- data/test/rails2_root/db/migrate/005_create_dogs.rb +12 -0
- data/test/rails2_root/db/migrate/006_create_addresses.rb +14 -0
- data/test/rails2_root/db/migrate/007_create_fleas.rb +11 -0
- data/test/rails2_root/db/migrate/008_create_dogs_fleas.rb +12 -0
- data/test/rails2_root/db/migrate/009_create_products.rb +17 -0
- data/test/rails2_root/db/migrate/010_create_friendships.rb +14 -0
- data/test/rails2_root/db/migrate/011_create_treats.rb +12 -0
- data/test/rails2_root/db/migrate/20090506203502_create_profiles.rb +12 -0
- data/test/rails2_root/db/migrate/20090506203536_create_registrations.rb +14 -0
- data/test/rails2_root/db/migrate/20090513104502_create_cats.rb +12 -0
- data/test/rails2_root/db/schema.rb +0 -0
- data/test/rails2_root/public/404.html +30 -0
- data/test/rails2_root/public/422.html +30 -0
- data/test/rails2_root/public/500.html +30 -0
- data/test/rails2_root/script/console +3 -0
- data/test/rails2_root/script/generate +3 -0
- data/test/rails2_root/test/shoulda_macros/custom_macro.rb +6 -0
- data/test/rails2_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb +6 -0
- data/test/rails2_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb +6 -0
- data/test/rails2_test_helper.rb +6 -0
- data/test/rails3_model_builder.rb +118 -0
- data/test/rails3_root/Gemfile +28 -0
- data/test/rails3_root/README +244 -0
- data/test/rails3_root/Rakefile +10 -0
- data/test/rails3_root/app/controllers/application_controller.rb +22 -0
- data/test/rails3_root/app/controllers/posts_controller.rb +87 -0
- data/test/rails3_root/app/controllers/users_controller.rb +82 -0
- data/test/rails3_root/app/helpers/application_helper.rb +2 -0
- data/test/rails3_root/app/models/address.rb +7 -0
- data/test/rails3_root/app/models/flea.rb +11 -0
- data/test/rails3_root/app/models/friendship.rb +4 -0
- data/test/rails3_root/app/models/notifier.rb +8 -0
- data/test/rails3_root/app/models/pets/cat.rb +7 -0
- data/test/rails3_root/app/models/pets/dog.rb +10 -0
- data/test/rails3_root/app/models/post.rb +12 -0
- data/test/rails3_root/app/models/product.rb +12 -0
- data/test/rails3_root/app/models/profile.rb +2 -0
- data/test/rails3_root/app/models/registration.rb +2 -0
- data/test/rails3_root/app/models/tag.rb +8 -0
- data/test/rails3_root/app/models/tagging.rb +4 -0
- data/test/rails3_root/app/models/treat.rb +3 -0
- data/test/rails3_root/app/models/user.rb +32 -0
- data/test/rails3_root/app/views/layouts/application.html.erb +14 -0
- data/test/rails3_root/app/views/layouts/posts.rhtml +19 -0
- data/test/rails3_root/app/views/layouts/users.rhtml +17 -0
- data/test/rails3_root/app/views/layouts/wide.html.erb +1 -0
- data/test/rails3_root/app/views/notifier/the_email.html.erb +1 -0
- data/test/rails3_root/app/views/posts/edit.rhtml +27 -0
- data/test/rails3_root/app/views/posts/index.rhtml +25 -0
- data/test/rails3_root/app/views/posts/new.rhtml +24 -0
- data/test/rails3_root/app/views/posts/show.rhtml +18 -0
- data/test/rails3_root/app/views/users/edit.rhtml +22 -0
- data/test/rails3_root/app/views/users/index.rhtml +22 -0
- data/test/rails3_root/app/views/users/new.rhtml +21 -0
- data/test/rails3_root/app/views/users/show.rhtml +13 -0
- data/test/rails3_root/config/application.rb +46 -0
- data/test/rails3_root/config/boot.rb +6 -0
- data/test/rails3_root/config/database.yml +22 -0
- data/test/rails3_root/config/environment.rb +5 -0
- data/test/rails3_root/config/environments/development.rb +19 -0
- data/test/rails3_root/config/environments/production.rb +42 -0
- data/test/rails3_root/config/environments/test.rb +32 -0
- data/test/rails3_root/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails3_root/config/initializers/inflections.rb +10 -0
- data/test/rails3_root/config/initializers/mime_types.rb +5 -0
- data/test/rails3_root/config/initializers/secret_token.rb +7 -0
- data/test/rails3_root/config/initializers/session_store.rb +8 -0
- data/test/rails3_root/config/locales/en.yml +5 -0
- data/test/rails3_root/config/routes.rb +4 -0
- data/test/rails3_root/config.ru +4 -0
- data/test/rails3_root/db/migrate/001_create_users.rb +19 -0
- data/test/rails3_root/db/migrate/002_create_posts.rb +13 -0
- data/test/rails3_root/db/migrate/003_create_taggings.rb +12 -0
- data/test/rails3_root/db/migrate/004_create_tags.rb +11 -0
- data/test/rails3_root/db/migrate/005_create_dogs.rb +12 -0
- data/test/rails3_root/db/migrate/006_create_addresses.rb +14 -0
- data/test/rails3_root/db/migrate/007_create_fleas.rb +11 -0
- data/test/rails3_root/db/migrate/008_create_dogs_fleas.rb +12 -0
- data/test/rails3_root/db/migrate/009_create_products.rb +17 -0
- data/test/rails3_root/db/migrate/010_create_friendships.rb +14 -0
- data/test/rails3_root/db/migrate/011_create_treats.rb +12 -0
- data/test/rails3_root/db/migrate/20090506203502_create_profiles.rb +12 -0
- data/test/rails3_root/db/migrate/20090506203536_create_registrations.rb +14 -0
- data/test/rails3_root/db/migrate/20090513104502_create_cats.rb +12 -0
- data/test/rails3_root/db/seeds.rb +7 -0
- data/test/rails3_root/public/404.html +26 -0
- data/test/rails3_root/public/422.html +26 -0
- data/test/rails3_root/public/500.html +26 -0
- data/test/rails3_root/public/favicon.ico +0 -0
- data/test/rails3_root/public/images/rails.png +0 -0
- data/test/rails3_root/public/index.html +279 -0
- data/test/rails3_root/public/javascripts/application.js +2 -0
- data/test/rails3_root/public/javascripts/controls.js +965 -0
- data/test/rails3_root/public/javascripts/dragdrop.js +974 -0
- data/test/rails3_root/public/javascripts/effects.js +1123 -0
- data/test/rails3_root/public/javascripts/prototype.js +4874 -0
- data/test/rails3_root/public/javascripts/rails.js +118 -0
- data/test/rails3_root/public/robots.txt +5 -0
- data/test/rails3_root/script/rails +9 -0
- data/test/rails3_root/test/performance/browsing_test.rb +9 -0
- data/test/rails3_root/test/test_helper.rb +13 -0
- data/test/rails3_test_helper.rb +6 -0
- data/test/rspec_test.rb +207 -0
- data/test/test_helper.rb +36 -0
- data/test/unit/address_test.rb +10 -0
- data/test/unit/cat_test.rb +7 -0
- data/test/unit/dog_test.rb +9 -0
- data/test/unit/flea_test.rb +14 -0
- data/test/unit/friendship_test.rb +6 -0
- data/test/unit/post_test.rb +15 -0
- data/test/unit/product_test.rb +23 -0
- data/test/unit/tag_test.rb +11 -0
- data/test/unit/tagging_test.rb +6 -0
- data/test/unit/user_test.rb +46 -0
- metadata +330 -0
@@ -0,0 +1,10 @@
|
|
1
|
+
We're using GitHub[http://github.com/thoughtbot/shoulda/tree/master], and we've been getting any combination of github pull requests, tickets, patches, emails, etc. We need to normalize this workflow to make sure we don't miss any fixes.
|
2
|
+
|
3
|
+
* Make sure you're accessing the source from the {official repository}[http://github.com/thoughtbot/shoulda/tree/master].
|
4
|
+
* We prefer git branches over patches, but we can take either.
|
5
|
+
* If you're using git, please make a branch for each separate contribution. We can cherry pick your commits, but pulling from a branch is easier.
|
6
|
+
* If you're submitting patches, please cut each fix or feature into a separate patch.
|
7
|
+
* There should be an issue[http://github.com/thoughtbot/shoulda/issues] for any submission. If you've found a bug and want to fix it, open a new ticket at the same time.
|
8
|
+
* Please <b>don't send pull requests</b> Just update the issue with the url for your fix (or attach the patch) when it's ready. The github pull requests pretty much get dropped on the floor until someone with commit rights notices them in the mailbox.
|
9
|
+
* Contributions without tests won't be accepted. The file <tt>/test/README</tt> explains the testing system pretty thoroughly.
|
10
|
+
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2007, Tammer Saleh, Thoughtbot, Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
= Shoulda - Making tests easy on the fingers and eyes
|
2
|
+
|
3
|
+
Shoulda makes it easy to write elegant, understandable, and maintainable tests. Shoulda consists of matchers, test helpers, and assertions. It's fully compatible with your existing tests in Test::Unit or RSpec, and requires no retooling to use.
|
4
|
+
|
5
|
+
Matchers:: Test::Unit- and RSpec-compatible one-liners that test common Rails functionality.
|
6
|
+
These tests would otherwise be much longer, more complex, and error-prone.
|
7
|
+
Helpers:: #context and #should give you RSpec like test blocks in Test::Unit.
|
8
|
+
In addition, you get nested contexts and a much more readable syntax.
|
9
|
+
Assertions:: Many common Rails testing idioms have been distilled into a set of useful assertions.
|
10
|
+
|
11
|
+
= Usage
|
12
|
+
|
13
|
+
=== ActiveRecord Tests (Shoulda::ActiveRecord::Matchers)
|
14
|
+
|
15
|
+
Test your ActiveRecord associations and validations with these powerful matchers:
|
16
|
+
|
17
|
+
class PostTest < Test::Unit::TestCase
|
18
|
+
should belong_to(:user)
|
19
|
+
should have_many(:tags).through(:taggings)
|
20
|
+
|
21
|
+
should validate_uniqueness_of(:title)
|
22
|
+
should validate_presence_of(:body).with_message(/wtf/)
|
23
|
+
should validate_presence_of(:title)
|
24
|
+
should validate_numericality_of(:user_id)
|
25
|
+
end
|
26
|
+
|
27
|
+
class UserTest < Test::Unit::TestCase
|
28
|
+
should have_many(:posts)
|
29
|
+
|
30
|
+
should_not allow_value("blah").for(:email)
|
31
|
+
should_not allow_value("b lah").for(:email)
|
32
|
+
should allow_value("a@b.com").for(:email)
|
33
|
+
should allow_value("asdf@asdf.com").for(:email)
|
34
|
+
should ensure_inclusion_of(:email).in_range(1..100)
|
35
|
+
should ensure_inclusion_of(:age).in_range(1..100)
|
36
|
+
should_not allow_mass_assignment_of(:password)
|
37
|
+
end
|
38
|
+
|
39
|
+
Makes TDD so much easier.
|
40
|
+
|
41
|
+
=== Controller Tests (Shoulda::Controller::Matchers)
|
42
|
+
|
43
|
+
Matchers to test the most common controller patterns...
|
44
|
+
|
45
|
+
class PostsControllerTest < ActionController::TestCase
|
46
|
+
context "on GET to :show for first record" do
|
47
|
+
setup do
|
48
|
+
get :show, :id => 1
|
49
|
+
end
|
50
|
+
|
51
|
+
should assign_to(:user)
|
52
|
+
should respond_with(:success)
|
53
|
+
should render_template(:show)
|
54
|
+
should_not set_the_flash
|
55
|
+
|
56
|
+
should "do something else really cool" do
|
57
|
+
assert_equal 1, assigns(:user).id
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
=== Context Helpers (Shoulda::Context)
|
63
|
+
|
64
|
+
Stop killing your fingers with all of those underscores... Name your tests with plain sentences!
|
65
|
+
|
66
|
+
class UserTest < Test::Unit::TestCase
|
67
|
+
context "A User instance" do
|
68
|
+
setup do
|
69
|
+
@user = User.find(:first)
|
70
|
+
end
|
71
|
+
|
72
|
+
should "return its full name" do
|
73
|
+
assert_equal 'John Doe', @user.full_name
|
74
|
+
end
|
75
|
+
|
76
|
+
context "with a profile" do
|
77
|
+
setup do
|
78
|
+
@user.profile = Profile.find(:first)
|
79
|
+
end
|
80
|
+
|
81
|
+
should "return true when sent #has_profile?" do
|
82
|
+
assert @user.has_profile?
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
Produces the following test methods:
|
89
|
+
|
90
|
+
"test: A User instance should return its full name."
|
91
|
+
"test: A User instance with a profile should return true when sent #has_profile?."
|
92
|
+
|
93
|
+
So readable!
|
94
|
+
|
95
|
+
=== Helpful Assertions (Shoulda::Assertions)
|
96
|
+
|
97
|
+
More to come here, but have fun with what's there.
|
98
|
+
|
99
|
+
assert_same_elements([:a, :b, :c], [:c, :a, :b])
|
100
|
+
assert_contains(['a', '1'], /\d/)
|
101
|
+
assert_contains(['a', '1'], 'a')
|
102
|
+
|
103
|
+
= Rails Installation (Test::Unit)
|
104
|
+
|
105
|
+
Specify the gem dependency in your config/environment.rb file:
|
106
|
+
|
107
|
+
Rails::Initializer.run do |config|
|
108
|
+
config.gem "shoulda", :lib => "shoulda"
|
109
|
+
end
|
110
|
+
|
111
|
+
Then:
|
112
|
+
|
113
|
+
$ rake gems:install
|
114
|
+
$ rake gems:unpack
|
115
|
+
|
116
|
+
= Rails Installation (RSpec)
|
117
|
+
|
118
|
+
If you're using Shoulda with RSpec, we recommend that you add config.gem lines
|
119
|
+
for RSpec and Shoulda in your config/environment/test.rb file, but do not ask
|
120
|
+
Rails to load the RSpec and Shoulda libraries:
|
121
|
+
|
122
|
+
config.gem 'rspec', :lib => false
|
123
|
+
config.gem 'rspec-rails', :lib => false
|
124
|
+
config.gem 'shoulda', :lib => false
|
125
|
+
|
126
|
+
Then require shoulda from your spec/spec_helper.rb file, before Spec::Runner is
|
127
|
+
configured:
|
128
|
+
|
129
|
+
# requires for RSpec
|
130
|
+
require 'shoulda'
|
131
|
+
Spec::Runner.configure do |config|
|
132
|
+
# ...
|
133
|
+
|
134
|
+
You should not need to require anything besides the top-level shoulda library.
|
135
|
+
|
136
|
+
= Rails 3 Installation (RSpec)
|
137
|
+
|
138
|
+
With Rails 3 and Bundler, requiring Shoulda is as easy as adding it to your Gemfile:
|
139
|
+
|
140
|
+
group :test do
|
141
|
+
gem "shoulda"
|
142
|
+
gem "rspec-rails", "2.0.0.beta.12"
|
143
|
+
end
|
144
|
+
|
145
|
+
Shoulda will automatically include matchers into the appropriate example
|
146
|
+
groups.
|
147
|
+
|
148
|
+
= Credits
|
149
|
+
|
150
|
+
Shoulda is maintained and funded by {thoughtbot}[http://thoughtbot.com/community]
|
151
|
+
|
152
|
+
= License
|
153
|
+
|
154
|
+
Shoulda is Copyright © 2006-2010 Tammer Saleh, Thoughtbot. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
|
data/Rakefile
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rake/rdoctask'
|
5
|
+
require 'rake/gempackagetask'
|
6
|
+
begin
|
7
|
+
require 'cucumber/rake/task'
|
8
|
+
rescue LoadError
|
9
|
+
warn "couldn't load cucumber, skipping"
|
10
|
+
end
|
11
|
+
|
12
|
+
$LOAD_PATH.unshift("lib")
|
13
|
+
require 'shoulda/version'
|
14
|
+
load 'tasks/shoulda.rake'
|
15
|
+
|
16
|
+
# Test::Unit::UI::VERBOSE
|
17
|
+
test_files_pattern = 'test/{unit,functional,other,matchers}/**/*_test.rb'
|
18
|
+
Rake::TestTask.new do |t|
|
19
|
+
t.libs << 'lib' << 'test'
|
20
|
+
t.pattern = test_files_pattern
|
21
|
+
t.verbose = false
|
22
|
+
end
|
23
|
+
|
24
|
+
Rake::RDocTask.new { |rdoc|
|
25
|
+
rdoc.rdoc_dir = 'doc'
|
26
|
+
rdoc.title = "Shoulda -- Making tests easy on the fingers and eyes"
|
27
|
+
rdoc.options << '--line-numbers'
|
28
|
+
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
29
|
+
rdoc.rdoc_files.include('README.rdoc', 'CONTRIBUTION_GUIDELINES.rdoc', 'lib/**/*.rb')
|
30
|
+
}
|
31
|
+
|
32
|
+
desc "Run code-coverage analysis using rcov"
|
33
|
+
task :coverage do
|
34
|
+
rm_rf "coverage"
|
35
|
+
files = Dir[test_files_pattern]
|
36
|
+
system "rcov --rails --sort coverage -Ilib #{files.join(' ')}"
|
37
|
+
end
|
38
|
+
|
39
|
+
eval("$specification = begin; #{IO.read('shoulda.gemspec')}; end")
|
40
|
+
Rake::GemPackageTask.new $specification do |pkg|
|
41
|
+
pkg.need_tar = true
|
42
|
+
pkg.need_zip = true
|
43
|
+
end
|
44
|
+
|
45
|
+
desc "Clean files generated by rake tasks"
|
46
|
+
task :clobber => [:clobber_rdoc, :clobber_package]
|
47
|
+
|
48
|
+
namespace :cucumber do
|
49
|
+
Cucumber::Rake::Task.new(:rails2, "Run the cucumber features in Rails 2") do |t|
|
50
|
+
t.fork = true
|
51
|
+
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
|
52
|
+
t.profile = 'rails2'
|
53
|
+
end
|
54
|
+
|
55
|
+
Cucumber::Rake::Task.new(:rails3, "Run the cucumber features in Rails 3") do |t|
|
56
|
+
t.fork = true
|
57
|
+
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
|
58
|
+
t.profile = 'rails3'
|
59
|
+
end
|
60
|
+
end rescue nil
|
61
|
+
|
62
|
+
desc "Run the cucumber features in both Rails 2 and 3"
|
63
|
+
task :cucumber => ["cucumber:rails2", "cucumber:rails3"]
|
64
|
+
|
65
|
+
desc 'run tests for all supported versions of Rails'
|
66
|
+
task :test_all do
|
67
|
+
%w(2.3.8 3.0.0.beta4).each do |version|
|
68
|
+
system("RAILS_VERSION=#{version} rake -s test;")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
desc 'Default: run test and cucumber features for support versions'
|
73
|
+
task :default => [:test_all, :cucumber]
|
74
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
3
|
+
require 'tmpdir'
|
4
|
+
|
5
|
+
TMP = Dir::tmpdir
|
6
|
+
|
7
|
+
def usage(msg = nil)
|
8
|
+
puts "Error: #{msg}" if msg
|
9
|
+
puts if msg
|
10
|
+
puts "Usage: #{File.basename(__FILE__)} normal_test_file.rb"
|
11
|
+
puts
|
12
|
+
puts "Will convert an existing test file with names like "
|
13
|
+
puts
|
14
|
+
puts " def test_should_do_stuff"
|
15
|
+
puts " ..."
|
16
|
+
puts " end"
|
17
|
+
puts
|
18
|
+
puts "to one using the new syntax: "
|
19
|
+
puts
|
20
|
+
puts " should \"be super cool\" do"
|
21
|
+
puts " ..."
|
22
|
+
puts " end"
|
23
|
+
puts
|
24
|
+
puts "A copy of the old file will be left under #{TMP} in case\nthis script just seriously screws up"
|
25
|
+
puts
|
26
|
+
exit (msg ? 2 : 0)
|
27
|
+
end
|
28
|
+
|
29
|
+
usage("Wrong number of arguments.") unless ARGV.size == 1
|
30
|
+
usage("Temp directory '#{TMP}' is not valid. Set TMPDIR environment variable to a writeable directory.") unless File.directory?(TMP) && File.writable?(TMP)
|
31
|
+
|
32
|
+
file = ARGV.shift
|
33
|
+
tmpfile = File.join(TMP, File.basename(file))
|
34
|
+
usage("File '#{file}' doesn't exist") unless File.exists?(file)
|
35
|
+
|
36
|
+
FileUtils.cp(file, tmpfile)
|
37
|
+
contents = File.read(tmpfile)
|
38
|
+
contents.gsub!(/def test_should_(\S+)/) {|line| "should \"#{$1.tr('_', ' ')}\" do"}
|
39
|
+
contents.gsub!(/def test_(\S+)/) {|line| "should \"RENAME ME: test #{$1.tr('_', ' ')}\" do"}
|
40
|
+
File.open(file, 'w') { |f| f.write(contents) }
|
41
|
+
|
42
|
+
puts "File '#{file}' has been converted to 'should' syntax. Old version has been stored in '#{tmpfile}'"
|
@@ -0,0 +1,221 @@
|
|
1
|
+
module Shoulda # :nodoc:
|
2
|
+
module ActionController # :nodoc:
|
3
|
+
# = Macro test helpers for your controllers
|
4
|
+
#
|
5
|
+
# By using the macro helpers you can quickly and easily create concise and easy to read test suites.
|
6
|
+
#
|
7
|
+
# This code segment:
|
8
|
+
# context "on GET to :show for first record" do
|
9
|
+
# setup do
|
10
|
+
# get :show, :id => 1
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# should_assign_to :user
|
14
|
+
# should_respond_with :success
|
15
|
+
# should_render_template :show
|
16
|
+
# should_not_set_the_flash
|
17
|
+
#
|
18
|
+
# should "do something else really cool" do
|
19
|
+
# assert_equal 1, assigns(:user).id
|
20
|
+
# end
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# Would produce 5 tests for the +show+ action
|
24
|
+
module Macros
|
25
|
+
include Matchers
|
26
|
+
|
27
|
+
# Deprecated: use ActionController::Matchers#set_the_flash instead.
|
28
|
+
#
|
29
|
+
# Macro that creates a test asserting that the flash contains the given
|
30
|
+
# value. Expects a +String+ or +Regexp+.
|
31
|
+
#
|
32
|
+
# Example:
|
33
|
+
#
|
34
|
+
# should_set_the_flash_to "Thank you for placing this order."
|
35
|
+
# should_set_the_flash_to /created/i
|
36
|
+
def should_set_the_flash_to(val)
|
37
|
+
::ActiveSupport::Deprecation.warn("use: should set_the_flash")
|
38
|
+
should set_the_flash.to(val)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Deprecated: use ActionController::Matchers#set_the_flash instead.
|
42
|
+
#
|
43
|
+
# Macro that creates a test asserting that the flash is empty.
|
44
|
+
def should_not_set_the_flash
|
45
|
+
::ActiveSupport::Deprecation.warn("use: should_not set_the_flash")
|
46
|
+
should_not set_the_flash
|
47
|
+
end
|
48
|
+
|
49
|
+
# Deprecated: use ActionController::Matchers#filter_param instead.
|
50
|
+
#
|
51
|
+
# Macro that creates a test asserting that filter_parameter_logging
|
52
|
+
# is set for the specified keys
|
53
|
+
#
|
54
|
+
# Example:
|
55
|
+
#
|
56
|
+
# should_filter_params :password, :ssn
|
57
|
+
def should_filter_params(*keys)
|
58
|
+
::ActiveSupport::Deprecation.warn("use: should filter_param")
|
59
|
+
keys.each do |key|
|
60
|
+
should filter_param(key)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Deprecated: use ActionController::Matchers#assign_to instead.
|
65
|
+
#
|
66
|
+
# Macro that creates a test asserting that the controller assigned to
|
67
|
+
# each of the named instance variable(s).
|
68
|
+
#
|
69
|
+
# Options:
|
70
|
+
# * <tt>:class</tt> - The expected class of the instance variable being checked.
|
71
|
+
#
|
72
|
+
# If a block is passed, the assigned variable is expected to be equal to
|
73
|
+
# the return value of that block.
|
74
|
+
#
|
75
|
+
# Example:
|
76
|
+
#
|
77
|
+
# should_assign_to :user, :posts
|
78
|
+
# should_assign_to :user, :class => User
|
79
|
+
# should_assign_to(:user) { @user }
|
80
|
+
def should_assign_to(*names, &block)
|
81
|
+
::ActiveSupport::Deprecation.warn("use: should assign_to")
|
82
|
+
klass = get_options!(names, :class)
|
83
|
+
names.each do |name|
|
84
|
+
matcher = assign_to(name).with_kind_of(klass)
|
85
|
+
matcher = matcher.with(&block) if block
|
86
|
+
should matcher
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Deprecated: use ActionController::Matchers#assign_to instead.
|
91
|
+
#
|
92
|
+
# Macro that creates a test asserting that the controller did not assign to
|
93
|
+
# any of the named instance variable(s).
|
94
|
+
#
|
95
|
+
# Example:
|
96
|
+
#
|
97
|
+
# should_not_assign_to :user, :posts
|
98
|
+
def should_not_assign_to(*names)
|
99
|
+
::ActiveSupport::Deprecation.warn("use: should_not assign_to")
|
100
|
+
names.each do |name|
|
101
|
+
should_not assign_to(name)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Deprecated: use ActionController::Matchers#respond_with instead.
|
106
|
+
#
|
107
|
+
# Macro that creates a test asserting that the controller responded with a 'response' status code.
|
108
|
+
# Example:
|
109
|
+
#
|
110
|
+
# should_respond_with :success
|
111
|
+
def should_respond_with(response)
|
112
|
+
::ActiveSupport::Deprecation.warn("use: should respond_with")
|
113
|
+
should respond_with(response)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Deprecated: use ActionController::Matchers#respond_with_content_type instead.
|
117
|
+
#
|
118
|
+
# Macro that creates a test asserting that the response content type was 'content_type'.
|
119
|
+
# Example:
|
120
|
+
#
|
121
|
+
# should_respond_with_content_type 'application/rss+xml'
|
122
|
+
# should_respond_with_content_type :rss
|
123
|
+
# should_respond_with_content_type /rss/
|
124
|
+
def should_respond_with_content_type(content_type)
|
125
|
+
::ActiveSupport::Deprecation.warn("use: should respond_with_content_type")
|
126
|
+
should respond_with_content_type(content_type)
|
127
|
+
end
|
128
|
+
|
129
|
+
# Deprecated: use ActionController::Matchers#set_session instead.
|
130
|
+
#
|
131
|
+
# Macro that creates a test asserting that a value returned from the
|
132
|
+
# session is correct. Expects the session key as a parameter, and a block
|
133
|
+
# that returns the expected value.
|
134
|
+
#
|
135
|
+
# Example:
|
136
|
+
#
|
137
|
+
# should_set_session(:user_id) { @user.id }
|
138
|
+
# should_set_session(:message) { "Free stuff" }
|
139
|
+
def should_set_session(key, &block)
|
140
|
+
::ActiveSupport::Deprecation.warn("use: should set_session")
|
141
|
+
matcher = set_session(key)
|
142
|
+
matcher = matcher.to(&block) if block
|
143
|
+
should matcher
|
144
|
+
end
|
145
|
+
|
146
|
+
# Deprecated: use ActionController::Matchers#render_template instead.
|
147
|
+
#
|
148
|
+
# Macro that creates a test asserting that the controller rendered the given template.
|
149
|
+
# Example:
|
150
|
+
#
|
151
|
+
# should_render_template :new
|
152
|
+
def should_render_template(template)
|
153
|
+
::ActiveSupport::Deprecation.warn("use: should render_template")
|
154
|
+
should render_template(template)
|
155
|
+
end
|
156
|
+
|
157
|
+
# Deprecated: use ActionController::Matchers#render_with_layout instead.
|
158
|
+
#
|
159
|
+
# Macro that creates a test asserting that the controller rendered with the given layout.
|
160
|
+
# Example:
|
161
|
+
#
|
162
|
+
# should_render_with_layout 'special'
|
163
|
+
def should_render_with_layout(expected_layout = 'application')
|
164
|
+
::ActiveSupport::Deprecation.warn("use: should render_with_layout")
|
165
|
+
should render_with_layout(expected_layout)
|
166
|
+
end
|
167
|
+
|
168
|
+
# Deprecated: use ActionController::Matchers#render_with_layout instead.
|
169
|
+
#
|
170
|
+
# Macro that creates a test asserting that the controller rendered without a layout.
|
171
|
+
# Same as @should_render_with_layout false@
|
172
|
+
def should_render_without_layout
|
173
|
+
::ActiveSupport::Deprecation.warn("use: should_not render_with_layout")
|
174
|
+
should_not render_with_layout
|
175
|
+
end
|
176
|
+
|
177
|
+
# Deprecated: use ActionController::Matchers#redirect_to instead.
|
178
|
+
#
|
179
|
+
# Macro that creates a test asserting that the controller returned a
|
180
|
+
# redirect to the given path. The passed description will be used when
|
181
|
+
# generating a test name. Expects a block that returns the expected path
|
182
|
+
# for the redirect.
|
183
|
+
#
|
184
|
+
# Example:
|
185
|
+
#
|
186
|
+
# should_redirect_to("the user's profile") { user_url(@user) }
|
187
|
+
def should_redirect_to(description, &block)
|
188
|
+
::ActiveSupport::Deprecation.warn("use: should redirect_to")
|
189
|
+
should redirect_to(description, &block)
|
190
|
+
end
|
191
|
+
|
192
|
+
# Deprecated: use ActionController::Matchers#route instead.
|
193
|
+
#
|
194
|
+
# Macro that creates a routing test. It tries to use the given HTTP
|
195
|
+
# +method+ on the given +path+, and asserts that it routes to the
|
196
|
+
# given +options+.
|
197
|
+
#
|
198
|
+
# If you don't specify a :controller, it will try to guess the controller
|
199
|
+
# based on the current test.
|
200
|
+
#
|
201
|
+
# +to_param+ is called on the +options+ given.
|
202
|
+
#
|
203
|
+
# Examples:
|
204
|
+
#
|
205
|
+
# should_route :get, "/posts", :controller => :posts, :action => :index
|
206
|
+
# should_route :get, "/posts/new", :action => :new
|
207
|
+
# should_route :post, "/posts", :action => :create
|
208
|
+
# should_route :get, "/posts/1", :action => :show, :id => 1
|
209
|
+
# should_route :edit, "/posts/1", :action => :show, :id => 1
|
210
|
+
# should_route :put, "/posts/1", :action => :update, :id => 1
|
211
|
+
# should_route :delete, "/posts/1", :action => :destroy, :id => 1
|
212
|
+
# should_route :get, "/users/1/posts/1",
|
213
|
+
# :action => :show, :id => 1, :user_id => 1
|
214
|
+
#
|
215
|
+
def should_route(method, path, options)
|
216
|
+
::ActiveSupport::Deprecation.warn("use: should route")
|
217
|
+
should route(method, path).to(options)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
module Shoulda # :nodoc:
|
2
|
+
module ActionController # :nodoc:
|
3
|
+
module Matchers
|
4
|
+
|
5
|
+
# Ensures that the controller assigned to the named instance variable.
|
6
|
+
#
|
7
|
+
# Options:
|
8
|
+
# * <tt>with_kind_of</tt> - The expected class of the instance variable
|
9
|
+
# being checked.
|
10
|
+
# * <tt>with</tt> - The value that should be assigned.
|
11
|
+
#
|
12
|
+
# Example:
|
13
|
+
#
|
14
|
+
# it { should assign_to(:user) }
|
15
|
+
# it { should_not assign_to(:user) }
|
16
|
+
# it { should assign_to(:user).with_kind_of(User) }
|
17
|
+
# it { should assign_to(:user).with(@user) }
|
18
|
+
def assign_to(variable)
|
19
|
+
AssignToMatcher.new(variable)
|
20
|
+
end
|
21
|
+
|
22
|
+
class AssignToMatcher # :nodoc:
|
23
|
+
|
24
|
+
def initialize(variable)
|
25
|
+
@variable = variable.to_s
|
26
|
+
@check_value = false
|
27
|
+
end
|
28
|
+
|
29
|
+
def with_kind_of(expected_class)
|
30
|
+
@expected_class = expected_class
|
31
|
+
self
|
32
|
+
end
|
33
|
+
|
34
|
+
def with(expected_value = nil, &block)
|
35
|
+
@check_value = true
|
36
|
+
@expected_value = expected_value
|
37
|
+
@expectation_block = block
|
38
|
+
self
|
39
|
+
end
|
40
|
+
|
41
|
+
def matches?(controller)
|
42
|
+
@controller = controller
|
43
|
+
@expected_value = @context.instance_eval(&@expectation_block) if @expectation_block
|
44
|
+
assigned_value? && kind_of_expected_class? && equal_to_expected_value?
|
45
|
+
end
|
46
|
+
|
47
|
+
attr_reader :failure_message, :negative_failure_message
|
48
|
+
|
49
|
+
def description
|
50
|
+
description = "assign @#{@variable}"
|
51
|
+
description << " with a kind of #{@expected_class}" if @expected_class
|
52
|
+
description
|
53
|
+
end
|
54
|
+
|
55
|
+
def in_context(context)
|
56
|
+
@context = context
|
57
|
+
self
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def assigned_value?
|
63
|
+
if !@controller.instance_variables.include?("@#{@variable}")
|
64
|
+
@failure_message =
|
65
|
+
"Expected action to assign a value for @#{@variable}"
|
66
|
+
false
|
67
|
+
else
|
68
|
+
@negative_failure_message =
|
69
|
+
"Didn't expect action to assign a value for @#{@variable}, " <<
|
70
|
+
"but it was assigned to #{assigned_value.inspect}"
|
71
|
+
true
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def kind_of_expected_class?
|
76
|
+
return true unless @expected_class
|
77
|
+
if assigned_value.kind_of?(@expected_class)
|
78
|
+
@negative_failure_message =
|
79
|
+
"Didn't expect action to assign a kind of #{@expected_class} " <<
|
80
|
+
"for #{@variable}, but got one anyway"
|
81
|
+
true
|
82
|
+
else
|
83
|
+
@failure_message =
|
84
|
+
"Expected action to assign a kind of #{@expected_class} " <<
|
85
|
+
"for #{@variable}, but got #{@variable.inspect} " <<
|
86
|
+
"(#{@variable.class.name})"
|
87
|
+
false
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def equal_to_expected_value?
|
92
|
+
return true unless @check_value
|
93
|
+
if @expected_value == assigned_value
|
94
|
+
@negative_failure_message =
|
95
|
+
"Didn't expect action to assign #{@expected_value.inspect} " <<
|
96
|
+
"for #{@variable}, but got it anyway"
|
97
|
+
true
|
98
|
+
else
|
99
|
+
@failure_message =
|
100
|
+
"Expected action to assign #{@expected_value.inspect} " <<
|
101
|
+
"for #{@variable}, but got #{assigned_value.inspect}"
|
102
|
+
false
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def assigned_value
|
107
|
+
@controller.instance_variable_get("@#{@variable}")
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|