fredo 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.7
data/fredo.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fredo}
8
- s.version = "0.1.6"
8
+ s.version = "0.1.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["ilpoldo"]
12
- s.date = %q{2010-04-26}
12
+ s.date = %q{2010-05-01}
13
13
  s.description = %q{Mocks web services by plugging Net::Http straight into Rack}
14
14
  s.email = %q{ilpoldo@gmail.com}
15
15
  s.extra_rdoc_files = [
data/lib/fredo/handler.rb CHANGED
@@ -48,6 +48,11 @@ module Fredo
48
48
  {}
49
49
  end
50
50
  @params.merge!(params)
51
+
52
+ Fredo.books << {:path => path,
53
+ :params => @params,
54
+ :method => @request.request_method,
55
+ :host => @request.host}
51
56
  perform!(&block)
52
57
  return
53
58
  end
data/lib/fredo.rb CHANGED
@@ -50,6 +50,11 @@ module Fredo
50
50
  @allow_net_connect || true
51
51
  end
52
52
 
53
+ # Returns an array that stores every request intercepted by fredo
54
+ def self.books
55
+ @books ||= []
56
+ end
57
+
53
58
  # This exception is raised if you set <tt>Fredo.allow_net_connect =
54
59
  # false</tt> and subsequently try to make a request to a URI you haven't
55
60
  # stubbed.
data/spec/fredo_spec.rb CHANGED
@@ -73,6 +73,20 @@ describe Fredo do
73
73
 
74
74
  end
75
75
 
76
+ context "tracks requests" do
77
+
78
+ it "saves every request" do
79
+ Fredo.get 'http://www.twitter.com/:name' do
80
+ "It ain't #{params[:name]} talking"
81
+ end
82
+
83
+ response = open('http://www.twitter.com/sam')
84
+
85
+ Fredo.books.last.host.should eql('www.twitter.com')
86
+ end
87
+
88
+ end
89
+
76
90
  context "parameters" do
77
91
  it "parses url parameters" do
78
92
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 6
9
- version: 0.1.6
8
+ - 7
9
+ version: 0.1.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - ilpoldo
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-26 00:00:00 +01:00
17
+ date: 2010-05-01 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency