Sha256: e4eb562e74214f7715c8f433129c2014147b1ac974adcd49075eba35300119c2

Contents?: true

Size: 1.21 KB

Versions: 12

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe VerifiedDouble::MethodSignature::ClassValue do
  subject { described_class.new(String) }

  describe "#belongs_to?(other)" do
    context "where the value and other have the same content" do
      let(:other) { described_class.new(String) }
      it { expect(subject.belongs_to?(other)).to be_true }
    end

    context "where the value and other do not have the same content" do
      let(:other) { described_class.new(Float) }
      it { expect(subject.belongs_to?(other)).to be_false }
    end

    context "where the other is a Class" do
      let(:other) { described_class.new(Class) }
      it { expect(subject.belongs_to?(other)).to be_true }
    end
  end

  describe "#content_as_instance" do
    context "where the value is a class which can be initialized" do
      subject { described_class.new(String) }

      it "returns the initialized instance of the value " do
        expect(subject.content_as_instance).to eq(String.new)
      end
    end

    context "where the value is a class which cannot be initialized" do
      subject { described_class.new(Integer) }

      it "returns an object" do
        expect(subject.content_as_instance).to be_an(Object)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
verified_double-0.8.1 spec/verified_double/method_signature/class_value_spec.rb
verified_double-0.8.0 spec/verified_double/method_signature/class_value_spec.rb
verified_double-0.7.0 spec/verified_double/method_signature/class_value_spec.rb
verified_double-0.6.1 spec/verified_double/method_signature/class_value_spec.rb
verified_double-0.6 spec/verified_double/method_signature/class_value_spec.rb
verified_double-0.5.3 spec/verified_double/method_signature/class_value_spec.rb
verified_double-0.5.2 spec/verified_double/method_signature/class_value_spec.rb
verified_double-0.5.1 spec/verified_double/method_signature/class_value_spec.rb
verified_double-0.5.0 spec/verified_double/method_signature/class_value_spec.rb
verified_double-0.4.3 spec/verified_double/method_signature/class_value_spec.rb
verified_double-0.4.2 spec/verified_double/method_signature/class_value_spec.rb
verified_double-0.4.1 spec/verified_double/method_signature/class_value_spec.rb