merb-core 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -149,6 +149,7 @@ module Merb
149
149
  def self.start(opts={})
150
150
  m = Merb::Rack::Console.new
151
151
  m.extend Merb::Test::RequestHelper
152
+ m.extend ::Webrat::Methods if defined?(::Webrat)
152
153
  Object.send(:define_method, :merb) { m }
153
154
  ARGV.clear # Avoid passing args to IRB
154
155
  m.open_sandbox! if sandboxed?
@@ -13,7 +13,8 @@ module Merb
13
13
 
14
14
  if (@opts[:socket] || @opts[:socket_file])
15
15
  socket = port.to_s
16
- socket_file = @opts[:socket_file] || "#{Merb.log_path}/#{Merb::Config[:name]}.#{socket}.sock"
16
+ socket_file = @opts[:socket_file] || "#{Merb.log_path}/#{Merb::Config[:name]}.%s.sock"
17
+ socket_file = socket_file % port
17
18
  Merb.logger.warn!("Using Thin adapter with socket file #{socket_file}.")
18
19
  @server = ::Thin::Server.new(socket_file, @opts[:app], @opts)
19
20
  else
@@ -7,7 +7,9 @@ require "merb-core/test/matchers/request_matchers"
7
7
  Merb::Test::ControllerHelper.send(:include, Merb::Test::Rspec::ControllerMatchers)
8
8
  Merb::Test::RouteHelper.send(:include, Merb::Test::Rspec::RouteMatchers)
9
9
 
10
- module Merb::Test::ViewHelper
11
- include ::Webrat::Matchers
12
- include ::Webrat::HaveTagMatcher
13
- end
10
+ if defined?(::Webrat)
11
+ module Merb::Test::ViewHelper
12
+ include ::Webrat::Matchers
13
+ include ::Webrat::HaveTagMatcher
14
+ end
15
+ end
@@ -43,7 +43,10 @@ module Merb
43
43
  include ::Merb::Test::Matchers
44
44
  include ::Merb::Test::RouteHelper
45
45
  include ::Merb::Test::ControllerHelper
46
- include ::Webrat::Methods
46
+
47
+ if defined?(::Webrat)
48
+ include ::Webrat::Methods
49
+ end
47
50
 
48
51
  class << self
49
52
  # This is a copy of the method in rspec, so we can have
@@ -0,0 +1,50 @@
1
+ module Merb::Test::MultipartRequestHelper
2
+
3
+ def multipart_request(path, params = {}, env = {})
4
+ multipart = Merb::Test::MultipartRequestHelper::Post.new(params)
5
+ body, head = multipart.to_multipart
6
+ env["CONTENT_TYPE"] = head
7
+ env["CONTENT_LENGTH"] = body.size
8
+ env[:input] = StringIO.new(body)
9
+ request(path, env)
10
+ end
11
+
12
+ # An HTTP POST request that operates through the router and uses multipart
13
+ # parameters.
14
+ #
15
+ # ==== Parameters
16
+ # path<String>:: The path that should go to the router as the request uri.
17
+ # params<Hash>::
18
+ # An optional hash that will end up as params in the controller instance.
19
+ # env<Hash>::
20
+ # An optional hash that is passed to the fake request. Any request options
21
+ # should go here (see +fake_request+).
22
+ # block<Proc>:: The block is executed in the context of the controller.
23
+ #
24
+ # ==== Notes
25
+ # To include an uploaded file, put a file object as a value in params.
26
+ def multipart_post(path, params = {}, env = {})
27
+ env[:method] = "POST"
28
+ multipart_request(path, params, env)
29
+ end
30
+
31
+ # An HTTP PUT request that operates through the router and uses multipart
32
+ # parameters.
33
+ #
34
+ # ==== Parameters
35
+ # path<String>:: The path that should go to the router as the request uri.
36
+ # params<Hash>::
37
+ # An optional hash that will end up as params in the controller instance.
38
+ # env<Hash>::
39
+ # An optional hash that is passed to the fake request. Any request options
40
+ # should go here (see +fake_request+).
41
+ # block<Proc>:: The block is executed in the context of the controller.
42
+ #
43
+ # ==== Notes
44
+ # To include an uplaoded file, put a file object as a value in params.
45
+ def multipart_put(path, params = {}, env = {}, &block)
46
+ env[:method] = "PUT"
47
+ multipart_request(path, params, env)
48
+ end
49
+
50
+ end
@@ -1,4 +1,4 @@
1
1
  module Merb
2
- VERSION = '1.0.3' unless defined?(Merb::VERSION)
3
- DM_VERSION = '0.9.7' unless defined?(Merb::DM_VERSION)
2
+ VERSION = '1.0.4' unless defined?(Merb::VERSION)
3
+ DM_VERSION = '0.9.8' unless defined?(Merb::DM_VERSION)
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezra Zygmuntowicz
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-25 00:00:00 -08:00
12
+ date: 2008-12-08 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -231,8 +231,10 @@ files:
231
231
  - lib/merb-core/test/test_ext/rspec.rb
232
232
  - lib/merb-core/test/test_ext/string.rb
233
233
  - lib/merb-core/test.rb
234
+ - lib/merb-core/two-oh.rb
234
235
  - lib/merb-core/version.rb
235
236
  - lib/merb-core.rb
237
+ - lib/merb-core.rbc
236
238
  has_rdoc: true
237
239
  homepage: http://merbivore.com
238
240
  post_install_message: