Skip to content

Commit

Permalink
Moved RequestProfile specific code to RequestProfile class
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartosz Blimke committed Jan 30, 2010
1 parent 39b2dbb commit 7580450
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/webmock/request.rb
@@ -1,7 +1,7 @@
module WebMock

class Request
attr_accessor :method, :uri, :body, :headers, :with_block
attr_accessor :method, :uri, :body, :headers

def initialize(method, uri, options = {})
self.method = method
Expand All @@ -15,7 +15,6 @@ def to_s
if headers && !headers.empty?
string << " with headers #{WebMock::Util::Headers.normalize_headers(headers).inspect.gsub("\"","'")}"
end
string << " with given block" if with_block
string
end

Expand Down
10 changes: 9 additions & 1 deletion lib/webmock/request_profile.rb
@@ -1,16 +1,24 @@
module WebMock

class RequestProfile < Request

attr_reader :with_block

def with(options = {}, &block)
assign_options(options)
self.with_block = block
@with_block = block
self
end

def body=(body)
@body = Body.new(body)
end

def to_s
string = super
string << " with given block" if @with_block
string
end

class Body

Expand Down

0 comments on commit 7580450

Please sign in to comment.