fakettp 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ install
4
4
  testinstall
5
5
  coverage
6
6
  tmtags
7
+ fakettp.gemspec
data/Rakefile CHANGED
@@ -20,8 +20,9 @@ begin
20
20
  gem.add_dependency 'activerecord'
21
21
  gem.add_development_dependency 'jeweler'
22
22
  gem.add_development_dependency 'rcov'
23
- gem.add_development_dependency "rspec"
24
- gem.add_development_dependency "cucumber"
23
+ gem.add_development_dependency 'rspec'
24
+ gem.add_development_dependency 'rack-test'
25
+ gem.add_development_dependency 'cucumber'
25
26
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
26
27
  end
27
28
  Jeweler::GemcutterTasks.new
@@ -92,7 +93,7 @@ task :clean do
92
93
  end
93
94
 
94
95
  task :local_install do
95
- system 'sudo gem in -l pkg/*'
96
+ system "sudo gem in -l pkg/fakettp-#{File.read('VERSION').chomp}.gem"
96
97
  end
97
98
 
98
99
  desc 'Install FakeTTP into local install directory'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.2
1
+ 0.3.3
@@ -1,5 +1,17 @@
1
1
  require 'rubygems'
2
-
2
+ #require 'sinatra/lib/sinatra.rb'
3
+ require 'sinatra'
4
+
5
+ Sinatra::Application.default_options.merge!(
6
+ :run => false,
7
+ :env => :production,
8
+ :raise_errors => true
9
+ )
10
+
11
+ log = File.new("fakettp.log", "a")
12
+ STDOUT.reopen(log)
13
+ STDERR.reopen(log)
14
+
3
15
  FAKETTP_BASE = File.expand_path(File.dirname(__FILE__))
4
16
  require 'fakettp'
5
17
 
@@ -2,7 +2,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
  require 'hpricot'
3
3
 
4
4
  describe 'Controller' do
5
- include Sinatra::Test
5
+ include Rack::Test::Methods
6
+
7
+ def app
8
+ Sinatra::Application
9
+ end
10
+
6
11
  before :all do
7
12
  @host = YAML.load(File.read(FAKETTP_BASE + '/fakettp.yml'))['hostname']
8
13
  end
@@ -22,7 +27,7 @@ describe 'Controller' do
22
27
 
23
28
  describe 'on the fakettp host' do
24
29
  def do_post
25
- post '/reset', nil, :host => @host
30
+ post '/reset', nil, 'HTTP_HOST' => @host
26
31
  end
27
32
 
28
33
  it 'resets the simulator' do
@@ -32,24 +37,24 @@ describe 'Controller' do
32
37
 
33
38
  it 'is successful' do
34
39
  do_post
35
- @response.should be_ok
40
+ last_response.should be_ok
36
41
  end
37
42
 
38
43
  it 'returns a plain text response' do
39
44
  do_post
40
- @response.content_type.should == 'text/plain'
45
+ last_response.content_type.should == 'text/plain'
41
46
  end
42
47
 
43
48
  it 'returns an acknowledgement message' do
44
49
  do_post
45
- @response.body.should == "Reset OK\n"
50
+ last_response.body.should == "Reset OK\n"
46
51
  end
47
52
  end
48
53
 
49
54
  describe 'on another host' do
50
55
  it 'acts like any other simulated request' do
51
- post '/reset', nil, :host => 'foo.fake.local'
52
- response.body.should == "Simulator received mismatched request\n"
56
+ post '/reset', nil, 'HTTP_HOST' => 'foo.fake.local'
57
+ last_response.body.should == "Simulator received mismatched request\n"
53
58
  end
54
59
  end
55
60
  end
@@ -62,7 +67,7 @@ describe 'Controller' do
62
67
 
63
68
  describe 'on the fakettp host' do
64
69
  def do_post
65
- post '/expect', @body, :host => @host
70
+ post '/expect', @body, 'HTTP_HOST' => @host
66
71
  end
67
72
 
68
73
  it 'sets a simulator expectation using the request body' do
@@ -72,24 +77,24 @@ describe 'Controller' do
72
77
 
73
78
  it 'is successful' do
74
79
  do_post
75
- @response.should be_ok
80
+ last_response.should be_ok
76
81
  end
77
82
 
78
83
  it 'returns a plain text response' do
79
84
  do_post
80
- @response.content_type.should == 'text/plain'
85
+ last_response.content_type.should == 'text/plain'
81
86
  end
82
87
 
83
88
  it 'returns an acknowledgement message' do
84
89
  do_post
85
- @response.body.should == "Expect OK\n"
90
+ last_response.body.should == "Expect OK\n"
86
91
  end
87
92
  end
88
93
 
89
94
  describe 'on another host' do
90
95
  it 'acts like any other simulated request' do
91
- post '/expect', @body, :host => 'foo.fake.local'
92
- response.body.should == "Simulator received mismatched request\n"
96
+ post '/expect', @body, 'HTTP_HOST' => 'foo.fake.local'
97
+ last_response.body.should == "Simulator received mismatched request\n"
93
98
  end
