Sha256: 265842e9ba0157490a4b5664f858c3eee07aafc5c414b066fe2b78e627353b11

Contents?: true

Size: 726 Bytes

Versions: 2

Compression:

Stored size: 726 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
      expect(PR::DefineAndRegister).to receive(:[]).with form_klass, name, type, {}
      form_klass.field name, type
    end
    it 'sets up field to define fields and passes in options' do
      expect(PR::DefineAndRegister).to receive(:[]).with form_klass, name, type, my: :option
      form_klass.field name, type, my: :option
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pr-1.0.0 spec/unit/pr/form_spec.rb
pr-0.0.7 spec/unit/pr/form_spec.rb