spec/support/shared_element.rb in hungryform-0.0.2 vs spec/support/shared_element.rb in hungryform-0.0.4

- old
+ new

@@ -1,9 +1,9 @@ RSpec.shared_examples "an element" do let(:resolver) { HungryForm::Resolver.new() } - let(:group) { HungryForm::Group.new(:group, nil, resolver, {}) {} } + let(:group) { HungryForm::Elements::Group.new(:group, nil, resolver, {}) {} } let(:element) { described_class.new(:element_name, group, resolver, element_options) {} } describe "#visible?" do it "should be visible" do @@ -47,8 +47,16 @@ it "should check whether param exists" do element_options[:html_param] = "param" expect(element.html_param?).to eq true expect(element.other_html_param?).to eq false + end + end + + describe "#to_hash" do + it "should include visible, dependency, name and label" do + element_options[:dependency] = '{"EQ": [1, 1]}' + element_options[:name] = 'name' + expect(element.to_hash).to include(:visible, :dependency, :name, :label) end end end \ No newline at end of file