Sha256: 8043200cbcdf4a59a3cf82dcc38a40117e9c46b3abd643099afd7f8d201a88cc

Contents?: true

Size: 989 Bytes

Versions: 5

Compression:

Stored size: 989 Bytes

Contents

require 'spec_helper'

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

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

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

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

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rest_model-0.1.4 spec/unit/key/property_spec.rb
rest_model-0.1.3 spec/unit/key/property_spec.rb
rest_model-0.1.2 spec/unit/key/property_spec.rb
rest_model-0.1.1 spec/unit/key/property_spec.rb
rest_model-0.1.0 spec/unit/key/property_spec.rb