Sha256: 9eca684e0ad0e7aee21c8946331ed1ea63da7b54df807db5a8f313ee7c67287b

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

RSpec.describe ComposedValidations::ValidatedProperty do
  subject { described_class.new(:validated_property, :property_accessor) }
  describe "#validated_property" do
    it "should return the validated property" do
      expect(subject.validated_property).to eq :validated_property
    end
  end
  describe "#property_accessor" do
    it "should return the property accessor" do
      expect(subject.property_accessor).to eq :property_accessor
    end
  end

  describe "Caster" do
    subject { ComposedValidations::ValidatedProperty(value) }
    context "when given a string" do
      let(:value) { "test" }
      it "should return with both attributes set to its symbol" do
        expect(subject.validated_property).to eq :test
        expect(subject.property_accessor).to eq :test
      end
    end
    context "when given a validated property" do
      let(:value) { described_class.new(:test, :test2) }
      it "should return it back" do
        expect(subject).to eq value
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
composed_validations-0.0.3 spec/composed_validations/validated_property_spec.rb
composed_validations-0.0.2 spec/composed_validations/validated_property_spec.rb
composed_validations-0.0.1 spec/composed_validations/validated_property_spec.rb