Sha256: 8cefc9c621c90107c93bf8f16a564a4ee3218eeb32597a022f1fb5ea30d89a0f

Contents?: true

Size: 1.41 KB

Versions: 173

Compression:

Stored size: 1.41 KB

Contents

describe Appsignal::Marker do
  let(:config) { project_fixture_config }
  let(:marker) do
    described_class.new(
      {
        :revision => "503ce0923ed177a3ce000005",
        :repository => "master",
        :user => "batman",
        :rails_env => "production"
      },
      config
    )
  end
  let(:out_stream) { std_stream }
  let(:output) { out_stream.read }

  describe "#transmit" do
    def stub_marker_request
      stub_api_request config, "markers", marker.marker_data
    end

    def run
      capture_stdout(out_stream) { marker.transmit }
    end

    context "when request is valid" do
      before { stub_marker_request.to_return(:status => 200) }

      it "outputs success" do
        run
        expect(output).to include \
          "Notifying AppSignal of deploy with: revision: 503ce0923ed177a3ce000005, user: batman",
          "AppSignal has been notified of this deploy!"
      end
    end

    context "when request is invalid" do
      before { stub_marker_request.to_return(:status => 500) }

      it "outputs failure" do
        run
        expect(output).to include \
          "Notifying AppSignal of deploy with: revision: 503ce0923ed177a3ce000005, user: batman",
          "Something went wrong while trying to notify AppSignal: 500 at "\
          "#{config[:endpoint]}/1/markers"
        expect(output).to_not include \
          "AppSignal has been notified of this deploy!"
      end
    end
  end
end

Version data entries

173 entries across 173 versions & 1 rubygems

Version Path
appsignal-2.11.0.beta.4 spec/lib/appsignal/marker_spec.rb
appsignal-2.11.0.beta.4-java spec/lib/appsignal/marker_spec.rb
appsignal-2.11.0.beta.3 spec/lib/appsignal/marker_spec.rb
appsignal-2.11.0.beta.3-java spec/lib/appsignal/marker_spec.rb
appsignal-2.10.10 spec/lib/appsignal/marker_spec.rb
appsignal-2.10.10-java spec/lib/appsignal/marker_spec.rb
appsignal-2.11.0.beta.2 spec/lib/appsignal/marker_spec.rb
appsignal-2.11.0.beta.2-java spec/lib/appsignal/marker_spec.rb
appsignal-2.11.0.beta.1-java spec/lib/appsignal/marker_spec.rb
appsignal-2.11.0.beta.1 spec/lib/appsignal/marker_spec.rb
appsignal-2.11.0.alpha.2 spec/lib/appsignal/marker_spec.rb
appsignal-2.11.0.alpha.2-java spec/lib/appsignal/marker_spec.rb
appsignal-2.11.0.alpha.1 spec/lib/appsignal/marker_spec.rb
appsignal-2.11.0.alpha.1-java spec/lib/appsignal/marker_spec.rb
appsignal-2.10.9 spec/lib/appsignal/marker_spec.rb
appsignal-2.10.9-java spec/lib/appsignal/marker_spec.rb
appsignal-2.10.9.beta.1-java spec/lib/appsignal/marker_spec.rb
appsignal-2.10.9.beta.1 spec/lib/appsignal/marker_spec.rb
appsignal-2.10.8 spec/lib/appsignal/marker_spec.rb
appsignal-2.10.8-java spec/lib/appsignal/marker_spec.rb