Sha256: 89fcb85bb4a06ddc686b527272afdcec3e5146311b2215d70b5ee8d9c152d10e

Contents?: true

Size: 904 Bytes

Versions: 2

Compression:

Stored size: 904 Bytes

Contents

require 'pr/fields/generic_field'

describe 'a generic field' do
  let(:klass)   { PR::Fields::GenericField }
  let(:value)   { double "value" }
  let(:options) { Hash.new }
  let(:field)   { klass.new value, options }

  describe "default value" do
    specify { expect(klass.new.raw).to eq nil }
    specify { expect(klass.new.convert).to eq nil }
    specify { expect(klass.new.options).to eq({}) }
  end

  describe '#options' do
    it 'has retrievable options' do
      expect(field.options).to eq options
    end
  end

  describe :raw do
    it "should return the value the field was initialized with" do
      expect(field.raw).to eq(value)
    end
  end

  describe "#populate" do
    subject { field.populate value }
    specify { expect(field.raw).to eq(value) }
  end

  describe :convert do
    it "should return the raw value" do
      expect(field.convert).to eq(value)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pr-1.0.0 spec/unit/pr/fields/generic_field_spec.rb
pr-0.0.7 spec/unit/pr/fields/generic_field_spec.rb