Sha256: 45b6b898f9118760487bb500bb98fed1fb275f6c2670a2f686d301bdd232d8bb

Contents?: true

Size: 1.17 KB

Versions: 15

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe 'CompositeInput' do

  class Foo
    extend ActiveModel::Naming
    include ActiveModel::Conversion
    include ActiveModel::Validations
    def persisted?; false; end
    attr_writer :bar, :bar_baz, :bar_bong

    def bar; @bar ||= "baz1 bong1"; end
    def bar_baz; @bar_baz ||= "baz1"; end
    def bar_bong; @bar_bong ||= "bong1"; end
  end

  subject {
    input_for(
      Foo.new, :bar,
      {
        elements: [:baz,:bong],
        as: :composite,
        input_size: 'input-xlarge',
      }
    )
  }

  it do
    expect(subject).to have_tag('.control-group.foo_bar.composite') do
      with_tag('.control-label') do
        with_tag('label.composite.input-xlarge#foo_bar_baz_label', text: 'Baz', for: 'foo_bar_baz')
        with_tag('label.composite.input-xlarge#foo_bar_bong_label', text: 'Bong', for: 'foo_bar_bong')
      end
      with_tag('.controls') do
        with_tag('fieldset.composite-input') do
          with_tag('input.foo_bar_baz.input-xlarge#foo_bar_baz', name: 'foo[bar][baz]', value: 'baz1')
          with_tag('input.foo_bar_bong.input-xlarge#foo_bar_bong', name: 'foo[bar][bong]', value: 'bong1')
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
curate-0.6.6 spec/inputs/composite_input_spec.rb
curate-0.6.5 spec/inputs/composite_input_spec.rb
curate-0.6.4 spec/inputs/composite_input_spec.rb
curate-0.6.3 spec/inputs/composite_input_spec.rb
curate-0.6.1 spec/inputs/composite_input_spec.rb
curate-0.6.0 spec/inputs/composite_input_spec.rb
curate-0.5.6 spec/inputs/composite_input_spec.rb
curate-0.5.5 spec/inputs/composite_input_spec.rb
curate-0.5.4 spec/inputs/composite_input_spec.rb
curate-0.5.2 spec/inputs/composite_input_spec.rb
curate-0.5.1 spec/inputs/composite_input_spec.rb
curate-0.5.0 spec/inputs/composite_input_spec.rb
curate-0.4.2 spec/inputs/composite_input_spec.rb
curate-0.3.2 spec/inputs/composite_input_spec.rb
curate-0.3.1 spec/inputs/composite_input_spec.rb