Sha256: 0fb0862df4f413ec93068007f170b16cdf479dbdb84d7d577d93b79e816417d1
Contents?: true
Size: 1.68 KB
Versions: 9
Compression:
Stored size: 1.68 KB
Contents
require 'spec_helper' require 'pact_broker/repositories/tag_repository' module PactBroker module Repositories describe TagRepository do describe ".find" do let(:pacticipant_name) { "test_pacticipant" } let(:version_number) { "1.2.3" } let(:tag_name) { "prod" } subject { TagRepository.new } let(:options) { {pacticipant_name: pacticipant_name, pacticipant_version_number: version_number, tag_name: tag_name} } let(:find_tag) { subject.find options } let!(:provider_state_builder) do ProviderStateBuilder.new .create_pacticipant("wrong_pacticipant") .create_version(version_number) .create_tag(tag_name) #Tag with wrong pacticipant .create_pacticipant(pacticipant_name) .create_version("2.0.0") .create_tag(tag_name) # Tag with wrong version number .create_version(version_number) .create_tag("wrong tag") #Tag with wrong name end context "when the tag exists" do before do provider_state_builder.create_tag(tag_name) # Right tag! end it "returns the tag" do expect(find_tag.name).to eq tag_name expect(find_tag.version.number).to eq version_number expect(find_tag.version.pacticipant.name).to eq pacticipant_name expect(find_tag.created_at).to be_instance_of(DateTime) expect(find_tag.updated_at).to be_instance_of(DateTime) end end context "when the tag does not exist" do it "returns nil" do expect(find_tag).to be_nil end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems