autoforme 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/basic_spec.rb CHANGED
@@ -12,52 +12,58 @@ describe AutoForme do
12
12
  it "should have basic functionality working" do
13
13
  app_setup(Artist)
14
14
  visit("/Artist/new")
15
- page.title.should == 'Artist - New'
15
+ page.title.must_equal 'Artist - New'
16
16
  fill_in 'Name', :with=>'TestArtistNew'
17
17
  click_button 'Create'
18
- page.html.should =~ /Created Artist/
19
- page.current_path.should == '/Artist/new'
18
+ page.html.must_match /Created Artist/
19
+ page.current_path.must_equal '/Artist/new'
20
20
 
21
21
  click_link 'Show'
22
- page.title.should == 'Artist - Show'
22
+ page.title.must_equal 'Artist - Show'
23
23
  select 'TestArtistNew'
24
24
  click_button 'Show'
25
- page.html.should =~ /Name.+TestArtistNew/m
25
+ page.html.must_match /Name.+TestArtistNew/m
26
26
 
27
27
  click_link 'Edit'
28
- page.title.should == 'Artist - Edit'
28
+ page.title.must_equal 'Artist - Edit'
29
29
  select 'TestArtistNew'
30
30
  click_button 'Edit'
31
31
  fill_in 'Name', :with=>'TestArtistUpdate'
32
32
  click_button 'Update'
33
- page.html.should =~ /Updated Artist/
34
- page.html.should =~ /Name.+TestArtistUpdate/m
35
- page.current_path.should =~ %r{/Artist/edit/\d+}
33
+ page.html.must_match /Updated Artist/
34
+ page.html.must_match /Name.+TestArtistUpdate/m
35
+ page.current_path.must_match %r{/Artist/edit/\d+}
36
36
 
37
37
  click_link 'Search'
38
- page.title.should == 'Artist - Search'
38
+ page.title.must_equal 'Artist - Search'
39
39
  fill_in 'Name', :with=>'Upd'
40
40
  click_button 'Search'
41
- page.all('th').map{|s| s.text}.should == ['Name', 'Show', 'Edit', 'Delete']
42
- page.all('td').map{|s| s.text}.should == ["TestArtistUpdate", "Show", "Edit", "Delete"]
41
+ page.all('th').map{|s| s.text}.must_equal ['Name', 'Show', 'Edit', 'Delete']
42
+ page.all('td').map{|s| s.text}.must_equal ["TestArtistUpdate", "Show", "Edit", "Delete"]
43
+ click_link 'CSV Format'
44
+ page.body.must_equal "Name\nTestArtistUpdate\n"
43
45
 
46
+ visit("/Artist/browse")
44
47
  click_link 'Search'
45
48
  fill_in 'Name', :with=>'Foo'
46
49
  click_button 'Search'
47
- page.all('td').map{|s| s.text}.should == []
50
+ page.all('td').map{|s| s.text}.must_equal []
48
51
 
49
52
  click_link 'Artist'
50
- page.title.should == 'Artist - Browse'
51
- page.all('td').map{|s| s.text}.should == ["TestArtistUpdate", "Show", "Edit", "Delete"]
53
+ page.title.must_equal 'Artist - Browse'
54
+ page.all('td').map{|s| s.text}.must_equal ["TestArtistUpdate", "Show", "Edit", "Delete"]
55
+ click_link 'CSV Format'
56
+ page.body.must_equal "Name\nTestArtistUpdate\n"
52
57
 
58
+ visit("/Artist/browse")
53
59
  page.all('td').last.find('a').click
54
60
  click_button 'Delete'
55
- page.title.should == 'Artist - Delete'
56
- page.html.should =~ /Deleted Artist/
57
- page.current_path.should == '/Artist/delete'
61
+ page.title.must_equal 'Artist - Delete'
62
+ page.html.must_match /Deleted Artist/
63
+ page.current_path.must_equal '/Artist/delete'
58
64
 
59
65
  click_link 'Artist'
60
- page.all('td').map{|s| s.text}.should == []
66
+ page.all('td').map{|s| s.text}.must_equal []
61
67
  end
62
68
 
63
69
  it "should have basic functionality working in a subdirectory" do
@@ -65,44 +71,44 @@ describe AutoForme do
65
71
  visit("/prefix/Artist/new")
66
72
  fill_in 'Name', :with=>'TestArtistNew'
67
73
  click_button 'Create'
