Sha256: 2c51f0380a5736a1a2ad7211cf428535e42ecc89d6dda935bbee231da25b3a45
Contents?: true
Size: 1.45 KB
Versions: 15
Compression:
Stored size: 1.45 KB
Contents
require 'spec_helper' describe 'MultiValueInput' do class Foo extend ActiveModel::Naming include ActiveModel::Conversion include ActiveModel::Validations def persisted?; false; end attr_accessor :bar end let(:foo) { Foo.new } let(:bar) { ["bar1", "bar2"] } subject { foo.bar = bar input_for(foo, :bar, { as: :multi_value, required: true } ) } describe 'happy case' do it 'renders multi-value' do expect(subject).to have_tag('.control-group.foo_bar.multi_value') do with_tag('.control-label') do with_tag('label.multi_value.required', text: '* Bar', with: {for: 'foo_bar'}) do with_tag("abbr") end end with_tag('.controls') do with_tag('ul.listing') do with_tag('li.field-wrapper') do with_tag('input.foo_bar.required.multi-text-field#foo_bar', with: {name: 'foo[bar][]', value: 'bar1', required: 'required'}) end with_tag('li.field-wrapper') do with_tag('input.foo_bar.multi-text-field', with: {name: 'foo[bar][]', value: 'bar2'}, without: {required: 'required'}) end with_tag('li.field-wrapper') do with_tag('input.foo_bar.multi-text-field', with: {name: 'foo[bar][]', value: ''}, without: {required: 'required'}) end end end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems