Skip to content

Commit

Permalink
moved client integration http tests
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermesilveira committed Aug 22, 2010
1 parent 48c3fa8 commit a6f1c9e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 34 deletions.
33 changes: 0 additions & 33 deletions spec/units/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,3 @@
Restfulie::Common::Logger.logger = ActiveSupport::BufferedLogger.new(File.join(File.dirname(__FILE__), "logs", "spec.log"))

ActionController::Base.view_paths = RAILS_ROOT + "/views"

module ResponseMatchers

class ResponseStatus

def initialize(response_code)
@expected_code = response_code.to_i
end

def matches?(response_header)
@actual_code = response_header[2].code
@expected_code == @actual_code
end

def failure_message
"expected response status to be #{@expected_code} but it's #{@actual_code}"
end

def negative_failure_message
"didn't expect #{@expected_code} to be #{@actual_code}"
end

end

def respond_with_status(response_code)
ResponseStatus.new(response_code)
end

end

Spec::Runner.configure do |config|
config.include(ResponseMatchers)
end
1 change: 1 addition & 0 deletions tests/spec/requests/_integration_client.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Those tests are integration tests (as in the server side) but full end-to-end tests, with code from the Restfulie client side.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/../../lib/data_helper')

context Restfulie::Client::HTTP::RequestMarshaller do

Expand Down
31 changes: 31 additions & 0 deletions tests/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,35 @@
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

module ResponseMatchers

class ResponseStatus

def initialize(response_code)
@expected_code = response_code.to_i
end

def matches?(response_header)
@actual_code = response_header[2].code
@expected_code == @actual_code
end

def failure_message
"expected response status to be #{@expected_code} but it's #{@actual_code}"
end

def negative_failure_message
"didn't expect #{@expected_code} to be #{@actual_code}"
end

end

def respond_with_status(response_code)
ResponseStatus.new(response_code)
end

end

RSpec.configure do |config|
# == Mock Framework
#
Expand All @@ -24,4 +53,6 @@
# examples within a transaction, comment the following line or assign false
# instead of true.
config.use_transactional_fixtures = true

config.include(ResponseMatchers)
end
File renamed without changes.

0 comments on commit a6f1c9e

Please sign in to comment.