autoforme 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/spec/unit_spec.rb CHANGED
@@ -14,297 +14,297 @@ describe AutoForme do
14
14
  end
15
15
 
16
16
  it "should handle table class lookup" do
17
- model.table_class_for(:browse, nil).should == 'table table-bordered table-striped'
17
+ model.table_class_for(:browse, nil).must_equal 'table table-bordered table-striped'
18
18
  framework.table_class 'foo'
19
- model.table_class_for(:browse, nil).should == 'foo'
19
+ model.table_class_for(:browse, nil).must_equal 'foo'
20
20
  framework.table_class{|mod, type, req| "#{mod.name} #{type} #{req}"}
21
- model.table_class_for(:browse, 1).should == 'Artist browse 1'
21
+ model.table_class_for(:browse, 1).must_equal 'Artist browse 1'
22
22
  model.table_class 'baz'
23
- model.table_class_for(:browse, nil).should == 'baz'
23
+ model.table_class_for(:browse, nil).must_equal 'baz'
24
24
  model.table_class{|type, req| "#{type} #{req}"}
25
- model.table_class_for(:browse, :foo).should == 'browse foo'
25
+ model.table_class_for(:browse, :foo).must_equal 'browse foo'
26
26
  end
27
27
 
28
28
  it "should handle per page lookup" do
29
- model.limit_for(:browse, nil).should == 25
29
+ model.limit_for(:browse, nil).must_equal 25
30
30
  framework.per_page 1
31
- model.limit_for(:browse, nil).should == 1
31
+ model.limit_for(:browse, nil).must_equal 1
32
32
  framework.per_page{|mod, type, req| mod.name.length + type.to_s.length + req}
33
- model.limit_for(:browse, 3).should == 15
33
+ model.limit_for(:browse, 3).must_equal 15
34
34
  model.per_page 3
35
- model.limit_for(:browse, nil).should == 3
35
+ model.limit_for(:browse, nil).must_equal 3
36
36
  model.per_page{|type, req| type.to_s.length + req}
37
- model.limit_for(:browse, -1).should == 5
37
+ model.limit_for(:browse, -1).must_equal 5
38
38
  end
39
39
 
40
40
  it "should handle columns lookup" do
41
- model.columns_for(:browse, nil).should == [:name]
41
+ model.columns_for(:browse, nil).must_equal [:name]
42
42
  framework.columns{|mod, type, req| [mod.name.to_sym, type, req]}
43
- model.columns_for(:browse, :foo).should == [:Artist, :browse, :foo]
43
+ model.columns_for(:browse, :foo).must_equal [:Artist, :browse, :foo]
44
44
  model.columns [:foo]
45
- model.columns_for(:browse, nil).should == [:foo]
45
+ model.columns_for(:browse, nil).must_equal [:foo]
46
46
  model.columns{|type, req| req ? [type] : [:foo]}
47
- model.columns_for(:browse, true).should == [:browse]
48
- model.columns_for(:browse, nil).should == [:foo]
47
+ model.columns_for(:browse, true).must_equal [:browse]
48
+ model.columns_for(:browse, nil).must_equal [:foo]
49
49
  end
50
50
 
51
51
  it "should handle column options lookup" do
52
- model.column_options_for(:show, nil, :foo).should == {:required=>false}
53
- model.column_options_for(:browse, nil, :foo).should == {}
52
+ model.column_options_for(:show, nil, :foo).must_equal(:required=>false)
53
+ model.column_options_for(:browse, nil, :foo).must_equal({})
54
54
  framework.column_options :foo=>{:as=>:textarea}
55
- model.column_options_for(:browse, :bar, :foo).should == {:as=>:textarea}
56
- model.column_options_for(:search_form, nil, :foo).should == {:required=>false}
55
+ model.column_options_for(:browse, :bar, :foo).must_equal(:as=>:textarea)
56
+ model.column_options_for(:search_form, nil, :foo).must_equal(:required=>false)
57
57
  framework.column_options :foo=>proc{|type, req| {:type=>type, :req=>req}}
58
- model.column_options_for(:browse, :bar, :foo).should == {:type=>:browse, :req=>:bar}
58
+ model.column_options_for(:browse, :bar, :foo).must_equal(:type=>:browse, :req=>:bar)
59
59
  framework.column_options{|mod, column, type, req| {mod.name.to_sym=>[type, req, column]}}
60
- model.column_options_for(:browse, :bar, :foo).should == {:Artist=>[:browse, :bar, :foo]}
60
+ model.column_options_for(:browse, :bar, :foo).must_equal(:Artist=>[:browse, :bar, :foo])
61
61
  framework.column_options{|mod, column, type, req| {5=>6}}
62
62
  model.column_options :foo=>{1=>2}
63
- model.column_options_for(:browse, nil, :foo).should == {1=>2, 5=>6}
63
+ model.column_options_for(:browse, nil, :foo).must_equal(1=>2, 5=>6)
64
64
  model.column_options :foo=>proc{|type, req| {:type=>type, :req=>req}}
