Skip to content

Commit

Permalink
Update Callbacks to latest RSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
oestrich committed May 22, 2014
1 parent bacdea6 commit df1e45a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions features/callbacks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ Feature: Document callbacks
example "Receiving a callback when interesting things happen" do
do_callback
request_method.should eq("POST")
request_headers["Content-Type"].should eq("application/json")
request_headers["User-Agent"].should eq("InterestingThingApp")
request_body.should eq('{"message":"Something interesting happened!"}')
expect(request_method).to eq("POST")
expect(request_headers["Content-Type"]).to eq("application/json")
expect(request_headers["User-Agent"]).to eq("InterestingThingApp")
expect(request_body).to eq('{"message":"Something interesting happened!"}')
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec_api_documentation/dsl/callback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def trigger_callback(&block)
end

def destination
@destination ||= RspecApiDocumentation::TestServer.new(self)
@destination ||= RspecApiDocumentation::TestServer.new(RSpec.current_example)
end

def callback_url
Expand Down
3 changes: 1 addition & 2 deletions lib/rspec_api_documentation/test_server.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
module RspecApiDocumentation
class TestServer < Struct.new(:context)
class TestServer < Struct.new(:example)
include Headers

delegate :example, :to => :context
delegate :metadata, :to => :example

attr_reader :request_method, :request_headers, :request_body
Expand Down

0 comments on commit df1e45a

Please sign in to comment.