Sha256: 8262ac7256e38b23ca3040a8bdc334507e172858e27214f79965060b8591d172

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

# encoding: utf-8
require "spec_helper"

describe FastshopCatalog::ParticipantService do

  let(:contract_number) do
    "1234567890"
  end

  let(:participant) do
    ParticipantFactory.build
  end

  let(:service) do
    service = FastshopCatalog::ParticipantService.new
  end

  describe "insert integration", :integration => true do

    it "should insert the participant and return a null token" do
      response = service.insert(participant)
      expect(response).to eql(nil)
      # expect{service.insert(participant)}.to raise_error(FastshopCatalog::ServiceException) do |e|
      #   expect(e.code).to eq(45)
      #   expect(e.description).to eq('Email já cadastrado')
      # end
    end

    it "should raise incompatible address exception" do
      participant.address.neighborhood = 'Moema'
      expect{service.insert(participant)}.to raise_error(FastshopCatalog::ServiceException) do |e|
        expect(e.code).to eq(2)
        expect(e.description).to eq('Contrato invalido')
      end
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fastshop_catalog-0.0.8 spec/fastshop_catalog/integration/participant_service_integration_spec.rb
fastshop_catalog-0.0.7 spec/fastshop_catalog/integration/participant_service_integration_spec.rb
fastshop_catalog-0.0.6 spec/fastshop_catalog/integration/participant_service_integration_spec.rb