65
- model.column_options_for(:browse, nil, :foo).should == {:type=>:browse, :req=>nil, 5=>6}
65
+ model.column_options_for(:browse, nil, :foo).must_equal(:type=>:browse, :req=>nil, 5=>6)
66
66
  model.column_options{|col, type, req| {:type=>type, :req=>req, :col=>col}}
67
- model.column_options_for(:browse, nil, :foo).should == {:type=>:browse, :req=>nil, :col=>:foo, 5=>6}
67
+ model.column_options_for(:browse, nil, :foo).must_equal(:type=>:browse, :req=>nil, :col=>:foo, 5=>6)
68
68
  end
69
69
 
70
70
  it "should handle order lookup" do
71
- model.order_for(:browse, nil).should == nil
71
+ model.order_for(:browse, nil).must_equal nil
72
72
  framework.order :bar
73
- model.order_for(:browse, nil).should == :bar
73
+ model.order_for(:browse, nil).must_equal :bar
74
74
  framework.order{|mod, type, req| [mod.name.to_sym, type, req]}
75
- model.order_for(:browse, :foo).should == [:Artist, :browse, :foo]
75
+ model.order_for(:browse, :foo).must_equal [:Artist, :browse, :foo]
76
76
  model.order [:foo]
77
- model.order_for(:browse, nil).should == [:foo]
77
+ model.order_for(:browse, nil).must_equal [:foo]
78
78
  model.order{|type, req| [type, req]}
79
- model.order_for(:browse, :foo).should == [:browse, :foo]
79
+ model.order_for(:browse, :foo).must_equal [:browse, :foo]
80
80
  end
81
81
 
82
82
  it "should handle eager lookup" do
83
- model.eager_for(:browse, nil).should == nil
83
+ model.eager_for(:browse, nil).must_equal nil
84
84
  model.eager [:foo]
85
- model.eager_for(:browse, nil).should == [:foo]
85
+ model.eager_for(:browse, nil).must_equal [:foo]
86
86
  model.eager{|type, req| [type, req]}
87
- model.eager_for(:browse, 1).should == [:browse, 1]
87
+ model.eager_for(:browse, 1).must_equal [:browse, 1]
88
88
  end
89
89
 
90
90
  it "should handle eager_graph lookup" do
91
- model.eager_graph_for(:browse, nil).should == nil
91
+ model.eager_graph_for(:browse, nil).must_equal nil
92
92
  model.eager_graph [:foo]
93
- model.eager_graph_for(:browse, nil).should == [:foo]
93
+ model.eager_graph_for(:browse, nil).must_equal [:foo]
94
94
  model.eager_graph{|type, req| [type, req]}
95
- model.eager_graph_for(:browse, 1).should == [:browse, 1]
95
+ model.eager_graph_for(:browse, 1).must_equal [:browse, 1]
96
96
  end
97
97
 
98
98
  it "should handle filter lookup" do
99
- model.filter_for.should == nil
99
+ model.filter_for.must_equal nil
100
100
  framework.filter{|mod| lambda{|ds, type, req| [ds, mod.name.to_sym, type, req]}}
101
- model.filter_for.call(1, :browse, 2).should == [1, :Artist, :browse, 2]
101
+ model.filter_for.call(1, :browse, 2).must_equal [1, :Artist, :browse, 2]
102
102
  model.filter{|ds, type, req| [ds, type, req]}
103
- model.filter_for.call(1, :browse, 2).should == [1, :browse, 2]
103
+ model.filter_for.call(1, :browse, 2).must_equal [1, :browse, 2]
104
104
  end
105
105
 
106
106
  it "should handle redirect lookup" do
107
- model.redirect_for.should == nil
107
+ model.redirect_for.must_equal nil
108
108
  framework.redirect{|mod| lambda{|obj, type, req| [obj, mod.name.to_sym, type, req]}}
109
- model.redirect_for.call(1, :new, 2).should == [1, :Artist, :new, 2]
109
+ model.redirect_for.call(1, :new, 2).must_equal [1, :Artist, :new, 2]
110
110
  model.redirect{|obj, type, req| [obj, type, req]}
111
- model.redirect_for.call(1, :new, 2).should == [1, :new, 2]
111
+ model.redirect_for.call(1, :new, 2).must_equal [1, :new, 2]
112
112
  end
113
113
 
114
114
  it "should handle display_name lookup" do
115
- model.display_name_for.should == nil
115
+ model.display_name_for.must_equal nil
116
116
  framework.display_name :foo
117
- model.display_name_for.should == :foo
117
+ model.display_name_for.must_equal :foo
118
118
  framework.display_name{|mod| mod.name.to_sym}
119
- model.display_name_for.should == :Artist
119
+ model.display_name_for.must_equal :Artist
120
120
 
121
121
  framework.display_name{|mod| proc{|obj, type, req| "#{obj} #{type} #{req}"}}
122
- model.object_display_name(:show, 1, :foo).should == 'foo show 1'
122
+ model.object_display_name(:show, 1, :foo).must_equal 'foo show 1'
123
123
 
124
124
  model.display_name :foo
125
- model.display_name_for.should == :foo
125
+ model.display_name_for.must_equal :foo
126
126
  model.display_name{|obj| obj.to_s}
127
- model.object_display_name(:show, nil, :foo).should == 'foo'
127
+ model.object_display_name(:show, nil, :foo).must_equal 'foo'
128
128
  model.display_name{|obj, type| "#{obj} #{type}"}
129
- model.object_display_name(:show, nil, :foo).should == 'foo show'
129
+ model.object_display_name(:show, nil, :foo).must_equal 'foo show'
130
130
  model.display_name{|obj, type, req| "#{obj} #{type} #{req}"}
131
- model.object_display_name(:show, 1, :foo).should == 'foo show 1'
131
+ model.object_display_name(:show, 1, :foo).must_equal 'foo show 1'
132
132
  end
133
133
 
134
134
  it "should handle supported_actions lookup" do
135
- model.supported_action?(:new, nil).should == true
136
- model.supported_action?(:edit, nil).should == true
137
- model.supported_action?(:search, nil).should == true
135
+ model.supported_action?(:new, nil).must_equal true
136
+ model.supported_action?(:edit, nil).must_equal true
137
+ model.supported_action?(:search, nil).must_equal true
138
138
  framework.supported_actions [:new, :search]
139
- model.supported_action?(:new, nil).should == true
140
- model.supported_action?(:edit, nil).should == false
141
- model.supported_action?(:search, nil).should == true
139
+ model.supported_action?(:new, nil).must_equal true
140
+ model.supported_action?(:edit, nil).must_equal false
141
+ model.supported_action?(:search, nil).must_equal true
142
142
  framework.supported_actions{|mod, req| req ? [:new] : []}
143
- model.supported_action?(:new, nil).should == false
144
- model.supported_action?(:new, true).should == true
143
+ model.supported_action?(:new, nil).must_equal false
144
+ model.supported_action?(:new, true).must_equal true
145
145
  model.supported_actions [:edit, :search]
146
- model.supported_action?(:new, nil).should == false
147
- model.supported_action?(:edit, nil).should == true
148
- model.supported_action?(:search, nil).should == true
146
+ model.supported_action?(:new, nil).must_equal false
147
+ model.supported_action?(:edit, nil).must_equal true
148
+ model.supported_action?(:search, nil).must_equal true
149
149
  model.supported_actions{|req| req ? [:new] : []}
150
- model.supported_action?(:new, nil).should == false
151
- model.supported_action?(:new, true).should == true
150
+ model.supported_action?(:new, nil).must_equal false
151
+ model.supported_action?(:new, true).must_equal true
152
152
  end
153
153
 
154
154
  it "should handle mtm_associations lookup" do
155
- model.supported_mtm_edit?('foos', nil).should == false
156
- model.supported_mtm_edit?('bars', nil).should == false
155
+ model.supported_mtm_edit?('foos', nil).must_equal false
156
+ model.supported_mtm_edit?('bars', nil).must_equal false
157
157
  framework.mtm_associations [:foos]
158
- model.supported_mtm_edit?('foos', nil).should == true
159
- model.supported_mtm_edit?('bars', nil).should == false
158
+ model.supported_mtm_edit?('foos', nil).must_equal true
159
+ model.supported_mtm_edit?('bars', nil).must_equal false
160
160
  framework.mtm_associations{|mod, req| req ? [:foos] : [:bars]}
161
- model.supported_mtm_edit?('foos', nil).should == false
162
- model.supported_mtm_edit?('bars', nil).should == true
163
- model.supported_mtm_edit?('foos', true).should == true
164
- model.supported_mtm_edit?('bars', true).should == false
161
+ model.supported_mtm_edit?('foos', nil).must_equal false
162
+ model.supported_mtm_edit?('bars', nil).must_equal true
163
+ model.supported_mtm_edit?('foos', true).must_equal true
164
+ model.supported_mtm_edit?('bars', true).must_equal false
165
165
  model.mtm_associations ['bars']
166
- model.supported_mtm_edit?('foos', nil).should == false
167
- model.supported_mtm_edit?('bars', nil).should == true
166
+ model.supported_mtm_edit?('foos', nil).must_equal false
167
+ model.supported_mtm_edit?('bars', nil).must_equal true
168
168
  model.mtm_associations{|req| req ? ['foos'] : ['bars']}
169
- model.supported_mtm_edit?('foos', nil).should == false
170
- model.supported_mtm_edit?('bars', nil).should == true
171
- model.supported_mtm_edit?('foos', true).should == true
172
- model.supported_mtm_edit?('bars', true).should == false
169
+ model.supported_mtm_edit?('foos', nil).must_equal false
170
+ model.supported_mtm_edit?('bars', nil).must_equal true
171
+ model.supported_mtm_edit?('foos', true).must_equal true
172
+ model.supported_mtm_edit?('bars', true).must_equal false
173
173
  end
174
174
 
175
175
  it "should handle inline_mtm_associations lookup" do
176
- model.supported_mtm_update?('foos', nil).should == false
177
- model.supported_mtm_update?('bars', nil).should == false
176
+ model.supported_mtm_update?('foos', nil).must_equal false
177
+ model.supported_mtm_update?('bars', nil).must_equal false
178
178
  framework.inline_mtm_associations [:foos]
179
- model.supported_mtm_update?('foos', nil).should == true
180
- model.supported_mtm_update?('bars', nil).should == false
179
+ model.supported_mtm_update?('foos', nil).must_equal true
180
+ model.supported_mtm_update?('bars', nil).must_equal false
181
181
  framework.inline_mtm_associations{|mod, req| req ? [:foos] : [:bars]}
182
- model.supported_mtm_update?('foos', nil).should == false
183
- model.supported_mtm_update?('bars', nil).should == true
184
- model.supported_mtm_update?('foos', true).should == true
185
- model.supported_mtm_update?('bars', true).should == false
182
+ model.supported_mtm_update?('foos', nil).must_equal false
183
+ model.supported_mtm_update?('bars', nil).must_equal true
184
+ model.supported_mtm_update?('foos', true).must_equal true
185
+ model.supported_mtm_update?('bars', true).must_equal false
186
186
  model.inline_mtm_associations ['bars']
187
- model.supported_mtm_update?('foos', nil).should == false
188
- model.supported_mtm_update?('bars', nil).should == true
187
+ model.supported_mtm_update?('foos', nil).must_equal false
188
+ model.supported_mtm_update?('bars', nil).must_equal true
189
189
  model.inline_mtm_associations{|req| req ? ['foos'] : ['bars']}
190
- model.supported_mtm_update?('foos', nil).should == false
191
- model.supported_mtm_update?('bars', nil).should == true
192
- model.supported_mtm_update?('foos', true).should == true
193
- model.supported_mtm_update?('bars', true).should == false
190
+ model.supported_mtm_update?('foos', nil).must_equal false
191
+ model.supported_mtm_update?('bars', nil).must_equal true
192
+ model.supported_mtm_update?('foos', true).must_equal true
193
+ model.supported_mtm_update?('bars', true).must_equal false
194
194
  end
195
195
 
196
196
  it "should handle association_links lookup" do
197
- model.association_links_for(:show, nil).should == []
197
+ model.association_links_for(:show, nil).must_equal []
198
198
  framework.association_links :foo
199
- model.association_links_for(:show, nil).should == [:foo]
199
+ model.association_links_for(:show, nil).must_equal [:foo]
200
200
  framework.association_links{|mod, type, req| [mod.name.to_sym, type, req]}
201
- model.association_links_for(:show, :foo).should == [:Artist, :show, :foo]
201
+ model.association_links_for(:show, :foo).must_equal [:Artist, :show, :foo]
202
202
  model.association_links [:bar]
203
- model.association_links_for(:show, nil).should == [:bar]
203
+ model.association_links_for(:show, nil).must_equal [:bar]
204
204
  model.association_links{|type, req| [type, req]}
205
- model.association_links_for(:show, :foo).should == [:show, :foo]
205
+ model.association_links_for(:show, :foo).must_equal [:show, :foo]
206
206
  end
207
207
 
208
208
  it "should handle lazy_load_association_links lookup" do
209
- model.lazy_load_association_links?(:show, nil).should == false
209
+ model.lazy_load_association_links?(:show, nil).must_equal false
210
210
  framework.lazy_load_association_links true
211
- model.lazy_load_association_links?(:show, nil).should == true
211
+ model.lazy_load_association_links?(:show, nil).must_equal true
212
212
  framework.lazy_load_association_links{|mod, type, req| req > 2}
213
- model.lazy_load_association_links?(:show, 1).should == false
214
- model.lazy_load_association_links?(:show, 3).should == true
213
+ model.lazy_load_association_links?(:show, 1).must_equal false
214
+ model.lazy_load_association_links?(:show, 3).must_equal true
215
215
  model.lazy_load_association_links false
216
- model.lazy_load_association_links?(:show, nil).should == false
216
+ model.lazy_load_association_links?(:show, nil).must_equal false
217
217
  model.lazy_load_association_links{|type, req| req > 2}
218
- model.lazy_load_association_links?(:show, 1).should == false
219
- model.lazy_load_association_links?(:show, 3).should == true
218
+ model.lazy_load_association_links?(:show, 1).must_equal false
219
+ model.lazy_load_association_links?(:show, 3).must_equal true
220
220
  end
221
221
 
222
222
  it "should handle form_attributes lookup" do
223
- model.form_attributes_for(:show, nil).should == {}
223
+ model.form_attributes_for(:show, nil).must_equal({})
224
224
  framework.form_attributes :class=>'foo'
