webrat 0.4.5 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,13 @@
1
+ == 0.5.0 / 2009-08-12
2
+
3
+ * Major enhancements
4
+
5
+ * Depreacate :rack_test and :sinatra in favor of :rack, which uses Rack::Test (Simon Rozet)
6
+
7
+ * Minor enhancements
8
+
9
+ * Don't require rubygems at runtime (Simon Rozet)
10
+
1
11
  == 0.4.5 / 2009-08-10
2
12
 
3
13
  * Major enhancements
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.5
1
+ 0.5.0
data/lib/webrat.rb CHANGED
@@ -1,29 +1,9 @@
1
- require "rubygems"
2
-
3
- $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
4
-
5
1
  module Webrat
6
2
  # The common base class for all exceptions raised by Webrat.
7
3
  class WebratError < StandardError
8
4
  end
9
-
10
- def self.require_xml
11
- if on_java?
12
- gem "nokogiri", ">= 1.2.4"
13
- else
14
- gem "nokogiri", ">= 1.0.6"
15
- end
16
-
17
- require "nokogiri"
18
- require "webrat/core/xml/nokogiri"
19
- end
20
-
21
- def self.on_java?
22
- RUBY_PLATFORM =~ /java/
23
- end
24
-
25
5
  end
26
6
 
27
- Webrat.require_xml
28
-
7
+ require "nokogiri"
8
+ require "webrat/core/xml/nokogiri"
29
9
  require "webrat/core"
@@ -87,10 +87,8 @@ module Webrat
87
87
  parse_rails_request_params("#{name}=#{escaped_value}")
88
88
  when :merb
89
89
  ::Merb::Parse.query("#{name}=#{escaped_value}")
90
- when :mechanize
91
- { name => value }
92
90
  else
93
- { name => escaped_value }
91
+ { name => value }
94
92
  end
95
93
  end
96
94
 
@@ -16,11 +16,11 @@ module Webrat
16
16
  end
17
17
 
18
18
  def webrat_session
19
- if Webrat.configuration.mode == :rack_test
20
- @_webrat_session ||= ::Webrat::RackTestSession.new(rack_test_session)
21
- else
22
- @_webrat_session ||= ::Webrat.session_class.new(self)
23
- end
19
+ @_webrat_session ||= ::Webrat::Session.new(webrat_adapter)
20
+ end
21
+
22
+ def webrat_adapter
23
+ @_webrat_adapter ||= Webrat.session_class.new(self)
24
24
  end
25
25
 
26
26
  # all of these methods delegate to the @session, which should
@@ -18,16 +18,21 @@ module Webrat
18
18
  RailsSession
19
19
  when :merb
20
20
  MerbSession
21
- when :selenium
22
- SeleniumSession
23
21
  when :rack
24
22
  RackSession
23
+ when :rack_test
24
+ warn("The :rack_test mode is deprecated. Please use :rack instead")
25
+ require "webrat/rack"
26
+ RackSession
27
+ when :sinatra
28
+ warn("The :sinatra mode is deprecated. Please use :rack instead")
29
+ SinatraSession
30
+ when :selenium
31
+ SeleniumSession
25
32
  when :sinatra
26
33
  SinatraSession
27
34
  when :mechanize
28
35
  MechanizeSession
29
- when :rack_test
30
- RackTestSession
31
36
  else
32
37
  raise WebratError.new(<<-STR)
33
38
  Unknown Webrat mode: #{Webrat.configuration.mode.inspect}
@@ -53,12 +58,16 @@ For example:
53
58
  attr_reader :current_url
54
59
  attr_reader :elements
55
60
 
56
- def initialize(context = nil) #:nodoc:
61
+ def_delegators :@adapter, :response, :response_code, :response_body,
62
+ :response_body=, :response_code=,
63
+ :get, :post, :put, :delete
64
+
65
+ def initialize(adapter=nil)
57
66
  @http_method = :get
58
67
  @data = {}
59
68
  @default_headers = {}
60
69
  @custom_headers = {}
61
- @context = context
70
+ @adapter = adapter
62
71
 
63
72
  reset
64
73
  end
