Sha256: 5f01869c8237f5f47288a860852cdaab549c2d177a232b5bb8d8c601b26f5824

Contents?: true

Size: 982 Bytes

Versions: 7

Compression:

Stored size: 982 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
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
transcriber-0.0.26 spec/unit/resource/key/property_spec.rb
transcriber-0.0.25 spec/unit/resource/key/property_spec.rb
transcriber-0.0.24 spec/unit/resource/key/property_spec.rb
transcriber-0.0.23 spec/unit/resource/key/property_spec.rb
transcriber-0.0.22 spec/unit/resource/key/property_spec.rb
transcriber-0.0.21 spec/unit/resource/key/property_spec.rb
transcriber-0.0.20 spec/unit/resource/key/property_spec.rb