Sha256: b7fa50c37ad81c8da5402c3441f94535d6a38ba277231ee1026cfe48df4aac20

Contents?: true

Size: 906 Bytes

Versions: 4

Compression:

Stored size: 906 Bytes

Contents

require 'spec_helper'

describe 'rendering a group' do
  let(:attributes) { {} }
  let(:resolver) { HungryForm::Resolver.new }
  let(:group) { HungryForm::Elements::Group.new(:group, nil, resolver, visible: true) {} }
  let(:field) { 
    HungryForm::Elements::Group.new(:field_name, group, resolver, attributes) do
      text_field :first
      text_field :second
      group :nested do
        text_field :third
        text_field :forth
      end
    end
  }
  let(:render_params) {
    {
      partial: 'hungryform/group',
      locals: { field: field, views_prefix: 'hungryform' }
    }
  }

  it_behaves_like 'it is wrapped in a div'

  it 'has a text field' do
    render render_params
    expect(rendered).to match /<input.*id="group_field_name_first"/
  end

  it 'has a nested group' do
    render render_params
    expect(rendered).to match /<div.*id="group_field_name_nested_wrapper"/
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hungryform-rails-0.0.6 spec/views/group_spec.rb
hungryform-rails-0.0.5 spec/views/group_spec.rb
hungryform-rails-0.0.4 spec/views/group_spec.rb
hungryform-rails-0.0.3 spec/views/group_spec.rb