merb-helpers 1.1.0.rc1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -262,9 +262,9 @@ module Merb::Helpers::Form::Builder
262
262
 
263
263
  option_attrs = {:value => value}
264
264
  if sel.is_a?(Array)
265
- option_attrs.merge!(:selected => "selected") if value.in? sel
265
+ option_attrs.merge!(:selected => "selected") if value.in? sel.map {|e| e.to_s }
266
266
  else
267
- option_attrs.merge!(:selected => "selected") if value == sel
267
+ option_attrs.merge!(:selected => "selected") if value == sel.to_s
268
268
  end
269
269
  tag(:option, text, option_attrs)
270
270
  end).join
@@ -1,5 +1,5 @@
1
1
  module Merb
2
2
  module Helpers
3
- VERSION = '1.1.0.rc1'.freeze
3
+ VERSION = '1.1.0'.freeze
4
4
  end
5
5
  end
@@ -1 +1 @@
1
- <%= select(:name => "foo", :collection => %w(one two three), :selected => "three") %>
1
+ <%= select(:name => "foo", :collection => @collection, :selected => @selected) %>
@@ -937,13 +937,33 @@ describe "select" do
937
937
  r.should have_selector("select[name=foo] option:contains('three')")
938
938
  end
939
939
 
940
- it "should allow selecting an option by passing in :selected => 'three'" do
940
+ it "should allow selecting an option by passing in :selected => string" do
941
+ @c.instance_variable_set(:@collection, %w(one two three))
942
+ @c.instance_variable_set(:@selected, 'three')
941
943
  r = @c.render :selected
942
944
  r.should_not have_selector("select[name=foo] option[selected]:contains('one')")
943
945
  r.should_not have_selector("select[name=foo] option[selected]:contains('two')")
944
946
  r.should have_selector("select[name=foo] option[selected]:contains('three')")
945
947
  end
946
948
 
949
+ it "should allow selecting an option by passing in :selected => integer" do
950
+ @c.instance_variable_set(:@collection, %w(1 2 3))
951
+ @c.instance_variable_set(:@selected, 3)
952
+ r = @c.render :selected
953
+ r.should_not have_selector("select[name=foo] option[selected]:contains('1')")
954
+ r.should_not have_selector("select[name=foo] option[selected]:contains('2')")
955
+ r.should have_selector("select[name=foo] option[selected]:contains('3')")
956
+ end
957
+
958
+ it "should allow selecting an option by passing in :selected => [integers]" do
959
+ @c.instance_variable_set(:@collection, %w(1 2 3))
960
+ @c.instance_variable_set(:@selected, [2, 3])
961
+ r = @c.render :selected
962
+ r.should_not have_selector("select[name=foo] option[selected]:contains('1')")
963
+ r.should have_selector("select[name=foo] option[selected]:contains('2')")
964
+ r.should have_selector("select[name=foo] option[selected]:contains('3')")
965
+ end
966
+
947
967
  it "should render the select tag with suffix '[]' to name when :multiple => true" do
948
968
  r = @c.render :multiple
949
969
  r.should match_tag( :select, :name => "foo[]")
File without changes
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb-helpers
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
4
+ prerelease: false
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
8
  - 0
9
- - rc1
10
- version: 1.1.0.rc1
9
+ version: 1.1.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Michael D. Ivey
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-03-14 00:00:00 +00:00
17
+ date: 2010-03-22 00:00:00 +00:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -29,8 +28,7 @@ dependencies:
29
28
  - 1
30
29
  - 1
31
30
  - 0
32
- - rc1
33
- version: 1.1.0.rc1
31
+ version: 1.1.0
34
32
  type: :runtime
35
33
  version_requirements: *id001
36
34
  - !ruby/object:Gem::Dependency
@@ -277,6 +275,7 @@ files:
277
275
  - spec/merb_helpers_form_spec.rb
278
276
  - spec/merb_helpers_tag_helper_spec.rb
279
277
  - spec/merb_helpers_text_spec.rb
278
+ - spec/merb_test.log
280
279
  - spec/numeric_extlib_spec.rb
281
280
  - spec/ordinalize_spec.rb
282
281
  - spec/spec.opts
@@ -300,13 +299,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
300
299
  version: "0"
301
300
  required_rubygems_version: !ruby/object:Gem::Requirement
302
301
  requirements:
303
- - - ">"
302
+ - - ">="
304
303
  - !ruby/object:Gem::Version
305
304
  segments:
306
- - 1
307
- - 3
308
- - 1
309
- version: 1.3.1
305
+ - 0
306
+ version: "0"
310
307
  requirements: []
311
308
 
312
309
  rubyforge_project: