Sha256: 7665c642d7729b933ac838a1799b5071837f597d0e90e7775a5b74dbe5730f19
Contents?: true
Size: 758 Bytes
Versions: 2
Compression:
Stored size: 758 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 expect(registry).to receive(:fields) builder.build_from model end it 'populates the form values from the model when it has them' do expect(field_a).to 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pr-1.0.0 | spec/unit/pr/build_from_model_spec.rb |
pr-0.0.7 | spec/unit/pr/build_from_model_spec.rb |