Sha256: 21f9dfbb73dd3a8608eff9243e06a19d74af2bb667d734fa709c7f4c7c9b2851
Contents?: true
Size: 1.11 KB
Versions: 9
Compression:
Stored size: 1.11 KB
Contents
# encoding: utf-8 require 'spec_helper' describe 'with input class finder' do include_context 'form builder' before { allow(Formtastic::FormBuilder) .to receive(:input_class_finder).and_return(Formtastic::InputClassFinder) } it_behaves_like 'Input Helper' # from spec/support/shared_examples.rb describe 'instantiating an input class' do describe 'when instantiated multiple times with the same input type' do it "should be cached (not calling the internal methods)" do # TODO this is really tied to the underlying implementation concat(semantic_form_for(@new_post) do |builder| Formtastic::InputClassFinder.should_receive(:new).once.and_call_original builder.input(:title, :as => :string) builder.input(:title, :as => :string) end) end end it "should delegate to InputClassFinder" do concat(semantic_form_for(@new_post) do |builder| Formtastic::InputClassFinder.any_instance.should_receive(:find). with(:string).and_call_original builder.input(:title, :as => :string) end) end end end
Version data entries
9 entries across 9 versions & 2 rubygems