Sha256: 78169ad8c375fd00aa6cf2223088241ea26172e8376790b54dcfb8d2eaf50fcd

Contents?: true

Size: 805 Bytes

Versions: 2

Compression:

Stored size: 805 Bytes

Contents

require 'spec_helper'

describe 'rendering text field' do
  let(:attributes) { {} }
  let(:resolver) { HungryForm::Resolver.new }
  let(:group) { HungryForm::Elements::Group.new(:group, nil, resolver, visible: true) {} }
  let(:field) { HungryForm::Elements::TextField.new(:field_name, group, resolver, attributes) }
  let(:render_params) {
    {
      partial: 'hungryform/text_field',
      locals: { field: field }
    }
  }

  it_behaves_like 'it is wrapped in a div'
  it_behaves_like 'rendered active element'

  it 'has an input' do
    render render_params
    expect(rendered).to match /<input.*id="group_field_name"/
  end

  it 'has an input with value' do
    attributes[:value] = 'default value'
    render render_params
    expect(rendered).to match /<input.*value="default value"/
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hungryform-rails-0.0.4 spec/views/text_field_spec.rb
hungryform-rails-0.0.3 spec/views/text_field_spec.rb