Sha256: 10da9c7f100ef340c69e05d131d2806594690a0b9fae613577e9e0a57523fb15

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 Bytes

Contents

shared_examples_for "input instantiation" do
  let(:name) { "myfield" }
  let(:html) { mock.as_null_object }

  context "with default attributes" do
    subject { described_class.new }

    let(:options) { {} }
    let(:expected_options) { {type: type} }

    it "instantiates component" do
      component.should_receive(:new).with(subject, name, expected_options).and_return(html)
      subject.public_send(helper, name, options)
    end
  end

  context "with custom attributes" do
    subject { described_class.new }

    let(:options) { {autofocus: true} }
    let(:expected_options) { options.merge(type: type) }

    it "instantiates component" do
      component.should_receive(:new).with(subject, name, expected_options).and_return(html)
      subject.public_send(helper, name, options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
form-0.0.1.alpha1 spec/support/input_instantiation_shared.rb