Sha256: d49d71c4b5597fcd98437ec277ee2085290417140388ba406b7107e3b776c2c8

Contents?: true

Size: 806 Bytes

Versions: 4

Compression:

Stored size: 806 Bytes

Contents

require 'spec_helper'

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

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

  it 'has a text area' do
    render render_params
    expect(rendered).to match /<textarea.*id="group_field_name"/
  end

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

Version data entries

4 entries across 4 versions & 1 rubygems

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