Sha256: 372e3bc4f2a1eac48cfb57067003003117f5156a69f2795ab0c9ecb6b6b0c2cd

Contents?: true

Size: 871 Bytes

Versions: 5

Compression:

Stored size: 871 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
    subject { klass.new }

    its(:raw)     { should == nil }
    its(:convert) { should == nil }
    its(:options) { should == {} }
  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
      field.raw.should == value
    end
  end

  describe "#populate" do
    subject { field.populate value }
    specify { field.raw.should == value }
  end

  describe :convert do
    it "should return the raw value" do
      field.convert.should == value
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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