mimic 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.4.3
2
+
3
+ * Added request logging support.
4
+
1
5
  ## 0.4.2
2
6
 
3
7
  * Remove unnecessary signal traps.
data/README.md CHANGED
@@ -78,6 +78,7 @@ The end-point of the API is the HTTP verb you are stubbing, the path, response b
78
78
  ## Contributors
79
79
 
80
80
  * [James Fairbairn](http://github.com/jfairbairn)
81
+ * [Marcello Barnaba](https://github.com/vjt)
81
82
 
82
83
  ## License
83
84
 
data/Rakefile CHANGED
@@ -3,6 +3,8 @@ require 'cucumber'
3
3
  require 'cucumber/rake/task'
4
4
  require 'rspec/core/rake_task'
5
5
 
6
+ ENV["MIMIC_TEST_PROXY"] = nil
7
+
6
8
  desc "Run all Cucumber features"
7
9
  Cucumber::Rake::Task.new(:features) do |t|
8
10
  t.cucumber_opts = "features --format pretty"
@@ -15,8 +17,8 @@ end
15
17
  task :default => :spec
16
18
  task :all => [:spec, :features]
17
19
 
18
- require "rake/gempackagetask"
19
- require "rake/rdoctask"
20
+ require "rubygems/package_task"
21
+ require "rdoc/task"
20
22
 
21
23
  # This builds the actual gem. For details of what all these options
22
24
  # mean, and other ones you can add, check the documentation here:
@@ -27,7 +29,7 @@ spec = Gem::Specification.new do |s|
27
29
 
28
30
  # Change these as appropriate
29
31
  s.name = "mimic"
30
- s.version = "0.4.2"
32
+ s.version = "0.4.3"
31
33
  s.summary = "A Ruby gem for faking external web services for testing"
32
34
  s.authors = "Luke Redpath"
33
35
  s.email = "luke@lukeredpath.co.uk"
@@ -62,7 +64,7 @@ end
62
64
  #
63
65
  # To publish your gem online, install the 'gemcutter' gem; Read more
64
66
  # about that here: http://gemcutter.org/pages/gem_docs
65
- Rake::GemPackageTask.new(spec) do |pkg|
67
+ Gem::PackageTask.new(spec) do |pkg|
66
68
  pkg.gem_spec = spec
67
69
  end
68
70
 
@@ -75,7 +77,7 @@ end
75
77
  task :package => :gemspec
76
78
 
77
79
  # Generate documentation
78
- Rake::RDocTask.new do |rd|
80
+ RDoc::Task.new do |rd|
79
81
  rd.main = "README.md"
80
82
  rd.rdoc_files.include("README.md", "lib/**/*.rb")
81
83
  rd.rdoc_dir = "rdoc"
@@ -10,13 +10,14 @@ module Mimic
10
10
  :hostname => 'localhost',
11
11
  :port => MIMIC_DEFAULT_PORT,
12
12
  :remote_configuration_path => nil,
13
- :fork => true
13
+ :fork => true,
14
+ :log => nil
14
15
  }
15
16
 
16
17
  def self.mimic(options = {}, &block)
17
18
  options = MIMIC_DEFAULT_OPTIONS.merge(options)
18
19
 
19
- host = FakeHost.new(options[:hostname], options[:remote_configuration_path]).tap do |host|
20
+ host = FakeHost.new(options).tap do |host|
20
21
  host.instance_eval(&block) if block_given?
21
22
  Server.instance.serve(host, options)
22
23
  end
@@ -4,10 +4,12 @@ require 'mimic/api'
4
4
  module Mimic
5
5
  class FakeHost
6
6
  attr_reader :hostname, :url_map
7
+ attr_accessor :log
7
8
 
8
- def initialize(hostname, remote_configuration_path = nil)
9
- @hostname = hostname
10
- @remote_configuration_path = remote_configuration_path
9
+ def initialize(options = {})
10
+ @hostname = options[:hostname]
11
+ @remote_configuration_path = options[:remote_configuration_path]
12
+ @log = options[:log]
11
13
  @imports = []
12
14
  clear
13
15
  build_url_map!
@@ -49,7 +51,8 @@ module Mimic
49
51
 
50
52
  def clear
51
53
  @stubs = []
52
- @app = Class.new(Sinatra::Base)
54
+ @app = Sinatra.new
55
+ @app.use Rack::CommonLogger, self.log if self.log
53
56
  @app.not_found do
54
57
  [404, {}, ""]
55
58
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mimic
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 2
10
- version: 0.4.2
9
+ - 3
10
+ version: 0.4.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Luke Redpath
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-20 00:00:00 +01:00
19
- default_executable:
18
+ date: 2011-06-25 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: rack
@@ -148,7 +147,6 @@ files:
148
147
  - lib/mimic/api.rb
149
148
  - lib/mimic/fake_host.rb
150
149
  - lib/mimic.rb
151
- has_rdoc: true
152
150
  homepage: http://lukeredpath.co.uk
153
151
  licenses: []
154
152
 
@@ -179,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
177
  requirements: []
180
178
 
181
179
  rubyforge_project:
182
- rubygems_version: 1.4.1
180
+ rubygems_version: 1.8.5
183
181
  signing_key:
184
182
  specification_version: 3
185
183
  summary: A Ruby gem for faking external web services for testing