Sha256: a3f869ffbe2f508454c8d57e7349b41255381fc934077d5d24905bc389f2e658
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
# encoding: utf-8 # frozen_string_literal: true require 'spec_helper' # TODO extract out module TestInputs def input_args @template = self @object = ::Post.new @object_name = 'post' @method = :title @options = {} @proc = Proc.new {} @builder = Formtastic::FormBuilder.new(@object_name, @object, @template, @options) [@builder, @template, @object, @object_name, @method, @options] end class ::UnimplementedInput include Formtastic::Inputs::Base end class ::ImplementedInput < UnimplementedInput def to_html "some HTML output" end end end RSpec.describe 'AnyCustomInput' do include TestInputs describe "#to_html" do describe 'without an implementation' do it "should raise a NotImplementedError exception" do expect { ::UnimplementedInput.new(*input_args).to_html }.to raise_error(NotImplementedError) end end describe 'with an implementation' do it "should raise a NotImplementedError exception" do expect { ::ImplementedInput.new(*input_args).to_html }.to_not raise_error end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
formtastic-5.0.0 | spec/inputs/custom_input_spec.rb |