68
- page.html.should =~ /Created Artist/
69
- page.current_path.should == '/prefix/Artist/new'
74
+ page.html.must_match /Created Artist/
75
+ page.current_path.must_equal '/prefix/Artist/new'
70
76
 
71
77
  click_link 'Show'
72
78
  select 'TestArtistNew'
73
79
  click_button 'Show'
74
- page.html.should =~ /Name.+TestArtistNew/m
80
+ page.html.must_match /Name.+TestArtistNew/m
75
81
 
76
82
  click_link 'Edit'
77
83
  select 'TestArtistNew'
78
84
  click_button 'Edit'
79
85
  fill_in 'Name', :with=>'TestArtistUpdate'
80
86
  click_button 'Update'
81
- page.html.should =~ /Updated Artist/
82
- page.html.should =~ /Name.+TestArtistUpdate/m
83
- page.current_path.should =~ %r{/prefix/Artist/edit/\d+}
87
+ page.html.must_match /Updated Artist/
88
+ page.html.must_match /Name.+TestArtistUpdate/m
89
+ page.current_path.must_match %r{/prefix/Artist/edit/\d+}
84
90
 
85
91
  click_link 'Search'
86
92
  fill_in 'Name', :with=>'Upd'
87
93
  click_button 'Search'
88
- page.all('th').map{|s| s.text}.should == ['Name', 'Show', 'Edit', 'Delete']
89
- page.all('td').map{|s| s.text}.should == ["TestArtistUpdate", "Show", "Edit", "Delete"]
94
+ page.all('th').map{|s| s.text}.must_equal ['Name', 'Show', 'Edit', 'Delete']
95
+ page.all('td').map{|s| s.text}.must_equal ["TestArtistUpdate", "Show", "Edit", "Delete"]
90
96
 
91
97
  click_link 'Search'
92
98
  fill_in 'Name', :with=>'Foo'
93
99
  click_button 'Search'
94
- page.all('td').map{|s| s.text}.should == []
100
+ page.all('td').map{|s| s.text}.must_equal []
95
101
 
96
102
  click_link 'Artist'
97
- page.all('td').map{|s| s.text}.should == ["TestArtistUpdate", "Show", "Edit", "Delete"]
103
+ page.all('td').map{|s| s.text}.must_equal ["TestArtistUpdate", "Show", "Edit", "Delete"]
98
104
 
99
105
  page.all('td').last.find('a').click
100
106
  click_button 'Delete'
101
- page.html.should =~ /Deleted Artist/
102
- page.current_path.should == '/prefix/Artist/delete'
107
+ page.html.must_match /Deleted Artist/
108
+ page.current_path.must_equal '/prefix/Artist/delete'
103
109
 
104
110
  click_link 'Artist'
105
- page.all('td').map{|s| s.text}.should == []
111
+ page.all('td').map{|s| s.text}.must_equal []
106
112
  end
107
113
 
108
114
  it "should have delete button on edit page" do
@@ -115,9 +121,9 @@ describe AutoForme do
115
121
  select 'TestArtistNew'
116
122
  click_button 'Edit'
117
123
  click_button 'Delete'
118
- Artist.count.should == 1
124
+ Artist.count.must_equal 1
119
125
  click_button 'Delete'
120
- Artist.count.should == 0
126
+ Artist.count.must_equal 0
121
127
  end
122
128
 
123
129
  it "should support custom headers and footers" do
@@ -126,7 +132,7 @@ describe AutoForme do
126
132
  page_footer "<a href='/Artist/edit'>E</a>"
127
133
  end
128
134
  visit("/Artist/browse")
129
- page.html.should_not =~ /search/
135
+ page.html.wont_match /search/
130
136
  click_link 'N'
131
137
  fill_in 'Name', :with=>'TestArtistNew'
132
138
  click_button 'Create'
@@ -151,14 +157,14 @@ describe AutoForme do
151
157
  visit("/Artist/new")
152
158
  fill_in 'Name', :with=>'TestArtistNew'
153
159
  click_button 'Create'
154
- page.current_path.should =~ %r{/Artist/edit/\d}
160
+ page.current_path.must_match %r{/Artist/edit/\d}
155
161
  click_button 'Update'
156
- page.current_path.should =~ %r{/Artist/show/\d}
162
+ page.current_path.must_match %r{/Artist/show/\d}
157
163
  click_link 'Delete'
158
164
  select 'TestArtistNew'
159
165
  click_button 'Delete'
160
166
  click_button 'Delete'
161
- page.current_path.should == "/Artist/new"
167
+ page.current_path.must_equal "/Artist/new"
162
168
  end
163
169
 
164
170
  it "should support custom form options and attributes" do
@@ -167,9 +173,9 @@ describe AutoForme do
167
173
  form_options :input_defaults=>{'text'=>{:class=>'barfoo'}}
168
174
  end
169
175
  visit("/Artist/new")
170
- find('form')[:class].should == 'foobar forme artist'
171
- find('form')[:action].should == '/create_artist'
172
- find('form input#artist_name')[:class].should == 'barfoo'
176
+ find('form')[:class].must_equal 'foobar forme artist'
177
+ find('form')[:action].must_equal '/create_artist'
178
+ find('form input#artist_name')[:class].must_equal 'barfoo'
173
179
  end
174
180
 
175
181
  it "should support support specifying column options per type" do
@@ -180,25 +186,25 @@ describe AutoForme do
180
186
  visit("/Artist/new")
181
187
  fill_in 'New Artist Name', :with=>'TestArtistNew'
182
188
  click_button 'Create'
183
- page.current_path.should == '/Artist/new'
189
+ page.current_path.must_equal '/Artist/new'
184
190
 
185
191
  click_link 'Show'
186
192
  select 'TestArtistNew'
187
193
  click_button 'Show'
188
- page.html.should =~ /Show Artist Name.+TestArtistNew/m
194
+ page.html.must_match /Show Artist Name.+TestArtistNew/m
189
195
  click_button 'Edit'
190
196
  fill_in 'Edit Artist Name', :with=>'TestArtistUpdate'
191
197
  click_button 'Update'
192
- page.html.should =~ /Edit Artist Name.+TestArtistUpdate/m
193
- page.current_path.should =~ %r{/Artist/edit/\d+}
198
+ page.html.must_match /Edit Artist Name.+TestArtistUpdate/m
199
+ page.current_path.must_match %r{/Artist/edit/\d+}
194
200
 
195
201
  click_link 'Search'
196
202
  fill_in 'Search_form Artist Name', :with=>'Upd'
197
203
  click_button 'Search'
198
- page.all('th').map{|s| s.text}.should == ["Search Artist Name", "Show", "Edit", "Delete"]
204
+ page.all('th').map{|s| s.text}.must_equal ["Search Artist Name", "Show", "Edit", "Delete"]
199
205
 
200
206
  click_link 'Artist'
201
- page.all('th').map{|s| s.text}.should == ["Browse Artist Name", "Show", "Edit", "Delete"]
207
+ page.all('th').map{|s| s.text}.must_equal ["Browse Artist Name", "Show", "Edit", "Delete"]
202
208
  end
203
209
 
204
210
  it "should support specifying display names per type" do
@@ -218,18 +224,18 @@ describe AutoForme do
218
224
  visit("/Artist/show")
219
225
  select 'stArtistN'
220
226
  click_button 'Show'
221
- page.html.should =~ /Name.+TestArtistNew/m
227
+ page.html.must_match /Name.+TestArtistNew/m
222
228
 
223
229
  click_link 'Edit'
224
230
  select 'estArtistNe'
225
231
  click_button 'Edit'
226
- page.html.should =~ /Name.+TestArtistNew/m
232
+ page.html.must_match /Name.+TestArtistNew/m
227
233
 
228
234
  click_link 'Delete'
229
235
  select 'Artist'
230
236
  click_button 'Delete'
231
237
  click_button 'Delete'
232
- Artist.count.should == 0
238
+ Artist.count.must_equal 0
233
239
  end
234
240
 
235
241
  it "should support create, update, delete hooks" do
@@ -258,20 +264,20 @@ describe AutoForme do
258
264
  end
259
265
  visit("/Artist/new")
260
266
  click_button 'Create'
261
- a.should == [:new, :create, -1, 'create', 1, :new]
267
+ a.must_equal [:new, :create, -1, 'create', 1, :new]
262
268
  a.clear
263
269
 
264
270
  click_link 'Edit'
265
271
  select 'weNtsitrAtseT'
266
272
  click_button 'Edit'
267
- page.html.should =~ /weNtsitrAtseT21/
273
+ page.html.must_match /weNtsitrAtseT21/
268
274
  click_button 'Update'
269
- a.should == [:edit, :edit, :update, -2, 'update', 2, :edit]
275
+ a.must_equal [:edit, :edit, :update, -2, 'update', 2, :edit]
270
276
  a.clear
271
277
 
272
278
  click_link 'Show'
273
- page.current_path.should == '/Artist/browse'
274
- a.should == [:show, :browse]
279
+ page.current_path.must_equal '/Artist/browse'
280
+ a.must_equal [:show, :browse]
275
281
  a.clear
276
282
 
277
283
  click_link 'Delete', :match=>:first
@@ -279,13 +285,13 @@ describe AutoForme do
279
285
  select 'WENTSITRATSET21'
280
286
  click_button 'Delete'
281
287
  click_button 'Delete'
282
- a.should == [:delete, :delete, :destroy, -3, 'destroy', 3, :delete]
288
+ a.must_equal [:delete, :delete, :destroy, -3, 'destroy', 3, :delete]
283
289
  a.clear
284
290
 
285
291
  select 'A'
286
292
  click_button 'Delete'
287
- proc{click_button 'Delete'}.should raise_error
288
- a.should == [:delete, :destroy, -3]
293
+ proc{click_button 'Delete'}.must_raise RuntimeError
294
+ a.must_equal [:delete, :destroy, -3]
289
295
  end
290
296
 
291
297
  it "should support specifying table class for data tables per type" do
@@ -293,10 +299,10 @@ describe AutoForme do
293
299
  table_class{|type, req| type == :browse ? 'foo' : 'bar'}
294
300
  end
295
301
  visit("/Artist/browse")
296
- first('table')['class'].should == 'foo'
302
+ first('table')['class'].must_equal 'foo'
297
303
  click_link 'Search'
298
304
  click_button 'Search'
299
- first('table')['class'].should == 'bar'
305
+ first('table')['class'].must_equal 'bar'
300
306
  end
301
307
 
302
308
  it "should support specifying numbers of rows per page per type" do
@@ -305,28 +311,28 @@ describe AutoForme do
305
311
  end
306
312
  5.times{|i| Artist.create(:name=>i.to_s)}
307
313
  visit("/Artist/browse")
308
- first('li.disabled a').text.should == 'Previous'
309
- page.all('tr td:first-child').map{|s| s.text}.should == %w'0 1'
314
+ first('li.disabled a').text.must_equal 'Previous'
315
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'0 1'
310
316
  click_link 'Next'
311
- page.all('tr td:first-child').map{|s| s.text}.should == %w'2 3'
317
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'2 3'
312
318
  click_link 'Next'
313
- page.all('tr td:first-child').map{|s| s.text}.should == %w'4'
314
- first('li.disabled a').text.should == 'Next'
319
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'4'
320
+ first('li.disabled a').text.must_equal 'Next'
315
321
  click_link 'Previous'
316
- page.all('tr td:first-child').map{|s| s.text}.should == %w'2 3'
322
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'2 3'
317
323
  click_link 'Previous'
318
- page.all('tr td:first-child').map{|s| s.text}.should == %w'0 1'
319
- first('li.disabled a').text.should == 'Previous'
324
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'0 1'
325
+ first('li.disabled a').text.must_equal 'Previous'
320
326
 
321
327
  click_link 'Search'
322
328
  click_button 'Search'
323
- page.all('tr td:first-child').map{|s| s.text}.should == %w'0 1 2'
329
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'0 1 2'
324
330
  click_link 'Next'
325
- page.all('tr td:first-child').map{|s| s.text}.should == %w'3 4'
326
- first('li.disabled a').text.should == 'Next'
331
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'3 4'
332
+ first('li.disabled a').text.must_equal 'Next'
327
333
  click_link 'Previous'
328
- page.all('tr td:first-child').map{|s| s.text}.should == %w'0 1 2'
329
- first('li.disabled a').text.should == 'Previous'
334
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'0 1 2'
335
+ first('li.disabled a').text.must_equal 'Previous'
330
336
  end
331
337
 
332
338
  it "should support specifying supported actions" do
@@ -336,25 +342,25 @@ describe AutoForme do
336
342
  visit("/Artist/new")
337
343
  fill_in 'Name', :with=>'TestArtistNew'
338
344
  click_button 'Create'
339
- page.current_path.should == '/Artist/new'
340
- page.html.should_not =~ /Show/
341
- page.html.should_not =~ /Delete/
345
+ page.current_path.must_equal '/Artist/new'
346
+ page.html.wont_match /Show/
347
+ page.html.wont_match /Delete/
342
348
 
343
349
  click_link 'Edit'
344
350
  select 'TestArtistNew'
345
351
  click_button 'Edit'
346
352
  fill_in 'Name', :with=>'TestArtistUpdate'
347
353
  click_button 'Update'
348
- page.html.should =~ /Name.+TestArtistUpdate/m
349
- page.current_path.should =~ %r{/Artist/edit/\d+}
354
+ page.html.must_match /Name.+TestArtistUpdate/m
355
+ page.current_path.must_match %r{/Artist/edit/\d+}
350
356
 
351
357
  click_link 'Search'
352
358
  fill_in 'Name', :with=>'Upd'
353
359
  click_button 'Search'
354
- page.all('td').map{|s| s.text}.should == ["TestArtistUpdate", "Edit"]
360
+ page.all('td').map{|s| s.text}.must_equal ["TestArtistUpdate", "Edit"]
355
361
 
356
362
  click_link 'Artist'
357
- page.all('td').map{|s| s.text}.should == ["TestArtistUpdate", "Edit"]
363
+ page.all('td').map{|s| s.text}.must_equal ["TestArtistUpdate", "Edit"]
358
364
  end
359
365
 
360
366
  it "should have basic functionality working" do
@@ -365,22 +371,22 @@ describe AutoForme do
365
371
  visit("/BarArtist/new")
366
372
  fill_in 'Name', :with=>'TestArtistNew'
367
373
  click_button 'Create'
368
- page.html.should =~ /Created FooArtist/
369
- page.current_path.should == '/BarArtist/new'
374
+ page.html.must_match /Created FooArtist/
375
+ page.current_path.must_equal '/BarArtist/new'
370
376
 
371
377
  click_link 'Edit'
372
378
  select 'TestArtistNew'
373
379
  click_button 'Edit'
374
380
  fill_in 'Name', :with=>'TestArtistUpdate'
375
381
  click_button 'Update'
376
- page.html.should =~ /Updated FooArtist/
382
+ page.html.must_match /Updated FooArtist/
377
383
 
378
384
  click_link 'FooArtist'
379
- page.all('td').map{|s| s.text}.should == ["TestArtistUpdate", "Show", "Edit", "Delete"]
385
+ page.all('td').map{|s| s.text}.must_equal ["TestArtistUpdate", "Show", "Edit", "Delete"]
380
386
 
381
387
  page.all('td').last.find('a').click
382
388
  click_button 'Delete'
383
- page.html.should =~ /Deleted FooArtist/
389
+ page.html.must_match /Deleted FooArtist/
384
390
  end
385
391
 
386
392
  it "should use text boxes on list page when autocompleting is enabled" do
@@ -392,7 +398,7 @@ describe AutoForme do
392
398
  visit('/Artist/show')
393
399
  fill_in 'Artist', :with=>a.id.to_s
394
400
  click_button 'Show'
395
- page.html.should =~ /Name.+TestArtistNew/m
401
+ page.html.must_match /Name.+TestArtistNew/m
396
402
 
397
403
  click_link 'Edit'
398
404
  fill_in 'Artist', :with=>a.id.to_s
@@ -403,7 +409,7 @@ describe AutoForme do
403
409
  fill_in 'Artist', :with=>a.id.to_s
404
410
  click_button 'Delete'
405
411
  click_button 'Delete'
406
- Artist.count.should == 0
412
+ Artist.count.must_equal 0
407
413
  end
408
414
  end
409
415
 
@@ -434,18 +440,18 @@ describe AutoForme do
434
440
  fill_in 'N2', :with=>'V2'
435
441
  fill_in 'N3', :with=>'V3'
436
442
  fill_in 'N4', :with=>'V4'
437
- page.body.should_not =~ /<label>N5/i
443
+ page.body.wont_match /<label>N5/i
438
444
  click_button 'Create'
439
445
 
440
446
  click_link 'Show'
441
447
  select 'V0'
442
448
  click_button 'Show'
443
- page.body.should =~ /[VN]0/i
444
- page.body.should =~ /[VN]1/i
445
- page.body.should =~ /[VN]2/i
446
- page.body.should_not =~ /[VN]3/i
447
- page.body.should =~ /[VN]4/i
448
- page.body.should =~ /N5/i
449
+ page.body.must_match /[VN]0/i
450
+ page.body.must_match /[VN]1/i
451
+ page.body.must_match /[VN]2/i
452
+ page.body.wont_match /[VN]3/i
453
+ page.body.must_match /[VN]4/i
454
+ page.body.must_match /N5/i
449
455
 
450
456
  click_link 'Edit'
451
457
  select 'V0'
@@ -454,22 +460,26 @@ describe AutoForme do
454
460
  fill_in 'N1', :with=>'Q1'
