spec/unit/pr/active_form_spec.rb in pr-0.0.1 vs spec/unit/pr/active_form_spec.rb in pr-0.0.2
- old
+ new
@@ -5,14 +5,23 @@
include PR::ActiveForm
end
let(:form_klass) { TestForm }
describe 'when included extends the other with its DSL' do
+ let(:name) { double "field name" }
+ let(:type) { double "field type" }
+ before do
+ stub_const 'PR::DefineAndRegister', double
+ end
+
it 'sets up field to define fields' do
- stub_const 'DefineAndRegister', double
- DefineAndRegister.should_receive(:[]).with form_klass, :name, my: :options
- form_klass.field :name, my: :options
+ PR::DefineAndRegister.should_receive(:[]).with form_klass, name, type, {}
+ form_klass.field name, type
+ end
+ it 'sets up field to define fields and passes in options' do
+ PR::DefineAndRegister.should_receive(:[]).with form_klass, name, type, my: :option
+ form_klass.field name, type, my: :option
end
it 'sets up an id' do
form = form_klass.new
form.id = :my_id