Sha256: 9d0e1bde2661e49fdf258b3f70ff7a6be07ec67dd8e4ac96d54e5ee9b97c04f0

Contents?: true

Size: 911 Bytes

Versions: 6

Compression:

Stored size: 911 Bytes

Contents

RSpec.shared_examples "a group" do
  describe "#group" do
    it "creates a nested group" do
      subject.group(:nested, {}) {}
      expect(subject.elements.first.class).to eq HungryForm::Elements::Group
    end

    it "concatenates nested element's name with the parent's one" do
      subject.group(:nested, {}) {}
      expect(subject.elements.first.name).to end_with "element_name_nested"
    end
  end

  describe "#to_hash" do
    it "should include group elements" do
      expect(subject.to_hash).to include(:elements)
    end
  end

  describe ".method_missing" do
    it "creates a nested element" do
      subject.html(:name)
      expect(subject.elements.first.class).to eq HungryForm::Elements::Html
    end

    it "concatenates nested element's name with the parent's one" do
      subject.html(:html)
      expect(subject.elements.first.name).to end_with "element_name_html"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hungryform-0.0.11 spec/elements/shared_examples/group.rb
hungryform-0.0.10 spec/elements/shared_examples/group.rb
hungryform-0.0.9 spec/elements/shared_examples/group.rb
hungryform-0.0.8 spec/elements/shared_examples/group.rb
hungryform-0.0.7 spec/elements/shared_examples/group.rb
hungryform-0.0.6 spec/elements/shared_examples/group.rb