225
- model.form_attributes_for(:show, nil).should == {:class=>'foo'}
225
+ model.form_attributes_for(:show, nil).must_equal(:class=>'foo')
226
226
  framework.form_attributes{|mod, type, req| {:class=>"#{mod} #{type} #{req}"}}
227
- model.form_attributes_for(:show, 1).should == {:class=>'Artist show 1'}
227
+ model.form_attributes_for(:show, 1).must_equal(:class=>'Artist show 1')
228
228
 
229
229
  framework.form_attributes :class=>'foo'
230
230
  model.form_attributes :data=>"bar"
231
- model.form_attributes_for(:show, nil).should == {:class=>'foo', :data=>'bar'}
231
+ model.form_attributes_for(:show, nil).must_equal(:class=>'foo', :data=>'bar')
232
232
  model.form_attributes{|type, req| {:data=>"#{type} #{req}"}}
233
- model.form_attributes_for(:show, 1).should == {:class=>'foo', :data=>'show 1'}
233
+ model.form_attributes_for(:show, 1).must_equal(:class=>'foo', :data=>'show 1')
234
234
  end
235
235
 
236
236
  it "should handle form_options lookup" do
237
- model.form_options_for(:show, nil).should == {}
237
+ model.form_options_for(:show, nil).must_equal({})
238
238
  framework.form_options :class=>'foo'
239
- model.form_options_for(:show, nil).should == {:class=>'foo'}
239
+ model.form_options_for(:show, nil).must_equal(:class=>'foo')
240
240
  framework.form_options{|mod, type, req| {:class=>"#{mod} #{type} #{req}"}}
241
- model.form_options_for(:show, 1).should == {:class=>'Artist show 1'}
241
+ model.form_options_for(:show, 1).must_equal(:class=>'Artist show 1')
242
242
 
243
243
  framework.form_options :class=>'foo'
244
244
  model.form_options :data=>"bar"
245
- model.form_options_for(:show, nil).should == {:class=>'foo', :data=>'bar'}
245
+ model.form_options_for(:show, nil).must_equal(:class=>'foo', :data=>'bar')
246
246
  model.form_options{|type, req| {:data=>"#{type} #{req}"}}
247
- model.form_options_for(:show, 1).should == {:class=>'foo', :data=>'show 1'}
247
+ model.form_options_for(:show, 1).must_equal(:class=>'foo', :data=>'show 1')
248
248
  end
249
249
 
250
250
  it "should handle page_header lookup" do
251
- model.page_header_for(:show, nil).should be_nil
251
+ model.page_header_for(:show, nil).must_equal nil
252
252
  framework.page_header "foo"
253
- model.page_header_for(:show, nil).should == 'foo'
253
+ model.page_header_for(:show, nil).must_equal 'foo'
254
254
  framework.page_header{|mod, type, req| "#{mod} #{type} #{req}"}
255
- model.page_header_for(:show, 1).should == 'Artist show 1'
255
+ model.page_header_for(:show, 1).must_equal 'Artist show 1'
256
256
  model.page_header "bar"
257
- model.page_header_for(:show, nil).should == 'bar'
257
+ model.page_header_for(:show, nil).must_equal 'bar'
258
258
  model.page_header{|type, req| "#{type} #{req}"}
259
- model.page_header_for(:show, 1).should == 'show 1'
259
+ model.page_header_for(:show, 1).must_equal 'show 1'
260
260
  end
261
261
 
262
262
  it "should handle page_footer lookup" do
263
- model.page_footer_for(:show, nil).should be_nil
263
+ model.page_footer_for(:show, nil).must_equal nil
264
264
  framework.page_footer "foo"
265
- model.page_footer_for(:show, nil).should == 'foo'
265
+ model.page_footer_for(:show, nil).must_equal 'foo'
266
266
  framework.page_footer{|mod, type, req| "#{mod} #{type} #{req}"}
267
- model.page_footer_for(:show, 1).should == 'Artist show 1'
267
+ model.page_footer_for(:show, 1).must_equal 'Artist show 1'
268
268
  model.page_footer "bar"
269
- model.page_footer_for(:show, nil).should == 'bar'
269
+ model.page_footer_for(:show, nil).must_equal 'bar'
270
270
  model.page_footer{|type, req| "#{type} #{req}"}
271
- model.page_footer_for(:show, 1).should == 'show 1'
271
+ model.page_footer_for(:show, 1).must_equal 'show 1'
272
272
  end
273
273
 
274
274
  it "should handle autocompletion options" do
275
275
  model.autocomplete_options({})
276
- model.autocomplete(:type=>:show, :query=>'foo').should == []
276
+ model.autocomplete(:type=>:show, :query=>'foo').must_equal []
277
277
  a = Artist.create(:name=>'FooBar')
278
- model.autocomplete(:type=>:show, :query=>'foo').should == ["#{a.id} - FooBar"]
279
- model.autocomplete(:type=>:show, :query=>'boo').should == []
278
+ model.autocomplete(:type=>:show, :query=>'foo').must_equal ["#{a.id} - FooBar"]
279
+ model.autocomplete(:type=>:show, :query=>'boo').must_equal []
280
280
  b = Artist.create(:name=>'BooFar')