94
99
  end
95
100
  end
@@ -118,18 +123,18 @@ describe 'Controller' do
118
123
 
119
124
  it 'returns a 500 status' do
120
125
  do_request
121
- @response.status.should == 500
126
+ last_response.status.should == 500
122
127
  end
123
128
 
124
129
  it 'returns a plain text response' do
125
130
  do_request
126
- @response.content_type.should == 'text/plain'
131
+ last_response.content_type.should == 'text/plain'
127
132
  end
128
133
 
129
134
  unless verb == 'HEAD' # No body for that one
130
135
  it 'returns an error message' do
131
136
  do_request
132
- @response.body.should == "Simulator received mismatched request\n"
137
+ last_response.body.should == "Simulator received mismatched request\n"
133
138
  end
134
139
  end
135
140
  end
@@ -145,7 +150,7 @@ describe 'Controller' do
145
150
 
146
151
  describe 'on the fakettp host' do
147
152
  def do_get
148
- get '/verify', nil, :host => @host
153
+ get '/verify', nil, 'HTTP_HOST' => @host
149
154
  end
150
155
 
151
156
  it 'verifies the simulator' do
@@ -155,7 +160,7 @@ describe 'Controller' do
155
160
 
156
161
  it 'returns a plain text response' do
157
162
  do_get
158
- @response.content_type.should == 'text/plain'
163
+ last_response.content_type.should == 'text/plain'
159
164
  end
160
165
 
161
166
  describe 'when verification succeeds' do
@@ -165,12 +170,12 @@ describe 'Controller' do
165
170
 
166
171
  it 'is successful' do
167
172
  do_get
168
- @response.should be_ok
173
+ last_response.should be_ok
169
174
  end
170
175
 
171
176
  it 'returns an acknowledgement message' do
172
177
  do_get
173
- @response.body.should == "Verify OK\n"
178
+ last_response.body.should == "Verify OK\n"
174
179
  end
175
180
  end
176
181
 
@@ -181,20 +186,20 @@ describe 'Controller' do
181
186
 
182
187
  it 'returns 500 Internal Error' do
183
188
  do_get
184
- @response.status.should == 500
189
+ last_response.status.should == 500
185
190
  end
186
191
 
187
192
  it 'lists the errors' do
188
193
  do_get
189
- @response.body.should == @errors
194
+ last_response.body.should == @errors
190
195
  end
191
196
  end
192
197
  end
193
198
 
194
199
  describe 'on another host' do
195
200
  it 'acts like any other simulated request' do
196
- get '/verify', nil, :host => 'foo.fake.local'
197
- response.body.should == "Simulator received mismatched request\n"
201
+ get '/verify', nil, 'HTTP_HOST' => 'foo.fake.local'
202
+ last_response.body.should == "Simulator received mismatched request\n"
198
203
  end
199
204
  end
200
205
  end
@@ -208,13 +213,13 @@ describe 'Controller' do
208
213
  end
209
214
 
210
215
  def do_get
211
- get '/', nil, :host => @host
212
- @response_doc = Hpricot(@response.body)
216
+ get '/', nil, 'HTTP_HOST' => @host
217
+ @response_doc = Hpricot(last_response.body)
213
218
  end
214
219
 
215
220
  it 'returns an html response' do
216
221
  do_get
217
- response.content_type.should == 'text/html'
222
+ last_response.content_type.should == 'text/html'
218
223
  end
219
224
 
220
225
  it 'sets the title' do
@@ -242,8 +247,8 @@ describe 'Controller' do
242
247
 
243
248
  describe 'on another host' do
244
249
  it 'acts like any other simulated request' do
245
- get '/', nil, :host => 'foo.fake.local'
246
- response.body.should == "Simulator received mismatched request\n"
250
+ get '/', nil, 'HTTP_HOST' => 'foo.fake.local'
251
+ last_response.body.should == "Simulator received mismatched request\n"
247
252
  end
248
253
  end
249
254
  end
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'spec'
3
3
  require 'sinatra'
4
4
  require 'spec/interop/test'
5
- require 'sinatra/test'
5
+ require 'rack/test'
6
6
  require 'active_record'
7
7
  require 'shoulda/active_record'
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakettp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kerry Buckley
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-19 00:00:00 +01:00
12
+ date: 2009-10-29 00:00:00 +00:00
13
13
  default_executable: fakettp
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -72,6 +72,16 @@ dependencies:
72
72
  - !ruby/object:Gem::Version
73
73
  version: "0"
74
74
  version:
75
+ - !ruby/object:Gem::Dependency
76
+ name: rack-test
77
+ type: :development
78
+ version_requirement:
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: "0"
84
+ version:
75
85
  - !ruby/object:Gem::Dependency
76
86
  name: cucumber
77
87
  type: :development
@@ -96,7 +106,6 @@ files:
96
106
  - Rakefile
97
107
  - VERSION
98
108
  - bin/fakettp
99
- - fakettp.gemspec
100
109
  - features/control.feature
101
110
  - features/dashboard.feature
102
111
  - features/expectations.feature
data/fakettp.gemspec DELETED
@@ -1,111 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{fakettp}
8
- s.version = "0.3.2"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Kerry Buckley"]
12
- s.date = %q{2009-10-19}
13
- s.default_executable = %q{fakettp}
14
- s.description = %q{HTTP server mocking tool}
15
- s.email = %q{kerryjbuckley@gmail.com}
16
- s.executables = ["fakettp"]
17
- s.extra_rdoc_files = [
18
- "README.rdoc"
19
- ]
20
- s.files = [
21
- ".gitignore",
22
- "README.rdoc",
23
- "Rakefile",
24
- "VERSION",
25
- "bin/fakettp",
26
- "fakettp.gemspec",
27
- "features/control.feature",
28
- "features/dashboard.feature",
29
- "features/expectations.feature",
30
- "features/expectations/expect_get",
31
- "features/expectations/get_foo",
32
- "features/expectations/get_root",
33
- "features/expectations/pass_and_fail",
34
- "features/expectations/set_response",
35
- "features/step_definitions/expectations.rb",
36
- "features/step_definitions/http.rb",
37
- "features/step_definitions/simulator.rb",
38
- "features/step_definitions/webrat_steps.rb",
39
- "features/support/env.rb",
40
- "features/support/fakettp.rb",
41
- "features/support/paths.rb",
42
- "features/support/xpath.rb",
43
- "features/verification.feature",
44
- "lib/fakettp.rb",
45
- "lib/fakettp/commands/fakettp_command.rb",
46
- "lib/fakettp/config.ru",
47
- "lib/fakettp/controller.rb",
48
- "lib/fakettp/db.rb",
49
- "lib/fakettp/error.rb",
50
- "lib/fakettp/expectation.rb",
51
- "lib/fakettp/expectation_helper.rb",
52
- "lib/fakettp/fakettp.yml",
53
- "lib/fakettp/public/fakettp.css",
54
- "lib/fakettp/schema.rb",
55
- "lib/fakettp/simulator.rb",
56
- "lib/fakettp/views/index.erb",
57
- "spec/fakettp/commands/fakettp_command_spec.rb",
58
- "spec/fakettp/controller_spec.rb",
59
- "spec/fakettp/error_spec.rb",
60
- "spec/fakettp/expectation_helper_spec.rb",
61
- "spec/fakettp/expectation_spec.rb",
62
- "spec/fakettp/simulator_spec.rb",
63
- "spec/spec.opts",
64
- "spec/spec_helper.rb"
65
- ]
66
- s.homepage = %q{http://github.com/kerryb/fakettp}
67
- s.rdoc_options = ["--charset=UTF-8"]
68
- s.require_paths = ["lib"]
69
- s.rubygems_version = %q{1.3.5}
70
- s.summary = %q{HTTP server mocking tool}
71
- s.test_files = [
72
- "spec/fakettp/commands/fakettp_command_spec.rb",
73
- "spec/fakettp/controller_spec.rb",
74
- "spec/fakettp/error_spec.rb",
75
- "spec/fakettp/expectation_helper_spec.rb",
76
- "spec/fakettp/expectation_spec.rb",
77
- "spec/fakettp/simulator_spec.rb",
78
- "spec/spec_helper.rb"
79
- ]
80
-
81
- if s.respond_to? :specification_version then
82
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
83
- s.specification_version = 3
84
-
85
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
86
- s.add_runtime_dependency(%q<sinatra-sinatra>, [">= 0.10.1"])
87
- s.add_runtime_dependency(%q<sqlite3-ruby>, [">= 0"])
88
- s.add_runtime_dependency(%q<activerecord>, [">= 0"])
89
- s.add_development_dependency(%q<jeweler>, [">= 0"])
90
- s.add_development_dependency(%q<rcov>, [">= 0"])
91
- s.add_development_dependency(%q<rspec>, [">= 0"])
92
- s.add_development_dependency(%q<cucumber>, [">= 0"])
93
- else
94
- s.add_dependency(%q<sinatra-sinatra>, [">= 0.10.1"])
95
- s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
96
- s.add_dependency(%q<activerecord>, [">= 0"])
97
- s.add_dependency(%q<jeweler>, [">= 0"])
98
- s.add_dependency(%q<rcov>, [">= 0"])
99
- s.add_dependency(%q<rspec>, [">= 0"])
100
- s.add_dependency(%q<cucumber>, [">= 0"])
101
- end
102
- else
103
- s.add_dependency(%q<sinatra-sinatra>, [">= 0.10.1"])
104
- s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
105
- s.add_dependency(%q<activerecord>, [">= 0"])
106
- s.add_dependency(%q<jeweler>, [">= 0"])
107
- s.add_dependency(%q<rcov>, [">= 0"])
108
- s.add_dependency(%q<rspec>, [">= 0"])
109
- s.add_dependency(%q<cucumber>, [">= 0"])
110
- end
111
- end