RSpec.shared_examples 'rendered active element' do
it 'has a label' do
render render_params
expect(rendered).to include ''
end
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 /
Field name*'
end
it "has an error message" do
field.valid?
render render_params
expect(rendered).to include 'This field is required'
end
end
# As a class is gonna be in the wrapper
it 'does not have an input with a class attribute' do
attributes[:class] = 'my_class'
render render_params
expect(rendered).not_to match /