281
- model.autocomplete(:type=>:show, :query=>'boo').should == ["#{b.id} - BooFar"]
282
- model.autocomplete(:type=>:show, :query=>'oo').sort.should == ["#{a.id} - FooBar", "#{b.id} - BooFar"]
281
+ model.autocomplete(:type=>:show, :query=>'boo').must_equal ["#{b.id} - BooFar"]
282
+ model.autocomplete(:type=>:show, :query=>'oo').sort.must_equal ["#{a.id} - FooBar", "#{b.id} - BooFar"]
283
283
 
284
284
  framework.autocomplete_options :display=>:id
285
- model.autocomplete(:type=>:show, :query=>a.id.to_s).should == ["#{a.id} - #{a.id}"]
285
+ model.autocomplete(:type=>:show, :query=>a.id.to_s).must_equal ["#{a.id} - #{a.id}"]
286
286
  framework.autocomplete_options{|mod, type, req| {:limit=>req}}
287
- model.autocomplete(:type=>:show, :query=>'oo', :request=>1).should == ["#{a.id} - FooBar"]
287
+ model.autocomplete(:type=>:show, :query=>'oo', :request=>1).must_equal ["#{a.id} - FooBar"]
288
288
  model.autocomplete_options :display=>:id
289
- model.autocomplete(:type=>:show, :query=>a.id.to_s).should == ["#{a.id} - #{a.id}"]
289
+ model.autocomplete(:type=>:show, :query=>a.id.to_s).must_equal ["#{a.id} - #{a.id}"]
290
290
 
291
291
  framework.autocomplete_options({})
292
- model.autocomplete(:type=>:show, :query=>a.id.to_s).should == ["#{a.id} - #{a.id}"]
292
+ model.autocomplete(:type=>:show, :query=>a.id.to_s).must_equal ["#{a.id} - #{a.id}"]
293
293
  model.autocomplete_options :display=>proc{:id}
294
- model.autocomplete(:type=>:show, :query=>b.id.to_s).should == ["#{b.id} - #{b.id}"]
294
+ model.autocomplete(:type=>:show, :query=>b.id.to_s).must_equal ["#{b.id} - #{b.id}"]
295
295
  model.autocomplete_options :limit=>1
296
- model.autocomplete(:type=>:show, :query=>'oo').should == ["#{a.id} - FooBar"]
296
+ model.autocomplete(:type=>:show, :query=>'oo').must_equal ["#{a.id} - FooBar"]
297
297
  model.autocomplete_options :limit=>proc{1}
298
- model.autocomplete(:type=>:show, :query=>'oo').should == ["#{a.id} - FooBar"]
298
+ model.autocomplete(:type=>:show, :query=>'oo').must_equal ["#{a.id} - FooBar"]
299
299
  model.autocomplete_options :callback=>proc{|ds, opts| ds.reverse_order(:id)}
300
- model.autocomplete(:type=>:show, :query=>'oo').should == ["#{b.id} - BooFar", "#{a.id} - FooBar"]
300
+ model.autocomplete(:type=>:show, :query=>'oo').must_equal ["#{b.id} - BooFar", "#{a.id} - FooBar"]
301
301
 
302
302
  model.autocomplete_options :filter=>proc{|ds, opts| ds.where(:name=>opts[:query])}
303
- model.autocomplete(:type=>:show, :query=>'foo').should == []
304
- model.autocomplete(:type=>:show, :query=>'FooBar').should == ["#{a.id} - FooBar"]
303
+ model.autocomplete(:type=>:show, :query=>'foo').must_equal []
304
+ model.autocomplete(:type=>:show, :query=>'FooBar').must_equal ["#{a.id} - FooBar"]
305
305
 
306
306
  model.autocomplete_options{|type, req| {:limit=>req}}
307
- model.autocomplete(:type=>:show, :query=>'oo', :request=>1).should == ["#{a.id} - FooBar"]
307
+ model.autocomplete(:type=>:show, :query=>'oo', :request=>1).must_equal ["#{a.id} - FooBar"]
308
308
  end
309
309
  end
310
310
 
@@ -332,27 +332,27 @@ describe AutoForme do
332
332
  end
333
333
 
334
334
  artist.autocomplete_options({})
335
- model.autocomplete(:query=>'foo', :association=>:artist).should == []
335
+ model.autocomplete(:query=>'foo', :association=>:artist).must_equal []
336
336
  a = Artist.create(:name=>'FooBar')
337
- model.autocomplete(:query=>'foo', :association=>:artist).should == ["#{a.id} - FooBar"]
338
- model.autocomplete(:query=>'boo', :association=>:artist).should == []
337
+ model.autocomplete(:query=>'foo', :association=>:artist).must_equal ["#{a.id} - FooBar"]
338
+ model.autocomplete(:query=>'boo', :association=>:artist).must_equal []
339
339
  b = Artist.create(:name=>'BooFar')
