mirage 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mirage (0.1.1)
4
+ mirage (0.1.3)
5
5
  mechanize (>= 1.0.0)
6
6
  rack (~> 1.1.0)
7
7
  ramaze (>= 2011.01.30)
data/README.md CHANGED
@@ -1,93 +1,18 @@
1
1
  Mirage
2
2
  ======
3
- Mirage is an application for hosting responses to fool your applications into thinking that they are talking to real endpoints whilst you are developing them.
4
- Its accessible via HTTP has a RESful interface so is easy to interact with.
3
+ Mirage aids testing of your applications by hosting mock responses so that your applications do not have to talk to real endpoints. It's accessible via HTTP and has a RESTful interface.
5
4
 
6
- Below are a few instructions telling you how to use Mirage. They are definately enough to get you up and running, but if you want to know everything you
7
- can do then have a look at the feature files for a complete low down. I know I know, it sounds a bit corney to say that a project's documentation is its tests. But they are written using
8
- cucumber and a lot of effort has been put in to try and make these things readable... promise!
9
-
10
- Any ideas/improvements or feedback you have are greatly appreciated.
11
-
12
- I hope that its useful.
13
-
14
- Leon
15
-
16
- P.s. Currently Mirage only runs on Linux; Rubies 1.8, 1.9 and JRuby. I plan to add support for Windows and MacOsX very soon.
17
-
18
- Installation & Running
19
- ----------------------
20
-
21
- `gem install mirage`
22
- `mirage start`
23
-
24
- That's it, its running, your done... No seriously, go to http://localhost:7001/mirage and you see that its running.
25
-
26
- There are also a [few options](https://github.com/Ladtech/sandbox/blob/master/mirage/features/setting_responses_with_a_delay.feature) that let you configure things like what port mirage is started on.
27
-
28
- Usage:
29
- ------
30
- The examples below assume that you are running mirage with the default settings.
31
-
32
- ###Set
33
- Example:
34
- http://localhost:7001/mirage/set/my_endpoint?response=hello
35
-
36
- By hitting this url, you have just put a response on mirage. Your endpoint, the bit after 'http://localhost:7001/mirage/set', can be anything you like for example 'anything/you/like'. In return for
37
- doing this Mirage will return you a response id. You can use this id to various things with this response.
38
-
39
- ###Get
40
- How do I get my response back back?
41
-
42
- Example:
43
- http://localhost:7001/mirage/get/my_endpoint
44
-
45
- All you need to do is 'get/the/endpoint' and Mirage will serve which ever response has been set.
46
-
47
- When it comes to getting and setting responses, Mirage lets you do quite a lot:
5
+ Any ideas/improvements or feedback you have are greatly appreciated.
48
6
 
49
- * [Setting responses](https://github.com/lashd/Mirage/blob/master/features/setting_responses.feature) - The basics
50
-
51
- * [Associate responses on an endpoint with a pattern](https://github.com/lashd/Mirage/blob/master/features/setting_responses_with_pattern_matching.feature) - This lets you simulate different behaviour depending on the request that is sent to Mirage
52
-
53
- * [Introduce a delay](https://github.com/Ladtech/sandbox/blob/master/mirage/features/setting_responses_with_a_delay.feature) - Make things a bit more realistic and make your application wait.
54
-
55
- * [Templatise responses](https://github.com/lashd/Mirage/blob/master/features/response_templates.feature) - Substitute values found in a request back in to the response.
7
+ Information on how to use Mirage can be found [here](https://github.com/lashd/mirage/wiki).
56
8
 
57
- * [File hosting](https://github.com/lashd/Mirage/blob/master/features/file_hosting.feature) - As well as text based responses, Mirage can also host files
58
-
59
- * [Root responses](https://github.com/lashd/Mirage/blob/master/features/root_responses.feature) - Want default a response for all urls under an endpoint? this is how.
60
-
61
- * [Default responses](https://github.com/lashd/Mirage/blob/master/features/default_responses.feature) - Prime on or after startup with a bunch of default responses
62
-
63
-
64
- ###Check
65
- If you want to see what data was sent when a response is triggered you can use the response's unique id to get that data back. This can be useful as it lets you test that your application is sending the right data.
66
- Example:
67
- http://localhost:7001/mirage/check/response_id
68
-
69
- ###Peek
70
- If you want to see a what a response is set as then you can [peek](https://github.com/lashd/Mirage/blob/master/features/peeking_at_response.feature) at it using the unique id you got when setting the response.
71
- Peeking at response will return allow you to see what a response is set to without causing a request to be tracked.
9
+ I hope you find it useful,
72
10
 
73
- Example:
74
- http://localhost:7001/mirage/peek/your_response_id
75
- ###Snapshot and Rollback
76
- Once you have set up Mirage just as you want it, you can snapshot its state. This lets you roll it back to that state when ever you want to.
77
-
78
- Example:
79
- http://localhost:7001/mirage/snapshot
80
- http://localhost:7001/mirage/rollback
81
-
82
- ###Ruby Client
83
- You can use whatever you like interact with Mirage but if you are using Ruby and you and have other things to do, then you can use
84
- the client that you get when you install Mirage.
85
-
86
- Example:
87
- require 'rubygems
88
- require 'mirage'
89
- Mirage::Client.new.set('greeting', :response=>'hello')`
11
+ Leon
90
12
 
91
- Your response is now waiting for you at: http://localhost:7001/mirage/get/greeting :)
92
- The client has methods that let allow you to fully interact with mirage. [So go ahead and check it out](https://github.com/lashd/Mirage/tree/master/features/client).
13
+ P.s. Currently Mirage only runs on Linux; Rubies 1.8, 1.9 and JRuby. I plan to add support for Windows and MacOsX very soon.
93
14
 
15
+ Installation
16
+ ------------
17
+ gem install mirage
18
+
data/lib/mirage/core.rb CHANGED
@@ -70,6 +70,7 @@ module Mirage
70
70
  @responses[name]=responses.default unless responses.default.nil?
71
71
 
72
72
  responses.each do |pattern, response|
73
+ pattern = pattern.is_a?(Regexp) ? pattern.source : pattern
73
74
  @responses["#{name}#{'/*' if response.root_response?}: #{pattern}"] = response
74
75
  end
75
76
  end
data/mirage.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'mirage'
3
- s.version = '0.1.2'
3
+ s.version = '0.1.3'
4
4
  s.authors = ["Leon Davis"]
5
5
  s.homepage = 'https://github.com/lashd/Mirage'
6
- s.description = 'Mirage is an application for hosting responses to fool your applications into thinking that they are talking to real endpoints whilst you are developing them. Its accessible via HTTP has a RESful interface so is easy to interact with.'
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.'
7
7
  s.summary = "mirage-#{s.version}"
8
8
 
9
9
  s.platform = Gem::Platform::RUBY
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mirage
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.2
5
+ version: 0.1.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Leon Davis
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-22 00:00:00 +00:00
13
+ date: 2011-03-24 00:00:00 +00:00
14
14
  default_executable: mirage
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -90,7 +90,7 @@ dependencies:
90
90
  version: "0"
91
91
  type: :development
92
92
  version_requirements: *id007
93
- description: Mirage is an application for hosting responses to fool your applications into thinking that they are talking to real endpoints whilst you are developing them. Its accessible via HTTP has a RESful interface so is easy to interact with.
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.
94
94
  email:
95
95
  executables:
96
96
  - mirage
@@ -145,7 +145,7 @@ licenses: []
145
145
 
146
146
  post_install_message: "\n\
147
147
  ===============================================================================\n\
148
- Thanks you for installing mirage-0.1.2. \n\n\
148
+ Thanks you for installing mirage-0.1.3. \n\n\
149
149
  Run Mirage with:\n\n\
150
150
  mirage start\n\
151
151
  ===============================================================================\n"
@@ -171,7 +171,7 @@ rubyforge_project:
171
171
  rubygems_version: 1.6.1
172
172
  signing_key:
173
173
  specification_version: 3
174
- summary: mirage-0.1.2
174
+ summary: mirage-0.1.3
175
175
  test_files:
176
176
  - features/checking_for_requests.feature
177
177
  - features/clearing_requests_and_responses.feature