455
461
  fill_in 'N2', :with=>'Q2'
456
462
  fill_in 'N3', :with=>'Q3'
457
- page.body.should_not =~ /<label>N4/i
463
+ page.body.wont_match /<label>N4/i
458
464
  fill_in 'N5', :with=>'Q5'
459
465
  click_button 'Update'
460
466
 
461
467
  click_link 'Search'
462
468
  fill_in 'N0', :with=>'Q0'
463
- page.body.should_not =~ /<label>N1/i
469
+ page.body.wont_match /<label>N1/i
464
470
  fill_in 'N2', :with=>'Q2'
465
471
  fill_in 'N3', :with=>'Q3'
466
472
  fill_in 'N4', :with=>'V4'
467
473
  fill_in 'N5', :with=>'Q5'
468
474
  click_button 'Search'
469
- page.all('td').map{|s| s.text}.should == ["Q1", "Q2", "Q3", "V4", "Q5", "Show", "Edit", "Delete"]
470
-
471
- click_link 'Artist'
472
- page.all('td').map{|s| s.text}.should == ["Q0", "Q1", "Q3", "V4", "Q5", "Show", "Edit", "Delete"]
475
+ page.all('td').map{|s| s.text}.must_equal ["Q1", "Q2", "Q3", "V4", "Q5", "Show", "Edit", "Delete"]
476
+ click_link 'CSV Format'
477
+ page.body.must_equal "N1,N2,N3,N4,N5\nQ1,Q2,Q3,V4,Q5\n"
478
+
479
+ visit '/Artist/browse'
480
+ page.all('td').map{|s| s.text}.must_equal ["Q0", "Q1", "Q3", "V4", "Q5", "Show", "Edit", "Delete"]
481
+ click_link 'CSV Format'
482
+ page.body.must_equal "N0,N1,N3,N4,N5\nQ0,Q1,Q3,V4,Q5\n"
473
483
  end
474
484
 
475
485
  it "should support specifying order per type" do
@@ -483,20 +493,20 @@ describe AutoForme do
483
493
  Artist.create(:n0=>'0', :n1=>'4', :n2=>'1', :n3=>'5', :n4=>'3')
484
494
 
485
495
  visit("/Artist/show")
486
- page.all('option').map{|s| s.text}.should == ['', '2', '1', '0']
496
+ page.all('option').map{|s| s.text}.must_equal ['', '2', '1', '0']
487
497
 
488
498
  click_link 'Edit'
489
- page.all('option').map{|s| s.text}.should == ['', '0', '1', '2']
499
+ page.all('option').map{|s| s.text}.must_equal ['', '0', '1', '2']
490
500
 
491
501
  click_link 'Delete'
492
- page.all('option').map{|s| s.text}.should == ['', '2', '0', '1']
502
+ page.all('option').map{|s| s.text}.must_equal ['', '2', '0', '1']
493
503
 
494
504
  click_link 'Search'
495
505
  click_button 'Search'
496
- page.all('tr td:first-child').map{|s| s.text}.should == ['0', '2', '1']
506
+ page.all('tr td:first-child').map{|s| s.text}.must_equal ['0', '2', '1']
497
507
 
498
508
  click_link 'Artist'
499
- page.all('tr td:first-child').map{|s| s.text}.should == ['1', '2', '0']
509
+ page.all('tr td:first-child').map{|s| s.text}.must_equal ['1', '2', '0']
500
510
  end
501
511
 
502
512
  it "should support specifying filter per type" do
@@ -522,16 +532,16 @@ describe AutoForme do
522
532
  Artist.create(:n0=>'0', :n1=>'4', :n2=>'1', :n3=>'5', :n4=>'3')
523
533
 
524
534
  visit("/Artist/show")
525
- page.all('option').map{|s| s.text}.should == ['', '0']
535
+ page.all('option').map{|s| s.text}.must_equal ['', '0']
526
536
 
527
537
  click_link 'Edit'
528
- page.all('option').map{|s| s.text}.should == ['', '2']
538
+ page.all('option').map{|s| s.text}.must_equal ['', '2']
529
539
  select '2'
530
540
  click_button 'Edit'
531
541
  click_button 'Update'
532
542
 
533
543
  click_link 'Delete'
534
- page.all('option').map{|s| s.text}.should == ['', '1']
544
+ page.all('option').map{|s| s.text}.must_equal ['', '1']
535
545
  select '1'
536
546
  click_button 'Delete'
537
547
  click_button 'Delete'
@@ -539,10 +549,10 @@ describe AutoForme do
539
549
 
540
550
  click_link 'Search'
541
551
  click_button 'Search'
542
- page.all('tr td:first-child').map{|s| s.text}.should == %w'1'
552
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'1'
543
553
 
544
554
  click_link 'Artist'
545
- page.all('tr td:first-child').map{|s| s.text}.should == %w'1'
555
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'1'
546
556
  end
547
557
 
548
558
  it "should support specifying filter per type using request params" do
@@ -569,19 +579,19 @@ describe AutoForme do
569
579
  Artist.create(:n0=>'0', :n1=>'4', :n2=>'1', :n3=>'5', :n4=>'3')
570
580
 
571
581
  visit("/Artist/show?f=3")
572
- page.all('option').map{|s| s.text}.should == ['', '0']
582
+ page.all('option').map{|s| s.text}.must_equal ['', '0']
573
583
 
574
584
  visit("/Artist/edit?f=1")
575
- page.all('option').map{|s| s.text}.should == ['', '2']
585
+ page.all('option').map{|s| s.text}.must_equal ['', '2']
576
586
 
577
587
  visit("/Artist/delete?f=2")
578
- page.all('option').map{|s| s.text}.should == ['', '1']
588
+ page.all('option').map{|s| s.text}.must_equal ['', '1']
579
589
 
580
590
  visit("/Artist/search/1?f=4")
581
- page.all('tr td:first-child').map{|s| s.text}.should == %w'1'
591
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'1'
582
592
 
583
593
  visit("/Artist/browse?f=6")
584
- page.all('tr td:first-child').map{|s| s.text}.should == %w'1'
594
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'1'
585
595
  end
586
596
 
587
597
  it "should support specifying filter per type using request session" do
@@ -596,16 +606,16 @@ describe AutoForme do
596
606
  visit '/session/set?n1=2'
597
607
 
598
608
  visit("/Artist/show")
599
- page.all('option').map{|s| s.text}.should == ['', '2', '1']
609
+ page.all('option').map{|s| s.text}.must_equal ['', '2', '1']
600
610
 
601
611
  click_link 'Edit'
602
- page.all('option').map{|s| s.text}.should == ['', '2', '1']
612
+ page.all('option').map{|s| s.text}.must_equal ['', '2', '1']
603
613
  select '2'
604
614
  click_button 'Edit'
605
615
  click_button 'Update'
606
616
 
607
617
  click_link 'Delete'
608
- page.all('option').map{|s| s.text}.should == ['', '2', '1']
618
+ page.all('option').map{|s| s.text}.must_equal ['', '2', '1']
609
619
  select '1'
610
620
  click_button 'Delete'
611
621
  click_button 'Delete'
@@ -613,10 +623,10 @@ describe AutoForme do
613
623
 
614
624
  click_link 'Search'
615
625
  click_button 'Search'
616
- page.all('tr td:first-child').map{|s| s.text}.should == %w'2 1'
626
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'2 1'
617
627
 
618
628
  click_link 'Artist'
619
- page.all('tr td:first-child').map{|s| s.text}.should == %w'2 1'
629
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'2 1'
620
630
  end
621
631
 
622
632
  it "should support session_value for restricting access by matching session variable to column value" do
@@ -638,23 +648,23 @@ describe AutoForme do
638
648
  click_button 'Create'
639
649
 
640
650
  click_link 'Show'
641
- page.all('option').map{|s| s.text}.should == ['', '2', '1']
651
+ page.all('option').map{|s| s.text}.must_equal ['', '2', '1']
642
652
 
643
653
  click_link 'Edit'
644
- page.all('option').map{|s| s.text}.should == ['', '2', '1']
654
+ page.all('option').map{|s| s.text}.must_equal ['', '2', '1']
645
655
  select '2'
646
656
  click_button 'Edit'
647
657
  click_button 'Update'
648
658
 
649
659
  click_link 'Search'
650
660
  click_button 'Search'
651
- page.all('tr td:first-child').map{|s| s.text}.should == %w'2 1'
661
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'2 1'
652
662
 
653
663
  click_link 'Artist'
654
- page.all('tr td:first-child').map{|s| s.text}.should == %w'2 1'
664
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'2 1'
655
665
 
656
666
  click_link 'Delete', :match=>:first
657
- page.all('option').map{|s| s.text}.should == ['', '2', '1']
667
+ page.all('option').map{|s| s.text}.must_equal ['', '2', '1']
658
668
  select '1'
659
669
  click_button 'Delete'
660
670
  end
