Sha256: 166f2995348e7a1a187b62f74bcd34d3fbe4c4b31cebad3d62036dd2ca0bc6ed

Contents?: true

Size: 989 Bytes

Versions: 18

Compression:

Stored size: 989 Bytes

Contents

require 'spec_helper'

describe Resource::Property do
  describe "#initialize" do
    context "serializer" do
      context "when custom is provided" do
        subject do
          options = {type: Resource::Serialization::Boolean}
          Resource::Property.new(:haz_bool?, options)
        end

        it "configures custom" do
          subject.serializer.should == Resource::Serialization::Boolean
        end
      end

      context "when it isn't provided" do
        subject {Resource::Property.new(:login)}

        it "uses String serializer" do
          subject.serializer.should == Resource::Serialization::String
        end
      end
    end

    context "when values map is provided" do
      let(:values) {{paid: '01', unpaid: '02'}}

      subject do
        options = {values: values}
        Resource::Property.new(:payment_status, options)
      end

      it "configures values" do
        subject.translations.should == values.invert
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
transcriber-0.0.19 spec/unit/resource/key/property_spec.rb
transcriber-0.0.18 spec/unit/resource/key/property_spec.rb
transcriber-0.0.17 spec/unit/resource/key/property_spec.rb
transcriber-0.0.16 spec/unit/resource/key/property_spec.rb
transcriber-0.0.15 spec/unit/resource/key/property_spec.rb
transcriber-0.0.14 spec/unit/resource/key/property_spec.rb
transcriber-0.0.13 spec/unit/resource/key/property_spec.rb
transcriber-0.0.12 spec/unit/resource/key/property_spec.rb
transcriber-0.0.11 spec/unit/resource/key/property_spec.rb
transcriber-0.0.10 spec/unit/resource/key/property_spec.rb
transcriber-0.0.9 spec/unit/resource/key/property_spec.rb
transcriber-0.0.8 spec/unit/resource/key/property_spec.rb
transcriber-0.0.7 spec/unit/resource/key/property_spec.rb
transcriber-0.0.6 spec/unit/resource/key/property_spec.rb
transcriber-0.0.5 spec/unit/resource/key/property_spec.rb
transcriber-0.0.4 spec/unit/resource/key/property_spec.rb
transcriber-0.0.3 spec/unit/resource/key/property_spec.rb
transcriber-0.0.2 spec/unit/resource/key/property_spec.rb