spec/lib/magicka/form_spec.rb in magicka-0.5.2 vs spec/lib/magicka/form_spec.rb in magicka-0.5.3
- old
+ new
@@ -151,6 +151,33 @@
form.with_model(:inner) do |new_form|
expect(new_form).to eq(expected_form)
end
end
end
+
+ describe '#with_form' do
+ it do
+ form.with_model('sub') do |new_form|
+ expect(new_form)
+ .to eq(described_class.new(renderer, 'my_model.sub'))
+ end
+ end
+
+ context 'when passing a new base' do
+ it do
+ form.with_model('sub', base: :other_model) do |new_form|
+ expect(new_form)
+ .to eq(described_class.new(renderer, 'other_model.sub'))
+ end
+ end
+ end
+
+ context 'when passing an empty base' do
+ it do
+ form.with_model('sub', base: nil) do |new_form|
+ expect(new_form)
+ .to eq(described_class.new(renderer, 'sub'))
+ end
+ end
+ end
+ end
end