@@ -3,7 +3,7 @@ require "merb-core"
3
3
  require "webrat/merb_multipart_support"
4
4
 
5
5
  module Webrat
6
- class MerbSession < Session #:nodoc:
6
+ class MerbSession #:nodoc:
7
7
  include Merb::Test::MakeRequest
8
8
 
9
9
  # Include Webrat's own version of multipart_post/put because the officially
@@ -12,6 +12,8 @@ module Webrat
12
12
 
13
13
  attr_accessor :response
14
14
 
15
+ def initialize(context=nil); end
16
+
15
17
  def get(url, data, headers = nil)
16
18
  do_request(url, data, headers, "GET")
17
19
  end
data/lib/webrat/rack.rb CHANGED
@@ -1,24 +1,25 @@
1
- require 'webrat'
1
+ require "rack/test"
2
2
 
3
- class CGIMethods #:nodoc:
4
- def self.parse_query_parameters(params)
5
- hash = {}
6
- params.split('&').each do |p|
7
- pair = p.split('=')
8
- hash[pair[0]] = pair[1]
3
+ module Webrat
4
+ class RackSession
5
+ extend Forwardable
6
+
7
+ def_delegators :@session, :get, :post, :put, :delete
8
+
9
+ def initialize(session) #:nodoc:
10
+ @session = session
9
11
  end
10
- hash
11
- end
12
- end
13
12
 
14
- module Webrat
15
- class RackSession < Session #:nodoc:
16
13
  def response_body
17
- @response.body
14
+ response.body
18
15
  end
19
16
 
20
17
  def response_code
21
- @response.status
18
+ response.status
19
+ end
20
+
21
+ def response
22
+ @session.last_response
22
23
  end
23
24
  end
24
25
  end
data/lib/webrat/rails.rb CHANGED
@@ -5,9 +5,15 @@ require "action_controller/integration"
5
5
  require "action_controller/record_identifier"
6
6
 
7
7
  module Webrat
8
- class RailsSession < Session #:nodoc:
8
+ class RailsSession #:nodoc:
9
9
  include ActionController::RecordIdentifier
10
10
 
11
+ attr_reader :integration_session
12
+
13
+ def initialize(session)
14
+ @integration_session = session
15
+ end
16
+
11
17
  # The Rails version of within supports passing in a model and Webrat
12
18
  # will apply a scope based on Rails' dom_id for that model.
13
19
  #
@@ -61,10 +67,6 @@ module Webrat
61
67
 
62
68
  protected
63
69
 
64
- def integration_session
65
- @context
66
- end
67
-
68
70
  def do_request(http_method, url, data, headers) #:nodoc:
69
71
  update_protocol(url)
70
72
  integration_session.send(http_method, normalize_url(url), data, headers)
@@ -93,7 +95,6 @@ module Webrat
93
95
  def response #:nodoc:
94
96
  integration_session.response
95
97
  end
96
-
97
98
  end
98
99
  end
99
100
 
@@ -1,5 +1,4 @@
1
1
  require "webrat"
2
- gem "selenium-client", ">=1.2.16"
3
2
  require "selenium/client"
4
3
  require "webrat/selenium/silence_stream"
5
4
  require "webrat/selenium/selenium_session"
@@ -1,44 +1,11 @@
1
1
  require "webrat/rack"
2
- require "sinatra/test"
3
2
 
4
3
  module Webrat
5
4
  class SinatraSession < RackSession
6
- include Sinatra::Test
7
-
8
- attr_reader :request, :response
9
-
10
- def initialize(context = nil)
11
- super(context)
12
-
5
+ def initialize(context)
13
6
  app = context.respond_to?(:app) ? context.app : Sinatra::Application
14
- @browser = Sinatra::TestHarness.new(app)
15
- end
16
-
17
- %w(get head post put delete).each do |verb|
18
- class_eval <<-RUBY
19
- def #{verb}(path, data, headers = {})
20
- params = data.inject({}) do |data, (key,value)|
21
- data[key] = Rack::Utils.unescape(value)
22
- data
23
- end
24
- headers["HTTP_HOST"] = "www.example.com"
25
- @browser.#{verb}(path, params, headers)
26
- end
27
- RUBY
28
- end
29
-
30
- def response_body
31
- @browser.body
32
- end
33
7
 
34
- def response_code
35
- @browser.status
8
+ super(Rack::Test::Session.new(Rack::MockSession.new(app, "www.example.com")))
36
9
  end
37
-
38
- private
39
-
40
- def response
41
- @browser.response
42
- end
43
10
  end
44
11
  end
@@ -0,0 +1,73 @@
1
+ require "rubygems"
2
+ require "sinatra/base"
3
+
4
+ class RackApp < Sinatra::Base
5
+ use_in_file_templates!
6
+
7
+ get "/" do
8
+ erb :home
9
+ end
10
+
11
+ get "/go" do
12
+ erb :go
13
+ end
14
+
15
+ get "/internal_redirect" do
16
+ redirect "/"
17
+ end
18
+
19
+ get "/external_redirect" do
20
+ redirect "http://google.com"
21
+ end
22
+
23
+ get "/absolute_redirect" do
24
+ redirect URI.join(request.url, "foo").to_s
25
+ end
26
+
27
+ get "/foo" do
28
+ "spam"
29
+ end
30
+
31
+ post "/go" do
32
+ @user = params[:name]
33
+ @email = params[:email]
34
+ erb :hello
35
+ end
36
+ end
37
+
38
+ __END__
39
+ @@ layout
40
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
41
+ <html>
42
+ <title>sinatra testing with webrat</title>
43
+ <body>
44
+ <%= yield %>
45
+ </body>
46
+ </html>
47
+
48
+ @@ home
49
+ <p> visit <a href="/go">there</a></p>
50
+
51
+ <form>
52
+ <label>
53
+ Prefilled
54
+ <input type="text" name="prefilled" value="text" />
55
+ </label>
56
+ </form>
57
+
58
+ @@ go
59
+ <form method="post" action="/go">
60
+ <div>
61
+ <label for="name">Name</label>
62
+ <input type="text" name="name" id="name">
63
+ </div>
64
+ <div>
65
+ <label for="email">Email</label>
66
+ <input type="text" name="email" id="email">
67
+ </div>
68
+ <input type="submit" value="Submit" />
69
+ </form>
70
+
71
+ @@ hello
72
+ <p>Hello, <%= @user %></p>
73
+ <p>Your email is: <%= @email %></p>
@@ -4,17 +4,17 @@ require "rack/test"
4
4
  # require "redgreen"
5
5
 
6
6
  require File.dirname(__FILE__) + "/../../../../lib/webrat"
7
+ require File.dirname(__FILE__) + "/../app"
7
8
 
8
9
  Webrat.configure do |config|
9
- config.mode = :rack_test
10
+ config.mode = :rack
10
11
  end
11
12
 
12
13
  class Test::Unit::TestCase
13
- include Rack::Test::Methods
14
- include Webrat::Methods
15
- include Webrat::Matchers
16
-
17
14
  def app
18
- RackApp.new
15
+ Rack::Builder.new {
16
+ use Rack::Lint
17
+ run RackApp.new
18
+ }
19
19
  end
20
20
  end
@@ -1,67 +1,62 @@
1
- require File.dirname(__FILE__) + "/test_helper"
2
- require File.dirname(__FILE__) + "/../rack_app"
1
+ require File.dirname(__FILE__) + "/helper"
3
2
 
4
3
  class WebratRackTest < Test::Unit::TestCase
5
- def test_visit_returns_response
6
- response = visit "/"
7
- assert response.ok?
4
+ include Rack::Test::Methods
5
+ include Webrat::Methods
6
+ include Webrat::Matchers
7
+ include Webrat::HaveTagMatcher
8
+
9
+ def build_rack_mock_session
10
+ Rack::MockSession.new(app, "www.example.com")
8
11
  end
9
12
 
10
- def test_last_response_is_available
11
- visit "/"
12
- assert last_response.ok?
13
+ def test_visits_pages
14
+ visit "/"
15
+ click_link "there"
16
+
17
+ assert_have_tag("form[@method='post'][@action='/go']")
18
+ end
19
+
20
+ def test_submits_form
21
+ visit "/go"
22
+ fill_in "Name", :with => "World"
23
+ fill_in "Email", :with => "world@example.org"
24
+ click_button "Submit"
25
+
26
+ assert_contain "Hello, World"
27
+ assert_contain "Your email is: world@example.org"
13
28
  end
