Sha256: 6dbf6bdd696100da01da48288d7e8bcc03d44739331570915d460e3e4e74cdcb

Contents?: true

Size: 752 Bytes

Versions: 1

Compression:

Stored size: 752 Bytes

Contents

require 'spec_helper'

describe Appsignal::Grape::Middleware do

  class TestAPI < Grape::API
    use Appsignal::Grape::Middleware
    get 'hello/:name' do
      "hello #{params['name']}"
    end
  end

  def app; TestAPI; end

  let(:event) { @events.pop }
  subject { event.payload }

  before(:all) do
    @events     = []
    ActiveSupport::Notifications.subscribe('process_action.grape') do |*args|
      @events << ActiveSupport::Notifications::Event.new(*args)
    end
  end

  before(:each) do
    get "/hello/mark"
  end

  it do
    should == { method: "GET" , path: "hello/:name"}
  end

  context "verify the api request" do
    subject{ last_response }

    its(:body){ should == "hello mark" }
    its(:status){ should == 200 }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grape-appsignal-0.0.3 spec/grape-appsignal/middleware_spec.rb