fakettp 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -33,16 +33,14 @@ You can install FakeTTP anywhere that your web server user can see it:
33
33
 
34
34
  fakettp install <directory> <hostname>
35
35
 
36
- Set _hostname_ to the host you want to use for FakeTTP control requests
36
+ Set _hostname_ to the host you want to use for FakeTTP control requests (the
37
+ examples below use <tt>fakettp.local</tt>).
37
38
 
38
39
  You can install multiple copies
39
40
  and run them independently by using different directories and hostnames (for
40
41
  example on a CI server to prevent clashes when building multiple projects
41
42
  in parallel).
42
43
 
43
- The examples below assume that all fakettp hostnames end with
44
- <tt>fakettp.local</tt>.
45
-
46
44
  === Point your web server at the directory
47
45
 
48
46
  FakeTTP should work with any Rack-compatible server: just point the server to
@@ -51,7 +49,6 @@ the correct directory. For example, using Passenger[http://www.modrails.com/]
51
49
 
52
50
  <VirtualHost *:80>
53
51
  ServerName fakettp.local
54
- ServerAlias *.fakettp.local
55
52
  ServerAlias *.fake.local
56
53
  DocumentRoot "/path/to/fakettp/public"
57
54
  <directory "/path/to/fakettp/public">
@@ -61,16 +58,16 @@ the correct directory. For example, using Passenger[http://www.modrails.com/]
61
58
  </directory>
62
59
  </VirtualHost>
63
60
 
64
- This will make FakeTTP handle requests to any hosts ending with
65
- <tt>.fake.local</tt>. If you want to simulate other hosts, add more aliases.
61
+ The <tt>ServerAlias</tt> line means that FakeTTP will attempt to simulate
62
+ all requests that match the supplied pattern. You can add as many of these
63
+ as necessary.
66
64
 
67
- Now make sure <tt>fakettp.local</tt> and any simulated hosts resolve to
68
- 127.0.0.1 (assuming you're
69
- running the simulator on the same machine as the application under test), eg
70
- by adding the following line to <tt>/etc/hosts</tt>:
65
+ Then make sure the simualtor hostname and any simulated hosts all resolve to
66
+ 127.0.0.1 (assuming you're running the simulator on the same machine as the
67
+ application under test), eg by adding the following to <tt>/etc/hosts</tt>:
71
68
 
72
69
  127.0.0.1 fakettp.local
73
- 127.0.0.1 some-app.fake.local
70
+ 127.0.0.1 some-host.fake.local
74
71
 
75
72
  === IMPORTANT: security note
76
73
 
@@ -142,8 +139,20 @@ Point your browser at http://fakettp.local/
142
139
 
143
140
  Currently this is very basic, just showing the expectations from the last run.
144
141
 
142
+ === Multiple faked hosts
143
+
144
+ To have FakeTTP respond to multiple hostnames, create the appropriate hosts
145
+ entries. If you're using name-based virtual hosts in Apache, add a
146
+ _ServerAlias_ entry to the virtual host config, under the _ServerName_ line, eg:
147
+
148
+ ServerAlias foo.com bar.com
149
+
145
150
  == Change log
146
151
 
152
+ 0.3.0 (19 May 2009)
153
+
154
+ * Fixed some issues with multiple hosts
155
+
147
156
  0.3.0 (18 May 2009)
148
157
 
149
158
  * Now uses SQLite and ActiveRecord to store expectations, instead of the filesystem.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
data/fakettp.gemspec ADDED
@@ -0,0 +1,111 @@
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
@@ -1,12 +1,12 @@
1
1
  Feature: Controlling the simulator
2
2
  Scenario: Attempting to reset the simulator using the wrong host
3
- When we post to /reset on foo.fake.local
3
+ When we post to /reset on foo.fakettp.fake.local
4
4
  Then the response body should contain 'Simulator received mismatched request'
5
5
 
6
6
  Scenario: Attempting to create an expectation using the wrong host
7
- When we post to /expect on foo.fake.local
7
+ When we post to /expect on foo.fakettp.fake.local
8
8
  Then the response body should contain 'Simulator received mismatched request'
9
9
 
10
10
  Scenario: Attempting to verify the simulator using the wrong host
11
- When we get /verify on foo.fake.local
11
+ When we get /verify on foo.fakettp.fake.local
12
12
  Then the response body should contain 'Simulator received mismatched request'
@@ -26,7 +26,7 @@ Feature: Dashboard for debugging failures
26
26
  Scenario: Highlight passed and failed lines
27
27
  Given the simulator is reset
28
28
  And we expect pass_and_fail
29
- And we get / on foo.fake.local
29
+ And we get / on foo.fakettp.fake.local
30
30
  When we get / on fakettp.local
31
31
  Then //div[1]/pre in the response should be:
32
32
  """
@@ -2,26 +2,26 @@ Feature: Expectations
2
2
  Scenario: Using rspec matchers
3
3
  Given the simulator is reset
4
4
  And we expect expect_get
5
- And we get / on foo.fake.local
5
+ And we get / on foo.fakettp.fake.local
6
6
  Then verifying the simulator should report success
7
7
 
8
8
  Scenario: Setting response headers
9
9
  Given the simulator is reset
10
10
  And we expect set_response
11
- And we get / on foo.fake.local
11
+ And we get / on foo.fakettp.fake.local
12
12
  Then the response should have a 'foo' header with a value of 'bar'
13
13
  And verifying the simulator should report success
14
14
 
15
15
  Scenario: Setting response content-type
16
16
  Given the simulator is reset
17
17
  And we expect set_response
18
- And we get / on foo.fake.local
18
+ And we get / on foo.fakettp.fake.local
19
19
  Then the response should have a content type of 'application/xml'
20
20
  And verifying the simulator should report success
21
21
 
22
22
  Scenario: Setting response code
23
23
  Given the simulator is reset
24
24
  And we expect set_response
25
- And we get / on foo.fake.local
25
+ And we get / on foo.fakettp.fake.local
26
26
  Then the response body should be '<foo />'
27
27
  And verifying the simulator should report success
@@ -6,7 +6,7 @@ Feature: Verification of expectations
6
6
  Scenario: Satisfied expectation
7
7
  Given the simulator is reset
8
8
  And we expect get_root
9
- When we get / on foo.fake.local
9
+ When we get / on foo.fakettp.fake.local
10
10
  Then verifying the simulator should report success
11
11
 
12
12
  Scenario: Unsatisfied expectation
@@ -16,34 +16,34 @@ Feature: Verification of expectations
16
16
 
17
17
  Scenario: Unexpected request
18
18
  Given the simulator is reset
19
- When we get / on foo.fake.local
19
+ When we get / on foo.fakettp.fake.local
20
20
  Then verifying the simulator should report a failure, with message "Received unexpected request"
21
21
 
22
22
  Scenario: Mismatched expectation
23
23
  Given the simulator is reset
24
24
  And we expect get_root
25
- When we get /foo on foo.fake.local
25
+ When we get /foo on foo.fakettp.fake.local
26
26
  Then verifying the simulator should report a failure, with message "Error in GET /: expected: "/",.*got: "/foo""
27
27
 
28
28
  Scenario: Two satisfied expectations
29
29
  Given the simulator is reset
30
30
  And we expect get_root
31
31
  And we expect get_foo
32
- When we get / on foo.fake.local
33
- And we get /foo on foo.fake.local
32
+ When we get / on foo.fakettp.fake.local
33
+ And we get /foo on foo.fakettp.fake.local
34
34
  Then verifying the simulator should report success
35
35
 
36
36
  Scenario: Two expectations, one satisfied
37
37
  Given the simulator is reset
38
38
  And we expect get_root
39
39
  And we expect get_foo
40
- When we get / on foo.fake.local
40
+ When we get / on foo.fakettp.fake.local
41
41
  Then verifying the simulator should report a failure, with message "Expected request not received"
42
42
 
43
43
  Scenario: Two expectations, with requests received in the wrong order
44
44
  Given the simulator is reset
45
45
  And we expect get_root
46
46
  And we expect get_foo
47
- When we get /foo on foo.fake.local
48
- And we get / on foo.fake.local
47
+ When we get /foo on foo.fakettp.fake.local
48
+ And we get / on foo.fakettp.fake.local
49
49
  Then verifying the simulator should report a failure, with message "Error in GET /: expected: "/",.*got: "/foo".*Error in GET /foo: expected: "/foo",.*got: "/""
@@ -15,19 +15,19 @@ host = YAML.load(config)['hostname']
15
15
 
16
16
  include Fakettp::ExpectationHelper
17
17
 
18
- post '/expect', :host => 'fakettp.local' do
18
+ send :post, '/expect', :host => host do
19
19
  Fakettp::Simulator << request.body.read
20
20
  content_type 'text/plain'
21
21
  "Expect OK\n"
22
22
  end
23
23
 
24
- post '/reset', :host => 'fakettp.local' do
24
+ send :post, '/reset', :host => host do
25
25
  Fakettp::Simulator.reset
26
26
  content_type 'text/plain'
27
27
  "Reset OK\n"
28
28
  end
29
29
 
30
- get '/verify', :host => 'fakettp.local' do
30
+ send :get, '/verify', :host => host do
31
31
  content_type 'text/plain'
32
32
  if Fakettp::Simulator.verify
33
33
  "Verify OK\n"
@@ -36,7 +36,7 @@ get '/verify', :host => 'fakettp.local' do
36
36
  end
37
37
  end
38
38
 
39
- get '/', :host => 'fakettp.local' do
39
+ send :get, '/', :host => host do
40
40
  content_type 'text/html'
41
41
  @expectations = Fakettp::Expectation.all
42
42
  erb :index
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.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kerry Buckley
@@ -96,6 +96,7 @@ files:
96
96
  - Rakefile
97
97
  - VERSION
98
98
  - bin/fakettp
99
+ - fakettp.gemspec
99
100
  - features/control.feature
100
101
  - features/dashboard.feature
101
102
  - features/expectations.feature