Sha256: 25a17cbcb29ab7091074557aed6c4c209fa3c25cd405ecac84a5666e72a2c5b8
Contents?: true
Size: 750 Bytes
Versions: 5
Compression:
Stored size: 750 Bytes
Contents
require 'pr/build_from_model' describe 'building forms from models' do let(:registry) { double "field registry", fields: [:a,:b] } let(:form) { double "form", __a: field_a, __b: field_b } let(:field_a) { double "field a", populate: nil } let(:field_b) { double "field b" } let(:model) { Struct.new(:a).new 'a' } let(:builder) { PR::BuildFromModel.new(registry, form) } it 'gets fields from the registry' do registry.should_receive(:fields) builder.build_from model end it 'populates the form values from the model when it has them' do field_a.should_receive(:populate).with('a') builder.build_from model end it 'returns the form' do expect( builder.build_from model ).to eq form end end
Version data entries
5 entries across 5 versions & 1 rubygems