340
- model.autocomplete(:query=>'boo', :association=>:artist).should == ["#{b.id} - BooFar"]
341
- model.autocomplete(:query=>'oo', :association=>:artist).sort.should == ["#{a.id} - FooBar", "#{b.id} - BooFar"]
340
+ model.autocomplete(:query=>'boo', :association=>:artist).must_equal ["#{b.id} - BooFar"]
341
+ model.autocomplete(:query=>'oo', :association=>:artist).sort.must_equal ["#{a.id} - FooBar", "#{b.id} - BooFar"]
342
342
  artist.autocomplete_options :display=>:id
343
- model.autocomplete(:query=>a.id.to_s, :association=>:artist).should == ["#{a.id} - #{a.id}"]
343
+ model.autocomplete(:query=>a.id.to_s, :association=>:artist).must_equal ["#{a.id} - #{a.id}"]
344
344
  artist.autocomplete_options :display=>proc{:id}
345
- model.autocomplete(:query=>b.id.to_s, :association=>:artist).should == ["#{b.id} - #{b.id}"]
345
+ model.autocomplete(:query=>b.id.to_s, :association=>:artist).must_equal ["#{b.id} - #{b.id}"]
346
346
  artist.autocomplete_options :limit=>1
347
- model.autocomplete(:query=>'oo', :association=>:artist).should == ["#{a.id} - FooBar"]
347
+ model.autocomplete(:query=>'oo', :association=>:artist).must_equal ["#{a.id} - FooBar"]
348
348
  artist.autocomplete_options :limit=>proc{1}
349
- model.autocomplete(:query=>'oo', :association=>:artist).should == ["#{a.id} - FooBar"]
349
+ model.autocomplete(:query=>'oo', :association=>:artist).must_equal ["#{a.id} - FooBar"]
350
350
  artist.autocomplete_options :callback=>proc{|ds, opts| ds.reverse_order(:id)}
351
- model.autocomplete(:query=>'oo', :association=>:artist).should == ["#{b.id} - BooFar", "#{a.id} - FooBar"]
351
+ model.autocomplete(:query=>'oo', :association=>:artist).must_equal ["#{b.id} - BooFar", "#{a.id} - FooBar"]
352
352
 
353
353
  artist.autocomplete_options :filter=>proc{|ds, opts| ds.where(:name=>opts[:query])}
354
- model.autocomplete(:query=>'foo', :association=>:artist).should == []
355
- model.autocomplete(:query=>'FooBar', :association=>:artist).should == ["#{a.id} - FooBar"]
354
+ model.autocomplete(:query=>'foo', :association=>:artist).must_equal []
355
+ model.autocomplete(:query=>'FooBar', :association=>:artist).must_equal ["#{a.id} - FooBar"]
356
356
  end
357
357
  end
358
358
 
@@ -379,36 +379,36 @@ describe AutoForme do
379
379
  end
380
380
 
381
381
  artist.autocomplete_options({})
382
- model.autocomplete(:query=>'foo', :association=>:artists).should == []
382
+ model.autocomplete(:query=>'foo', :association=>:artists).must_equal []
383
383
  a = Artist.create(:name=>'FooBar')
384
- model.autocomplete(:query=>'foo', :association=>:artists).should == ["#{a.id} - FooBar"]
385
- model.autocomplete(:query=>'boo', :association=>:artists).should == []
384
+ model.autocomplete(:query=>'foo', :association=>:artists).must_equal ["#{a.id} - FooBar"]
385
+ model.autocomplete(:query=>'boo', :association=>:artists).must_equal []
386
386
  b = Artist.create(:name=>'BooFar')
387
- model.autocomplete(:query=>'boo', :association=>:artists).should == ["#{b.id} - BooFar"]
388
- model.autocomplete(:query=>'oo', :association=>:artists).sort.should == ["#{a.id} - FooBar", "#{b.id} - BooFar"]
387
+ model.autocomplete(:query=>'boo', :association=>:artists).must_equal ["#{b.id} - BooFar"]
388
+ model.autocomplete(:query=>'oo', :association=>:artists).sort.must_equal ["#{a.id} - FooBar", "#{b.id} - BooFar"]
389
389
  c = Album.create(:name=>'Quux')
390
390
  c.add_artist(a)
391
- model.autocomplete(:query=>'oo', :association=>:artists, :exclude=>c.id).sort.should == ["#{b.id} - BooFar"]
391
+ model.autocomplete(:query=>'oo', :association=>:artists, :exclude=>c.id).sort.must_equal ["#{b.id} - BooFar"]
392
392
  artist.autocomplete_options :display=>:id
393
- model.autocomplete(:query=>a.id.to_s, :association=>:artists).should == ["#{a.id} - #{a.id}"]
394
- model.autocomplete(:query=>b.id.to_s, :association=>:artists, :exclude=>c.id).should == ["#{b.id} - #{b.id}"]
393
+ model.autocomplete(:query=>a.id.to_s, :association=>:artists).must_equal ["#{a.id} - #{a.id}"]
394
+ model.autocomplete(:query=>b.id.to_s, :association=>:artists, :exclude=>c.id).must_equal ["#{b.id} - #{b.id}"]
395
395
  artist.autocomplete_options :display=>proc{:id}
