Sha256: e892dde526d4a1fdf8436b25e948d2f1f401ce4ba4e101068bb8b03eaf9f3137

Contents?: true

Size: 666 Bytes

Versions: 2

Compression:

Stored size: 666 Bytes

Contents

RSpec.shared_examples 'rendered active element' do
  context 'when it is required' do
    before(:each) { attributes[:required] = true }

    it "has an 'invalid' class attribute" do
      field.valid?
      render render_params
      expect(rendered).to match /<div.*class="invalid"/
    end

    it "has an error message" do
      field.valid?
      render render_params
      expect(rendered).to include '<span class="error">This field is required</span>'
    end
  end

  it 'has a wrapper class attribute in the div wrapper' do
    attributes[:wrapper_class] = 'my_class'
    render render_params
    expect(rendered).to match /<div.*class="my_class"/
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hungryform-rails-0.0.6 spec/views/shared_examples/rendered_active_element.rb
hungryform-rails-0.0.5 spec/views/shared_examples/rendered_active_element.rb