@@ -672,14 +682,14 @@ describe AutoForme do
672
682
  it "should display decimals in float format in tables" do
673
683
  app_setup(Artist)
674
684
  visit("/Artist/new")
675
- page.title.should == 'Artist - New'
685
+ page.title.must_equal 'Artist - New'
676
686
  fill_in 'Num', :with=>'1.01'
677
687
  click_button 'Create'
678
688
  click_link 'Artist'
679
- page.all('tr td:first-child').map{|s| s.text}.should == %w'1.01'
689
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'1.01'
680
690
  click_link 'Search'
681
691
  click_button 'Search'
682
- page.all('tr td:first-child').map{|s| s.text}.should == %w'1.01'
692
+ page.all('tr td:first-child').map{|s| s.text}.must_equal %w'1.01'
683
693
  end
684
694
  end
685
695
 
@@ -708,50 +718,50 @@ describe AutoForme do
708
718
  end
709
719
  end
710
720
  visit("/Artist/new")
711
- page.title.should == 'Artist - New'
721
+ page.title.must_equal 'Artist - New'
712
722
  fill_in 'Name', :with=>'TestArtistNew'
713
723
  click_button 'Create'
714
- page.html.should =~ /Created Artist/
715
- page.current_path.should == '/Artist/new'
724
+ page.html.must_match /Created Artist/
725
+ page.current_path.must_equal '/Artist/new'
716
726
 
717
727
  click_link 'Show'
718
- page.title.should == 'Artist - Show'
728
+ page.title.must_equal 'Artist - Show'
719
729
  select '[-TestArtistNew-]'
720
730
  click_button 'Show'
721
- page.html.should =~ /Name.+-TestArtistNew-/m
731
+ page.html.must_match /Name.+-TestArtistNew-/m
722
732
 
723
733
  click_link 'Edit'
724
- page.title.should == 'Artist - Edit'
734
+ page.title.must_equal 'Artist - Edit'
725
735
  select '[-TestArtistNew-]'
726
736
  click_button 'Edit'
727
737
  fill_in 'Name', :with=>'TestArtistUpdate'
728
738
  click_button 'Update'
729
- page.html.should =~ /Updated Artist/
730
- page.html.should =~ /Name.+-TestArtistUpdate-/m
731
- page.current_path.should =~ %r{/Artist/edit/\d+}
739
+ page.html.must_match /Updated Artist/
740
+ page.html.must_match /Name.+-TestArtistUpdate-/m
741
+ page.current_path.must_match %r{/Artist/edit/\d+}
732
742
 
733
743
  click_link 'Search'
734
- page.title.should == 'Artist - Search'
744
+ page.title.must_equal 'Artist - Search'
735
745
  fill_in 'Name', :with=>'Upd'
736
746
  click_button 'Search'
737
- page.all('th').map{|s| s.text}.should == ['Name', 'Show', 'Edit', 'Delete']
738
- page.all('td').map{|s| s.text}.should == ["-TestArtistUpdate-", "Show", "Edit", "Delete"]
747
+ page.all('th').map{|s| s.text}.must_equal ['Name', 'Show', 'Edit', 'Delete']
748
+ page.all('td').map{|s| s.text}.must_equal ["-TestArtistUpdate-", "Show", "Edit", "Delete"]
739
749
 
740
750
  click_link 'Search'
741
751
  fill_in 'Name', :with=>'Foo'
742
752
  click_button 'Search'
743
- page.all('td').map{|s| s.text}.should == []
753
+ page.all('td').map{|s| s.text}.must_equal []
744
754
 
745
755
  click_link 'Artist'
746
- page.title.should == 'Artist - Browse'
747
- page.all('td').map{|s| s.text}.should == ["-TestArtistUpdate-", "Show", "Edit", "Delete"]
756
+ page.title.must_equal 'Artist - Browse'
757
+ page.all('td').map{|s| s.text}.must_equal ["-TestArtistUpdate-", "Show", "Edit", "Delete"]
748
758
 
749
759
  page.all('td').last.find('a').click
750
760
  click_button 'Delete'
751
- page.html.should =~ /Deleted Artist/
752
- page.current_path.should == '/Artist/delete'
761
+ page.html.must_match /Deleted Artist/
762
+ page.current_path.must_equal '/Artist/delete'
753
763
 
754
764
  click_link 'Artist'
755
- page.all('td').map{|s| s.text}.should == []
765
+ page.all('td').map{|s| s.text}.must_equal []
756
766
  end
757
767
  end