Sha256: b4a7531497e5319ae0fb8824e04ea602f1930470135feb1c5e3d9e09169d7ef9
Contents?: true
Size: 1003 Bytes
Versions: 1
Compression:
Stored size: 1003 Bytes
Contents
RSpec.shared_examples 'rendered active element' do it 'has a label' do render render_params expect(rendered).to include '<label for="group_field_name">Field name</label>' 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 /<div.*class="invalid"/ end it "has an asterisk in a label" do render render_params expect(rendered).to include '<label for="group_field_name">Field name*</label>' 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 # 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 /<input.*class="my_class"/ end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hungryform-rails-0.0.3 | spec/views/shared_examples/rendered_active_element.rb |