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

- old
+ new

@@ -1,11 +1,10 @@ RSpec.shared_examples "an element" do let(:resolver) { HungryForm::Resolver.new() } let(:group) { HungryForm::Group.new(:group, nil, resolver, {}) {} } - let(:element_options) { {} } let(:element) { described_class.new(:element_name, group, resolver, element_options) {} } describe "#visible?" do it "should be visible" do expect(element.visible?).to eq true @@ -20,16 +19,10 @@ it "should not be visible" do element_options[:dependency] = '{"EQ": ["0", "1"]}' expect(element.visible?).to eq false end - it "should never be visible" do - element_options[:visible] = false - element_options[:dependency] = '{"EQ": ["1", "1"]}' - expect(element.visible?).to eq false - end - it "should be visible" do element_options[:dependency] = '{"EQ": ["1", "1"]}' expect(element.visible?).to eq true end end @@ -41,8 +34,21 @@ end it "should have a label defined in options" do element_options[:label] = "Special Label" expect(element.label).to eq "Special Label" + end + end + + describe "#method_missing" do + it "should return existing param" do + element_options[:html_param] = "param" + expect(element.html_param).to eq "param" + end + + 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 end \ No newline at end of file