Sha256: 6f61b36930d9655ef7145bf656fb227731d3e2b11f6367d5d9b6953739b8e3d0

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require "spec_helper"

describe RSpec::ExpectIt::ExpectationTargets::ExpectIt do
  let(:context) do
    double("context").tap do |context|
      context.stub(:expect) {|arg| expect(arg) }
      context.stub(:subject) { context_subject }
    end
  end

  let(:passed_subject) { nil }

  subject { RSpec::ExpectIt::ExpectationTargets::ExpectIt.new(context, passed_subject) }

  describe "#to" do
    context "when the subject is passed" do
      let(:passed_subject) { Object.new }

      specify { subject.to eq passed_subject }
    end

    context "when the subject is not passed" do
      let(:context_subject) { Object.new }

      specify { subject.to eq context_subject }
    end
  end

  describe "#not_to" do
    context "when the subject is passed" do
      let(:passed_subject) { Object.new }

      specify { expect{ subject.to_not eq passed_subject }.to raise_error(RSpec::Expectations::ExpectationNotMetError) }
    end

    context "when the subject is not passed" do
      let(:context_subject) { Object.new }

      specify { expect{ subject.to_not eq context_subject }.to raise_error(RSpec::Expectations::ExpectationNotMetError) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-expect_it-2.0.0 spec/rspec/expect_it/expectation_targets/expect_it_spec.rb