14
29
 
15
- def test_last_request_is_available
30
+ def test_check_value_of_field
16
31
  visit "/"
17
- assert_equal "/", last_request.env["PATH_INFO"]
32
+ assert_equal field_labeled("Prefilled").value, "text"
18
33
  end
19
34
 
20
- # def test_redirects
21
- # visit "/redirect_absolute_url"
22
- # assert_equal "spam", response_body
23
- # end
35
+ def test_follows_internal_redirects
36
+ visit "/internal_redirect"
37
+ assert_contain "visit"
38
+ end
24
39
 
25
- def test_assertions_after_visit
26
- visit "/"
27
- assert_contain "Hello World"
40
+ def test_does_not_follow_external_redirects
41
+ visit "/external_redirect"
42
+ assert last_response.redirect?
28
43
  end
29
44
 
30
- def test_assertions_after_visit
31
- get "/"
32
- assert_contain "Hello World"
45
+ def test_absolute_url_redirect
46
+ visit "/absolute_redirect"
47
+ assert_contain "spam"
33
48
  end
49
+ end
34
50
 
35
- # def test_visits_pages
36
- # visit "/"
37
- # assert response_body.include?("visit")
38
- #
39
- # click_link "there"
40
- # assert response_body.include?('<form method="post" action="/go">')
41
- # end
42
- #
43
- # def test_submits_form
44
- # visit "/go"
45
- # fill_in "Name", :with => "World"
46
- # fill_in "Email", :with => "world@example.org"
47
- # click_button "Submit"
48
- #
49
- # assert response_body.include?("Hello, World")
50
- # assert response_body.include?("Your email is: world@example.org")
51
- # end
52
- #
53
- # def test_check_value_of_field
54
- # visit "/"
55
- # assert field_labeled("Prefilled").value, "text"
56
- # end
57
- #
58
- # def test_follows_internal_redirects
59
- # visit "/internal_redirect"
60
- # assert response_body.include?("visit")
61
- # end
62
- #
63
- # def test_does_not_follow_external_redirects
64
- # visit "/external_redirect"
65
- # assert response_code == 302
66
- # end
51
+ class WebratRackSetupTest < Test::Unit::TestCase
52
+ def test_usable_without_mixin
53
+ rack_test_session = Rack::Test::Session.new(Rack::MockSession.new(app))
54
+ adapter = Webrat::RackSession.new(rack_test_session)
55
+ session = Webrat::Session.new(adapter)
56
+
57
+ session.visit "/foo"
58
+
59
+ assert_equal "spam", session.response_body
60
+ assert_equal "spam", rack_test_session.last_response.body
61
+ end
67
62
  end
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
2
2
 
3
3
  module Webrat
4
4
  describe Field do
5
- unless Webrat.on_java?
5
+ unless RUBY_PLATFORM =~ /java/
6
6
  it "should have nice inspect output" do
7
7
  html = <<-HTML
8
8
  <html>
@@ -87,6 +87,8 @@ describe Webrat::RailsSession do
87
87
  end
88
88
 
89
89
  it "should accept an ActiveRecord argument to #within and translate to a selector using dom_id" do
90
+ pending "Move this to spec/public/within_spec.rb"
91
+
90
92
  body = <<-HTML
91
93
  <a href="/page1">Edit</a>
92
94
  <div id="new_object">
@@ -56,13 +56,13 @@ describe "contain" do
56
56
  it "should throw an exception when the body doesnt contain the text" do
57
57
  lambda {
58
58
  assert_contain("monkeys")
59
- }.should raise_error(Test::Unit::AssertionFailedError)
59
+ }.should raise_error(AssertionFailedError)
60
60
  end
61
61
 
62
62
  it "should throw an exception when the body doesnt contain the regexp" do
63
63
  lambda {
64
64
  assert_contain(/monkeys/)
65
- }.should raise_error(Test::Unit::AssertionFailedError)
65
+ }.should raise_error(AssertionFailedError)
66
66
  end
67
67
  end
68
68
 
@@ -78,13 +78,13 @@ describe "contain" do
78
78
  it "should throw an exception when the body does contain the text" do
79
79
  lambda {
80
80
  assert_not_contain("hello, world")
81
- }.should raise_error(Test::Unit::AssertionFailedError)
81
+ }.should raise_error(AssertionFailedError)
82
82
  end
83
83
 
84
84
  it "should throw an exception when the body does contain the regexp" do
85
85
  lambda {
86
86
  assert_not_contain(/hello, world/)
87
- }.should raise_error(Test::Unit::AssertionFailedError)
87
+ }.should raise_error(AssertionFailedError)
88
88
  end
89
89
  end
90
90
  end
@@ -122,7 +122,7 @@ describe "have_selector" do
122
122
  it "should throw an exception when the body doesnt have matching selection" do
123
123
  lambda {
124
124
  assert_have_selector("p")
125
- }.should raise_error(Test::Unit::AssertionFailedError)
125
+ }.should raise_error(AssertionFailedError)
126
126
  end
127
127
  end
128
128
 
@@ -134,7 +134,7 @@ describe "have_selector" do
134
134
  it "should throw an exception when the body does contain the selection" do
135
135
  lambda {
136
136
  assert_have_no_selector("div")
137
- }.should raise_error(Test::Unit::AssertionFailedError)
137
+ }.should raise_error(AssertionFailedError)
138
138
  end
139
139
  end
140
140
  end
@@ -117,7 +117,7 @@ describe "have_xpath" do
117
117
  it "should throw an exception when the body doesnt have matching xpath" do
118
118
  lambda {
119
119
  assert_have_xpath("//p")
120
- }.should raise_error(Test::Unit::AssertionFailedError)
120
+ }.should raise_error(AssertionFailedError)
121
121
  end
122
122
  end
123
123
 
@@ -129,7 +129,7 @@ describe "have_xpath" do
129
129
  it "should throw an exception when the body does contain the xpath" do
130
130
  lambda {
131
131
  assert_have_no_xpath("//div")
132
- }.should raise_error(Test::Unit::AssertionFailedError)
132
+ }.should raise_error(AssertionFailedError)
133
133
  end
134
134
  end
135
135
  end
data/spec/spec_helper.rb CHANGED
@@ -8,6 +8,8 @@ begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end
8
8
  webrat_path = File.expand_path(File.dirname(__FILE__) + "/../lib/")
9
9
  $LOAD_PATH.unshift(webrat_path) unless $LOAD_PATH.include?(webrat_path)
10
10
 
11
+ AssertionFailedError = Test::Unit::AssertionFailedError rescue MiniTest::Assertion # ruby1.9 compat
12
+
11
13
  require "webrat"
12
14
  require File.expand_path(File.dirname(__FILE__) + "/fakes/test_session")
13
15
 
data/webrat.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{webrat}
8
- s.version = "0.4.5"
8
+ s.version = "0.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bryan Helmkamp"]
12
- s.date = %q{2009-08-10}
12
+ s.date = %q{2009-08-12}
13
13
  s.email = %q{bryan@brynary.com}
14
14
  s.extra_rdoc_files = [
15
15
  "History.txt",
@@ -73,7 +73,6 @@ Gem::Specification.new do |s|
73
73
  "lib/webrat/merb_multipart_support.rb",
74
74
  "lib/webrat/merb_session.rb",
75
75
  "lib/webrat/rack.rb",
76
- "lib/webrat/rack_test.rb",
77
76
  "lib/webrat/rails.rb",
78
77
  "lib/webrat/rspec-rails.rb",
79
78
  "lib/webrat/selenium.rb",
@@ -127,8 +126,8 @@ Gem::Specification.new do |s|
127
126
  "spec/integration/merb/tasks/merb.thor/ops.rb",
128
127
  "spec/integration/merb/tasks/merb.thor/utils.rb",
129
128
  "spec/integration/rack/Rakefile",
130
- "spec/integration/rack/rack_app.rb",
131
- "spec/integration/rack/test/test_helper.rb",
129
+ "spec/integration/rack/app.rb",
130
+ "spec/integration/rack/test/helper.rb",
132
131
  "spec/integration/rack/test/webrat_rack_test.rb",
133
132
  "spec/integration/rails/.gitignore",
134
133
  "spec/integration/rails/Rakefile",
@@ -253,8 +252,8 @@ Gem::Specification.new do |s|
253
252
  "spec/integration/merb/tasks/merb.thor/gem_ext.rb",
254
253
  "spec/integration/merb/tasks/merb.thor/ops.rb",
255
254
  "spec/integration/merb/tasks/merb.thor/utils.rb",
256
- "spec/integration/rack/rack_app.rb",
257
- "spec/integration/rack/test/test_helper.rb",
255
+ "spec/integration/rack/app.rb",
256
+ "spec/integration/rack/test/helper.rb",
258
257
  "spec/integration/rack/test/webrat_rack_test.rb",
259
258
  "spec/integration/rails/app/controllers/application.rb",
260
259
  "spec/integration/rails/app/controllers/buttons_controller.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webrat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Helmkamp
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-10 00:00:00 -04:00
12
+ date: 2009-08-12 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -89,7 +89,6 @@ files:
89
89
  - lib/webrat/merb_multipart_support.rb
90
90
  - lib/webrat/merb_session.rb
91
91
  - lib/webrat/rack.rb
92
- - lib/webrat/rack_test.rb
93
92
  - lib/webrat/rails.rb
94
93
  - lib/webrat/rspec-rails.rb
95
94
  - lib/webrat/selenium.rb
@@ -143,8 +142,8 @@ files:
143
142
  - spec/integration/merb/tasks/merb.thor/ops.rb
144
143
  - spec/integration/merb/tasks/merb.thor/utils.rb
145
144
  - spec/integration/rack/Rakefile
146
- - spec/integration/rack/rack_app.rb
147
- - spec/integration/rack/test/test_helper.rb
145
+ - spec/integration/rack/app.rb
146
+ - spec/integration/rack/test/helper.rb
148
147
  - spec/integration/rack/test/webrat_rack_test.rb
149
148
  - spec/integration/rails/.gitignore
150
149
  - spec/integration/rails/Rakefile
@@ -290,8 +289,8 @@ test_files:
290
289
  - spec/integration/merb/tasks/merb.thor/gem_ext.rb
291
290
  - spec/integration/merb/tasks/merb.thor/ops.rb
292
291
  - spec/integration/merb/tasks/merb.thor/utils.rb
293
- - spec/integration/rack/rack_app.rb
294
- - spec/integration/rack/test/test_helper.rb
292
+ - spec/integration/rack/app.rb
293
+ - spec/integration/rack/test/helper.rb
295
294
  - spec/integration/rack/test/webrat_rack_test.rb
296
295
  - spec/integration/rails/app/controllers/application.rb
297
296
  - spec/integration/rails/app/controllers/buttons_controller.rb
@@ -1,32 +0,0 @@
1
- module Webrat
2
- class RackTestSession < Session
3
-
4
- def initialize(rack_test_session) #:nodoc:
5
- super()
6
- @rack_test_session = rack_test_session
7
- end
8
-
9
- def response_body
10
- response.body
11
- end
12
-
13
- def response_code
14
- response.status
15
- end
16
-
17
- def response
18
- @rack_test_session.last_response
19
- end
20
-
21
- protected
22
-
23
- def process_request(http_method, url, data = {}, headers = {})
24
- headers ||= {}
25
- data ||= {}
26
-
27
- env = headers.merge(:params => data, :method => http_method.to_s.upcase)
28
- @rack_test_session.request(url, env)
29
- end
30
-
31
- end
32
- end
@@ -1,16 +0,0 @@
1
- require "rubygems"
2
- require "sinatra/base"
3
-
4
- class RackApp < Sinatra::Default
5
- get "/" do
6
- "Hello World"
7
- end
8
-
9
- get "/redirect_absolute_url" do
10
- redirect URI.join(request.url, "foo").to_s
11
- end
12
-
13
- get "/foo" do
14
- "spam"
15
- end
16
- end