mirage 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -8
- data/bin/mirage +1 -1
- data/features/client/setting_responses.feature +7 -7
- data/features/default_responses.feature +48 -91
- data/features/priming.feature +93 -0
- data/features/support/env.rb +1 -1
- data/lib/mirage.rb +1 -1
- data/lib/mirage/client.rb +2 -2
- data/lib/mirage/core.rb +1 -1
- data/lib/mirage/util.rb +1 -1
- data/mirage.gemspec +1 -1
- metadata +163 -186
- data/features/root_responses.feature +0 -47
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mirage (0.1.
|
4
|
+
mirage (0.1.5)
|
5
5
|
mechanize (>= 1.0.0)
|
6
6
|
rack (~> 1.1.0)
|
7
7
|
ramaze (>= 2011.01.30)
|
@@ -19,16 +19,12 @@ GEM
|
|
19
19
|
diff-lcs (1.1.2)
|
20
20
|
gherkin (2.3.5)
|
21
21
|
json (>= 1.4.6)
|
22
|
-
gherkin (2.3.5-java)
|
23
|
-
json (>= 1.4.6)
|
24
22
|
innate (2011.01)
|
25
23
|
rack (>= 1.1.0)
|
26
24
|
json (1.5.1)
|
27
|
-
json (1.5.1-java)
|
28
25
|
mechanize (1.0.0)
|
29
26
|
nokogiri (>= 1.2.1)
|
30
|
-
nokogiri (1.4.4
|
31
|
-
weakling (>= 0.0.3)
|
27
|
+
nokogiri (1.4.4)
|
32
28
|
rack (1.1.2)
|
33
29
|
rake (0.8.7)
|
34
30
|
ramaze (2011.01.30)
|
@@ -42,10 +38,8 @@ GEM
|
|
42
38
|
diff-lcs (~> 1.1.2)
|
43
39
|
rspec-mocks (2.5.0)
|
44
40
|
term-ansicolor (1.0.5)
|
45
|
-
weakling (0.0.4-java)
|
46
41
|
|
47
42
|
PLATFORMS
|
48
|
-
java
|
49
43
|
ruby
|
50
44
|
|
51
45
|
DEPENDENCIES
|
data/bin/mirage
CHANGED
@@ -32,20 +32,20 @@ Feature: the Mirage client provides methods for setting responses and loading de
|
|
32
32
|
"""
|
33
33
|
Then 'Hello Leon' should be returned
|
34
34
|
|
35
|
-
Scenario:
|
35
|
+
Scenario: Priming Mirage
|
36
36
|
Given Mirage is not running
|
37
37
|
And I run 'mirage start'
|
38
38
|
|
39
|
-
When the file '
|
39
|
+
When the file 'responses/default_greetings.rb' contains:
|
40
40
|
"""
|
41
|
-
Mirage.
|
41
|
+
Mirage.prime do |mirage|
|
42
42
|
mirage.set('greeting', :response => 'hello')
|
43
43
|
mirage.set('leaving', :response => 'goodbye')
|
44
44
|
end
|
45
45
|
"""
|
46
46
|
And I run
|
47
47
|
"""
|
48
|
-
Mirage::Client.new.
|
48
|
+
Mirage::Client.new.prime
|
49
49
|
"""
|
50
50
|
And I hit 'http://localhost:7001/mirage/get/greeting'
|
51
51
|
Then 'hello' should be returned
|
@@ -54,15 +54,15 @@ Feature: the Mirage client provides methods for setting responses and loading de
|
|
54
54
|
Then 'goodbye' should be returned
|
55
55
|
|
56
56
|
|
57
|
-
Scenario:
|
58
|
-
Given the file '
|
57
|
+
Scenario: Priming Mirage when one of the response file has something bad in it
|
58
|
+
Given the file 'responses/default_greetings.rb' contains:
|
59
59
|
"""
|
60
60
|
Something bad...
|
61
61
|
"""
|
62
62
|
When I run
|
63
63
|
"""
|
64
64
|
begin
|
65
|
-
Mirage::Client.new.
|
65
|
+
Mirage::Client.new.prime
|
66
66
|
fail("Error should have been thrown")
|
67
67
|
rescue Exception => e
|
68
68
|
e.is_a?(Mirage::InternalServerException).should == true
|
@@ -1,91 +1,48 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
And I
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
Scenario: Reloading default responses after mirage has been started
|
50
|
-
Given the file 'defaults/default_greetings.rb' contains:
|
51
|
-
"""
|
52
|
-
Mirage.default do |mirage|
|
53
|
-
mirage.set('greeting', :response => 'hello')
|
54
|
-
end
|
55
|
-
"""
|
56
|
-
And I run 'mirage start'
|
57
|
-
And I hit 'http://localhost:7001/mirage/clear'
|
58
|
-
And I hit 'http://localhost:7001/mirage/set/a_new_response' with parameters:
|
59
|
-
| response | new response |
|
60
|
-
|
61
|
-
When I hit 'http://localhost:7001/mirage/load_defaults'
|
62
|
-
When I hit 'http://localhost:7001/mirage/get/greeting'
|
63
|
-
Then 'hello' should be returned
|
64
|
-
When I hit 'http://localhost:7001/mirage/get/a_new_response'
|
65
|
-
Then a 404 should be returned
|
66
|
-
|
67
|
-
|
68
|
-
Scenario: Mirage is started with a bad defaults file
|
69
|
-
Given the file 'defaults/default_greetings.rb' contains:
|
70
|
-
"""
|
71
|
-
A file with a mistake in it
|
72
|
-
"""
|
73
|
-
When I run 'mirage start'
|
74
|
-
Then I should see 'WARN: Unable to load default responses from: defaults/default_greetings.rb' on the command line
|
75
|
-
|
76
|
-
|
77
|
-
Scenario: Defaults with a mistake in them are reloaded after mirage has been started
|
78
|
-
Given I run 'mirage start'
|
79
|
-
When the file 'defaults/default_greetings.rb' contains:
|
80
|
-
"""
|
81
|
-
A file with a mistake in it
|
82
|
-
"""
|
83
|
-
And I hit 'http://localhost:7001/mirage/load_defaults'
|
84
|
-
Then a 500 should be returned
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
1
|
+
Feature: Mirage can respond with a 'default' response when a when the response requested at a sub url is not found.
|
2
|
+
I.e.
|
3
|
+
if a response is held for 'level1' and request comes in for 'level1/level2' the response for 'level1'
|
4
|
+
can be returned if nothing is held for 'level1/level2'
|
5
|
+
|
6
|
+
If a request is made and there is more than one response that could be appropriate then the closet is chosen.
|
7
|
+
|
8
|
+
E.g.
|
9
|
+
responses exist for: 'level1' and 'level1/level2'. If a response for 'level1/level2/level3 is made, then the response for
|
10
|
+
'level1/level2' will be returned as it is the most specific match out of the two.
|
11
|
+
|
12
|
+
Root responses can cause unexpected behaviour and so in order to qualify as a default reponse a client must knowingly mark it as one.
|
13
|
+
|
14
|
+
Scenario: A default response is returned
|
15
|
+
Given I hit 'http://localhost:7001/mirage/set/level0/level1' with parameters:
|
16
|
+
| response | another level |
|
17
|
+
And I hit 'http://localhost:7001/mirage/set/level1' with parameters:
|
18
|
+
| response | level 1 |
|
19
|
+
| root_response | true |
|
20
|
+
|
21
|
+
When I hit 'http://localhost:7001/mirage/get/level1/level2'
|
22
|
+
Then 'level 1' should be returned
|
23
|
+
|
24
|
+
|
25
|
+
Scenario: More than one potential default response exists
|
26
|
+
Given I hit 'http://localhost:7001/mirage/set/level1' with parameters:
|
27
|
+
| response | level 1 |
|
28
|
+
| root_response | true |
|
29
|
+
And I hit 'http://localhost:7001/mirage/set/level1/level2' with parameters:
|
30
|
+
| response | level 2 |
|
31
|
+
| root_response | true |
|
32
|
+
And I hit 'http://localhost:7001/mirage/set/level1/level2/level3' with parameters:
|
33
|
+
| response | level 3 |
|
34
|
+
And I hit 'http://localhost:7001/mirage/set/level1/level2/level3/level4' with parameters:
|
35
|
+
| pattern | a pattern that wont be matched |
|
36
|
+
And I hit 'http://localhost:7001/mirage/set/level1/level2/level3/level4/level5' with parameters:
|
37
|
+
| response | level 5 |
|
38
|
+
| root_response | true |
|
39
|
+
|
40
|
+
When I hit 'http://localhost:7001/mirage/get/level1/level2/level3/level4'
|
41
|
+
Then 'level 2' should be returned
|
42
|
+
|
43
|
+
|
44
|
+
Scenario: There isnt a default response
|
45
|
+
Given I hit 'http://localhost:7001/mirage/set/level1' with parameters:
|
46
|
+
| response | level 1 |
|
47
|
+
When I hit 'http://localhost:7001/mirage/get/level1/level2'
|
48
|
+
Then a 404 should be returned
|
@@ -0,0 +1,93 @@
|
|
1
|
+
@command_line
|
2
|
+
Feature: Mirage can be primed with a set of responses.
|
3
|
+
By default, Mirage loads any rb files found in ./responses on startup. Mirage can also be made to load response for a directory
|
4
|
+
of your choosing
|
5
|
+
|
6
|
+
Responses can be added to the responses directory and used to prime Mirage after Mirage has been started.
|
7
|
+
|
8
|
+
Priming mirage causes any modifications to its state to be lost
|
9
|
+
|
10
|
+
|
11
|
+
Scenario: Mirage is started with the responses to be used for priming located in ./responses
|
12
|
+
Given the file 'responses/default_greetings.rb' contains:
|
13
|
+
"""
|
14
|
+
Mirage.prime do |mirage|
|
15
|
+
mirage.set('greeting', :response => 'hello')
|
16
|
+
mirage.set('leaving', :response => 'goodbye')
|
17
|
+
end
|
18
|
+
"""
|
19
|
+
And I run 'mirage start'
|
20
|
+
When I hit 'http://localhost:7001/mirage/get/greeting'
|
21
|
+
Then 'hello' should be returned
|
22
|
+
When I hit 'http://localhost:7001/mirage/get/leaving'
|
23
|
+
Then 'goodbye' should be returned
|
24
|
+
|
25
|
+
|
26
|
+
Scenario: Mirage is started pointing with a relative path given for the responses directory
|
27
|
+
Given the file './custom_responses_location/default_greetings.rb' contains:
|
28
|
+
"""
|
29
|
+
Mirage.prime do |mirage|
|
30
|
+
mirage.set('greeting', :response => 'hello')
|
31
|
+
end
|
32
|
+
"""
|
33
|
+
And I run 'mirage start -d ./custom_responses_location'
|
34
|
+
When I hit 'http://localhost:7001/mirage/get/greeting'
|
35
|
+
Then 'hello' should be returned
|
36
|
+
|
37
|
+
|
38
|
+
Scenario: Mirage is started pointing with a full path for the responses
|
39
|
+
Given the file '/tmp/responses/default_greetings.rb' contains:
|
40
|
+
"""
|
41
|
+
Mirage.prime do |mirage|
|
42
|
+
mirage.set('greeting', :response => 'hello')
|
43
|
+
end
|
44
|
+
"""
|
45
|
+
And I run 'mirage start -d /tmp/responses'
|
46
|
+
When I hit 'http://localhost:7001/mirage/primes'
|
47
|
+
And I hit 'http://localhost:7001/mirage/get/greeting'
|
48
|
+
Then 'hello' should be returned
|
49
|
+
|
50
|
+
|
51
|
+
Scenario: Priming mirage after its state has been modified
|
52
|
+
Given the file 'responses/default_greetings.rb' contains:
|
53
|
+
"""
|
54
|
+
Mirage.prime do |mirage|
|
55
|
+
mirage.set('greeting', :response => 'hello')
|
56
|
+
end
|
57
|
+
"""
|
58
|
+
And I run 'mirage start'
|
59
|
+
And I hit 'http://localhost:7001/mirage/clear'
|
60
|
+
And I hit 'http://localhost:7001/mirage/set/a_new_response' with parameters:
|
61
|
+
| response | new response |
|
62
|
+
|
63
|
+
When I hit 'http://localhost:7001/mirage/prime'
|
64
|
+
When I hit 'http://localhost:7001/mirage/get/greeting'
|
65
|
+
Then 'hello' should be returned
|
66
|
+
When I hit 'http://localhost:7001/mirage/get/a_new_response'
|
67
|
+
Then a 404 should be returned
|
68
|
+
|
69
|
+
|
70
|
+
Scenario: Mirage is started with a bad file
|
71
|
+
Given the file 'responses/default_greetings.rb' contains:
|
72
|
+
"""
|
73
|
+
A file with a mistake in it
|
74
|
+
"""
|
75
|
+
When I run 'mirage start'
|
76
|
+
Then I should see 'WARN: Unable to load default responses from: responses/default_greetings.rb' on the command line
|
77
|
+
|
78
|
+
|
79
|
+
Scenario: Mirage is primed with a bad file after it has been started
|
80
|
+
Given I run 'mirage start'
|
81
|
+
When the file 'responses/default_greetings.rb' contains:
|
82
|
+
"""
|
83
|
+
A file with a mistake in it
|
84
|
+
"""
|
85
|
+
And I hit 'http://localhost:7001/mirage/prime'
|
86
|
+
Then a 500 should be returned
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
data/features/support/env.rb
CHANGED
data/lib/mirage.rb
CHANGED
data/lib/mirage/client.rb
CHANGED
@@ -117,8 +117,8 @@ module Mirage
|
|
117
117
|
end
|
118
118
|
|
119
119
|
# Clear down the Mirage Server and load any defaults that are in Mirages default responses directory.
|
120
|
-
def
|
121
|
-
response(http_post("#{@url}/
|
120
|
+
def prime
|
121
|
+
response(http_post("#{@url}/prime"))
|
122
122
|
end
|
123
123
|
|
124
124
|
private
|
data/lib/mirage/core.rb
CHANGED
data/lib/mirage/util.rb
CHANGED
@@ -12,7 +12,7 @@ module Mirage
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def parse_options args
|
15
|
-
options = {:port => 7001, :defaults_directory => '
|
15
|
+
options = {:port => 7001, :defaults_directory => 'responses', :root_directory => '.'}
|
16
16
|
|
17
17
|
opt_parser = OptionParser.new do |opts|
|
18
18
|
opts.banner = "Usage: mirage start|stop [options]"
|
data/mirage.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'mirage'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.5'
|
4
4
|
s.authors = ["Leon Davis"]
|
5
5
|
s.homepage = 'https://github.com/lashd/mirage'
|
6
6
|
s.description = 'Mirage aids testing of your applications by hosting mock responses so that your applications do not have to talk to real endpoints. Its accessible via HTTP and has a RESTful interface.'
|
metadata
CHANGED
@@ -1,222 +1,199 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mirage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 4
|
9
|
-
version: 0.1.4
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.5
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
|
-
|
8
|
+
- Leon Davis
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-24 00:00:00 +00:00
|
18
14
|
default_executable: mirage
|
19
15
|
dependencies:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
version_requirements: *id006
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: bundler
|
100
|
-
prerelease: false
|
101
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
102
|
-
requirements:
|
103
|
-
- - ">="
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
segments:
|
106
|
-
- 0
|
107
|
-
version: "0"
|
108
|
-
type: :development
|
109
|
-
version_requirements: *id007
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rack
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 1.1.0
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ramaze
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 2011.01.30
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: mechanize
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.0.0
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rake
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "0"
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: cucumber
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: rspec
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0"
|
80
|
+
type: :development
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: bundler
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: "0"
|
91
|
+
type: :development
|
92
|
+
version_requirements: *id007
|
110
93
|
description: Mirage aids testing of your applications by hosting mock responses so that your applications do not have to talk to real endpoints. Its accessible via HTTP and has a RESTful interface.
|
111
94
|
email:
|
112
95
|
executables:
|
113
|
-
|
96
|
+
- mirage
|
114
97
|
extensions: []
|
115
98
|
|
116
99
|
extra_rdoc_files: []
|
117
100
|
|
118
101
|
files:
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
102
|
+
- .rvmrc
|
103
|
+
- Gemfile
|
104
|
+
- Gemfile.lock
|
105
|
+
- README.md
|
106
|
+
- bin/mirage
|
107
|
+
- features/checking_for_requests.feature
|
108
|
+
- features/clearing_requests_and_responses.feature
|
109
|
+
- features/client/checking_for_requests.feature
|
110
|
+
- features/client/clearing_responses.feature
|
111
|
+
- features/client/getting_responses.feature
|
112
|
+
- features/client/mirage_client.feature
|
113
|
+
- features/client/peeking.feature
|
114
|
+
- features/client/setting_responses.feature
|
115
|
+
- features/client/snapshotting.feature
|
116
|
+
- features/command_line_iterface.feature
|
117
|
+
- features/default_responses.feature
|
118
|
+
- features/file_hosting.feature
|
119
|
+
- features/logging.feature
|
120
|
+
- features/peeking_at_response.feature
|
121
|
+
- features/priming.feature
|
122
|
+
- features/resources/test.zip
|
123
|
+
- features/response_templates.feature
|
124
|
+
- features/setting_responses.feature
|
125
|
+
- features/setting_responses_with_a_delay.feature
|
126
|
+
- features/setting_responses_with_pattern_matching.feature
|
127
|
+
- features/snapshotting.feature
|
128
|
+
- features/step_definitions/my_steps.rb
|
129
|
+
- features/support/env.rb
|
130
|
+
- features/web_user_interface.feature
|
131
|
+
- full_build.sh
|
132
|
+
- lib/config.ru
|
133
|
+
- lib/mirage.rb
|
134
|
+
- lib/mirage/client.rb
|
135
|
+
- lib/mirage/core.rb
|
136
|
+
- lib/mirage/util.rb
|
137
|
+
- lib/mirage/web.rb
|
138
|
+
- lib/start_mirage.rb
|
139
|
+
- lib/view/mirage/index.xhtml
|
140
|
+
- mirage.gemspec
|
141
|
+
- rakefile
|
159
142
|
has_rdoc: true
|
160
143
|
homepage: https://github.com/lashd/mirage
|
161
144
|
licenses: []
|
162
145
|
|
163
|
-
post_install_message:
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
mirage start
|
171
|
-
===============================================================================
|
172
|
-
|
146
|
+
post_install_message: "\n\
|
147
|
+
===============================================================================\n\
|
148
|
+
Thanks you for installing mirage-0.1.5. \n\n\
|
149
|
+
Run Mirage with:\n\n\
|
150
|
+
mirage start\n\
|
151
|
+
===============================================================================\n"
|
173
152
|
rdoc_options: []
|
174
153
|
|
175
154
|
require_paths:
|
176
|
-
|
155
|
+
- lib
|
177
156
|
required_ruby_version: !ruby/object:Gem::Requirement
|
157
|
+
none: false
|
178
158
|
requirements:
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
- 0
|
183
|
-
version: "0"
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: "0"
|
184
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
|
+
none: false
|
185
164
|
requirements:
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
- 0
|
190
|
-
version: "0"
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: "0"
|
191
168
|
requirements: []
|
192
169
|
|
193
170
|
rubyforge_project:
|
194
|
-
rubygems_version: 1.
|
171
|
+
rubygems_version: 1.6.1
|
195
172
|
signing_key:
|
196
173
|
specification_version: 3
|
197
|
-
summary: mirage-0.1.
|
174
|
+
summary: mirage-0.1.5
|
198
175
|
test_files:
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
176
|
+
- features/checking_for_requests.feature
|
177
|
+
- features/clearing_requests_and_responses.feature
|
178
|
+
- features/client/checking_for_requests.feature
|
179
|
+
- features/client/clearing_responses.feature
|
180
|
+
- features/client/getting_responses.feature
|
181
|
+
- features/client/mirage_client.feature
|
182
|
+
- features/client/peeking.feature
|
183
|
+
- features/client/setting_responses.feature
|
184
|
+
- features/client/snapshotting.feature
|
185
|
+
- features/command_line_iterface.feature
|
186
|
+
- features/default_responses.feature
|
187
|
+
- features/file_hosting.feature
|
188
|
+
- features/logging.feature
|
189
|
+
- features/peeking_at_response.feature
|
190
|
+
- features/priming.feature
|
191
|
+
- features/resources/test.zip
|
192
|
+
- features/response_templates.feature
|
193
|
+
- features/setting_responses.feature
|
194
|
+
- features/setting_responses_with_a_delay.feature
|
195
|
+
- features/setting_responses_with_pattern_matching.feature
|
196
|
+
- features/snapshotting.feature
|
197
|
+
- features/step_definitions/my_steps.rb
|
198
|
+
- features/support/env.rb
|
199
|
+
- features/web_user_interface.feature
|
@@ -1,47 +0,0 @@
|
|
1
|
-
Feature: Mirage can respond with a 'root' response when a when the response requested at a sub url is not found.
|
2
|
-
I.e.
|
3
|
-
if a response is held for 'level1' and request comes in for 'level1/level2' the response for 'level1'
|
4
|
-
can be returned if nothing is held for 'level1/level2'
|
5
|
-
|
6
|
-
If a request is made and there is more than one response that could be appropriate then the closet is chosen.
|
7
|
-
|
8
|
-
E.g.
|
9
|
-
responses exist for: 'level1' and 'level1/level2'. If a response for 'level1/level2/level3 is made, then the response for
|
10
|
-
'level1/level2' will be returned as it is the most specific match out of the two.
|
11
|
-
|
12
|
-
Root responses can cause unexpected behaviour and so in order to qualify as a root reponse a client must knowingly mark it as one.
|
13
|
-
|
14
|
-
Scenario: A root response is returned
|
15
|
-
Given I hit 'http://localhost:7001/mirage/set/level0/level1' with parameters:
|
16
|
-
| response | another level |
|
17
|
-
And I hit 'http://localhost:7001/mirage/set/level1' with parameters:
|
18
|
-
| response | level 1 |
|
19
|
-
| root_response | true |
|
20
|
-
|
21
|
-
When I hit 'http://localhost:7001/mirage/get/level1/level2'
|
22
|
-
Then 'level 1' should be returned
|
23
|
-
|
24
|
-
|
25
|
-
Scenario: More than one potential root response exists
|
26
|
-
Given I hit 'http://localhost:7001/mirage/set/level1' with parameters:
|
27
|
-
| response | level 1 |
|
28
|
-
| root_response | true |
|
29
|
-
And I hit 'http://localhost:7001/mirage/set/level1/level2' with parameters:
|
30
|
-
| response | level 2 |
|
31
|
-
| root_response | true |
|
32
|
-
And I hit 'http://localhost:7001/mirage/set/level1/level2/level3' with parameters:
|
33
|
-
| response | level 3 |
|
34
|
-
| root_response | false |
|
35
|
-
And I hit 'http://localhost:7001/mirage/set/level1/level2/level3/level4/level5' with parameters:
|
36
|
-
| response | level 5 |
|
37
|
-
| root_response | true |
|
38
|
-
|
39
|
-
When I hit 'http://localhost:7001/mirage/get/level1/level2/level3/level4'
|
40
|
-
Then 'level 2' should be returned
|
41
|
-
|
42
|
-
|
43
|
-
Scenario: There isnt a root response
|
44
|
-
Given I hit 'http://localhost:7001/mirage/set/level1' with parameters:
|
45
|
-
| response | level 1 |
|
46
|
-
When I hit 'http://localhost:7001/mirage/get/level1/level2'
|
47
|
-
Then a 404 should be returned
|