Sha256: 5bd7e4de8afb8b4bafbf9382c466da7dff60e1ba6e51306958ba86d8109a1c3d
Contents?: true
Size: 1.39 KB
Versions: 31
Compression:
Stored size: 1.39 KB
Contents
require "rails_helper" describe Releaf::Builders::FormBuilder::NumberFields, type: :class do class FormBuilderTestHelper < ActionView::Base include Releaf::ApplicationHelper include Releaf::ButtonHelper include FontAwesome::Rails::IconHelper end let(:template){ FormBuilderTestHelper.new } let(:object){ Book.new } let(:subject){ Releaf::Builders::FormBuilder.new(:book, object, template, {}) } describe "#releaf_number_field" do it "returns input with type 'number'" do expect(subject).to receive(:number_field).with("title", { value: nil, step: "any", class: "text" }).and_return("x") expect(subject).to receive(:input_wrapper_with_label).with("title", "x", { label: {}, field: {}, options: { field: { type: "number" }}}).and_return("y") expect(subject.releaf_number_field("title")).to eq("y") end context "aliases" do let(:releaf_number_field_method) { subject.method(:releaf_number_field) } it "is aliased by #releaf_integer_field" do expect(subject.method(:releaf_integer_field)).to eq(releaf_number_field_method) end it "is aliased by #releaf_float_field" do expect(subject.method(:releaf_float_field)).to eq(releaf_number_field_method) end it "is aliased by #releaf_decimal_field" do expect(subject.method(:releaf_decimal_field)).to eq(releaf_number_field_method) end end end end
Version data entries
31 entries across 31 versions & 1 rubygems