Sha256: 866e5dcf9ec5539eccbfd5733b0b501254cd97e25d918e692b0d6eac477c2966

Contents?: true

Size: 718 Bytes

Versions: 5

Compression:

Stored size: 718 Bytes

Contents

require 'pr/form'

describe 'the PR Form' do
  let(:form_klass) do
    Class.new do
      include PR::Form
    end
  end

  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
      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
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pr-0.0.6 spec/unit/pr/form_spec.rb
pr-0.0.5 spec/unit/pr/form_spec.rb
pr-0.0.4 spec/unit/pr/form_spec.rb
pr-0.0.3 spec/unit/pr/form_spec.rb
pr-0.0.2 spec/unit/pr/form_spec.rb