sinatra_fake_webservice 0.9.0 → 0.9.1
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/README.rdoc +23 -7
- data/VERSION +1 -1
- data/lib/sinatra_webservice.rb +1 -1
- data/sinatra_fake_webservice.gemspec +1 -1
- data/test/test_sinatra_fake_webservice.rb +2 -0
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -9,7 +9,7 @@ FakeWeb is awesome, but it allows you only to register *one* response per url, a
|
|
9
9
|
== Installation
|
10
10
|
|
11
11
|
Command line:
|
12
|
-
sudo gem install sinatra_fake_webservice
|
12
|
+
sudo gem install sinatra_fake_webservice
|
13
13
|
|
14
14
|
Or in bundler (0.9.x) add this line to your .gemfile:
|
15
15
|
|
@@ -26,17 +26,33 @@ and then simply use the familiar sinatra DSL to create methods and responses.
|
|
26
26
|
|
27
27
|
@fakews.get '/awesome' do
|
28
28
|
"YAY!!"
|
29
|
-
end
|
29
|
+
end
|
30
|
+
|
31
|
+
@fakews.post '/omglol' do
|
32
|
+
"YAY!! i posted #{params[:awesome]}"
|
33
|
+
end
|
30
34
|
|
35
|
+
@fakews.delete '/awesome' do
|
36
|
+
"there, i kiiled #{params[:id]}"
|
37
|
+
end
|
38
|
+
|
39
|
+
@fakews.put '/awesome' do
|
40
|
+
"yay, i saved the worlds"
|
41
|
+
end
|
42
|
+
|
31
43
|
tada!
|
32
44
|
|
33
|
-
|
45
|
+
== Tests
|
34
46
|
|
35
|
-
|
36
|
-
|
37
|
-
|
47
|
+
I added a few methods to wrap HTTP requests:
|
48
|
+
|
49
|
+
* get_response(path)
|
50
|
+
* post_response(path, data, headers, dest)
|
51
|
+
* put_response(path, data, headers, dest)
|
52
|
+
* delete_response(path, data, headers, dest)
|
53
|
+
|
54
|
+
The most important thing to remember, is that you'll have to point your webservice api wrapper (twitter_auth or whatever) to use "localhost" and the fake sinatra app's port, available via a simple getter (#port).
|
38
55
|
|
39
|
-
assert_equal "YAY!!", res.body
|
40
56
|
|
41
57
|
== Note on Patches/Pull Requests
|
42
58
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.1
|
data/lib/sinatra_webservice.rb
CHANGED