396
- model.autocomplete(:query=>b.id.to_s, :association=>:artists).should == ["#{b.id} - #{b.id}"]
397
- model.autocomplete(:query=>a.id.to_s, :association=>:artists, :exclude=>c.id).should == []
396
+ model.autocomplete(:query=>b.id.to_s, :association=>:artists).must_equal ["#{b.id} - #{b.id}"]
397
+ model.autocomplete(:query=>a.id.to_s, :association=>:artists, :exclude=>c.id).must_equal []
398
398
  artist.autocomplete_options :limit=>1
399
- model.autocomplete(:query=>'oo', :association=>:artists).should == ["#{a.id} - FooBar"]
400
- model.autocomplete(:query=>'oo', :association=>:artists, :exclude=>c.id).should == ["#{b.id} - BooFar"]
399
+ model.autocomplete(:query=>'oo', :association=>:artists).must_equal ["#{a.id} - FooBar"]
400
+ model.autocomplete(:query=>'oo', :association=>:artists, :exclude=>c.id).must_equal ["#{b.id} - BooFar"]
401
401
  artist.autocomplete_options :limit=>proc{1}
402
- model.autocomplete(:query=>'oo', :association=>:artists).should == ["#{a.id} - FooBar"]
403
- model.autocomplete(:query=>'oo', :association=>:artists, :exclude=>c.id).should == ["#{b.id} - BooFar"]
402
+ model.autocomplete(:query=>'oo', :association=>:artists).must_equal ["#{a.id} - FooBar"]
403
+ model.autocomplete(:query=>'oo', :association=>:artists, :exclude=>c.id).must_equal ["#{b.id} - BooFar"]
404
404
  artist.autocomplete_options :callback=>proc{|ds, opts| ds.reverse_order(:id)}
405
- model.autocomplete(:query=>'oo', :association=>:artists).should == ["#{b.id} - BooFar", "#{a.id} - FooBar"]
406
- model.autocomplete(:query=>'oo', :association=>:artists, :exclude=>c.id).should == ["#{b.id} - BooFar"]
405
+ model.autocomplete(:query=>'oo', :association=>:artists).must_equal ["#{b.id} - BooFar", "#{a.id} - FooBar"]
406
+ model.autocomplete(:query=>'oo', :association=>:artists, :exclude=>c.id).must_equal ["#{b.id} - BooFar"]
407
407
 
408
408
  artist.autocomplete_options :filter=>proc{|ds, opts| ds.where(:name=>opts[:query])}
409
- model.autocomplete(:query=>'foo', :association=>:artists).should == []
410
- model.autocomplete(:query=>'FooBar', :association=>:artists).should == ["#{a.id} - FooBar"]
411
- model.autocomplete(:query=>'FooBar', :association=>:artists, :exclude=>c.id).should == []
409
+ model.autocomplete(:query=>'foo', :association=>:artists).must_equal []
410
+ model.autocomplete(:query=>'FooBar', :association=>:artists).must_equal ["#{a.id} - FooBar"]
411
+ model.autocomplete(:query=>'FooBar', :association=>:artists, :exclude=>c.id).must_equal []
412
412
  end
413
413
  end
414
414
 
@@ -425,25 +425,26 @@ describe AutoForme::OptsAttributes do
425
425
  end
426
426
 
427
427
  it "should act as a getter if given no arguments, and setter if given arguments or a block" do
428
- @o.foo.should be_nil
429
- @o.foo(1).should == 1
430
- @o.foo.should == 1
428
+ @o.foo.must_equal nil
429
+ @o.foo(1).must_equal 1
430
+ @o.foo.must_equal 1
431
431
  p = proc{}
432
- @o.foo(&p).should == p
433
- @o.foo.should == p
432
+ # Work around minitest bug
433
+ assert_equal @o.foo(&p), p
434
+ assert_equal @o.foo, p
434
435
  end
435
436
 
436
437
  it "should should raise an error if given more than one argument" do
437
- proc{@o.foo(1, 2)}.should raise_error(ArgumentError)
438
+ proc{@o.foo(1, 2)}.must_raise(ArgumentError)
438
439
  end
439
440
 
440
441
  it "should should raise an error if given block and argument" do
441
- proc{@o.foo(1){}}.should raise_error(ArgumentError)
442
+ proc{@o.foo(1){}}.must_raise(ArgumentError)
442
443
  end
443
444
  end
444
445
 
445
446
  describe AutoForme do
446
447
  it ".version should return a typical version string" do
447
- AutoForme.version.should =~ /\A\d+\.\d+\.\d+\z/
448
+ AutoForme.version.must_match /\A\d+\.\d+\.\d+\z/
448
449
  end
449
450
  end