Testing Numeric Field Type Implementation in rails_admin
This test suite validates the numeric field type implementation in RailsAdmin, focusing on integer field handling and input rendering. The tests ensure proper configuration and behavior of numeric fields within the RailsAdmin framework.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
railsadminteam/rails_admin
spec/rails_admin/config/fields/types/numeric_spec.rb
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config::Fields::Types::Numeric do
it_behaves_like 'a generic field type', :integer_field, :integer
subject do
RailsAdmin.config('FieldTest').fields.detect do |f|
f.name == :integer_field
end.with(object: FieldTest.new)
end
describe '#view_helper' do
it "uses the 'number' type input tag" do
expect(subject.view_helper).to eq(:number_field)
end
end
end