Removed untyped contructor from ComponentRegistration and add a protected setter.
[castle.git] / MonoRail / WatirTestCases / ARSupport / category.rb
blob577cdced7c2d3cd119fc7519c1a71eed7c3f13b7
1 ## Copyright 2004-2007 Castle Project - http://www.castleproject.org/\r
2 ## \r
3 ## Licensed under the Apache License, Version 2.0 (the "License");\r
4 ## you may not use this file except in compliance with the License.\r
5 ## You may obtain a copy of the License at\r
6 ## \r
7 ##     http://www.apache.org/licenses/LICENSE-2.0\r
8 ## \r
9 ## Unless required by applicable law or agreed to in writing, software\r
10 ## distributed under the License is distributed on an "AS IS" BASIS,\r
11 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
12 ## See the License for the specific language governing permissions and\r
13 ## limitations under the License.\r
15 require '../common'\r
17 class Category\r
19         class << self\r
21                 include Test::Unit::Assertions\r
22                 include CommonIEDriver\r
24                 def create(ie, name)\r
26                         ie.goto("#{$base_url}/category/new.castle")\r
28                         ie.text_field(:id, "category_name").set(name)\r
29                         \r
30                         ie.button(:id, 'insertbutton').click\r
32                         assert_no_exception(ie)\r
33                         \r
34                         assert_equal(name, ie.span(:id, 'name').text, 'Insert: name was not set')\r
36                         # returns new id\r
37                         \r
38                         get_id(ie)\r
39                         \r
40                 end\r
41                 \r
42                 def edit(ie, id, name)\r
44                         ie.goto("#{$base_url}/category/edit.castle?id=#{id}")\r
45                         \r
46                         assert_no_exception(ie)\r
48                         ie.text_field(:id, "category_name").set(name)\r
49                         \r
50                         ie.button(:id, 'updatebutton').click\r
52                         assert_no_exception(ie)\r
53                         \r
54                         assert_equal(name, ie.span(:id, 'name').text, 'Edit: name was not set')\r
55                         \r
56                 end\r
57                 \r
58                 def delete(ie, id)\r
60                         ie.goto("#{$base_url}/category/removeconfirm.castle?id=#{id}")\r
61                         \r
62                         assert_valid_remove_confirmation(ie, id)\r
64                         ie.button(:id, 'button').click\r
66                         assert_removed(ie)\r
67                         \r
68                 end\r
70         end\r
72 end\r