exemplor 3000.2.0 → 3000.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -210,6 +210,19 @@ Running with `--list` or `-l` lists all examples:
210
210
  - called with --l arg
211
211
  - called with some other arg (always interpreted as a regex)
212
212
 
213
+ Testing Rack Apps
214
+ -----------------
215
+
216
+ Exemplor has built-in support for rack-test. First make sure you have the rack-test gem installed. Then require `exemplor/rack`, then simply call `eg.app` and pass in your rack app:
217
+
218
+ hello_app = lambda { [200,{},'oh hai'] }
219
+
220
+ eg.app hello_app
221
+
222
+ eg "rack support works" do
223
+ get '/'
224
+ Assert(last_response.body == 'oh hai')
225
+ end
213
226
 
214
227
  Thanks
215
228
  ------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3000.2.0
1
+ 3000.3.0
@@ -0,0 +1,11 @@
1
+ require 'exemplor'
2
+ require 'exemplor/rack'
3
+
4
+ simple_app = lambda { [200,{},'oh hai'] }
5
+
6
+ eg.app simple_app
7
+
8
+ eg "rack support works" do
9
+ get '/'
10
+ Assert(last_response.body == 'oh hai')
11
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{exemplor}
8
- s.version = "3000.2.0"
8
+ s.version = "3000.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Myles Byrne"]
12
- s.date = %q{2010-05-30}
12
+ s.date = %q{2010-06-10}
13
13
  s.email = %q{myles@myles.id.au}
14
14
  s.extra_rdoc_files = [
15
15
  "README.md",
@@ -36,6 +36,7 @@ Gem::Specification.new do |s|
36
36
  "examples/no_checks.rb",
37
37
  "examples/no_checks_non_string.rb",
38
38
  "examples/oneliner.rb",
39
+ "examples/rack.rb",
39
40
  "examples/show_with_disambiguation.rb",
40
41
  "examples/showing_classes.rb",
41
42
  "examples/simple_show.rb",
@@ -47,6 +48,7 @@ Gem::Specification.new do |s|
47
48
  "lib/environment.rb",
48
49
  "lib/examples.rb",
49
50
  "lib/exemplor.rb",
51
+ "lib/exemplor/rack.rb",
50
52
  "lib/ext.rb",
51
53
  "lib/result_printer.rb",
52
54
  "vendor/orderedhash-0.0.6/gemspec.rb",
@@ -86,6 +88,7 @@ Gem::Specification.new do |s|
86
88
  "examples/no_checks.rb",
87
89
  "examples/no_checks_non_string.rb",
88
90
  "examples/oneliner.rb",
91
+ "examples/rack.rb",
89
92
  "examples/show_with_disambiguation.rb",
90
93
  "examples/showing_classes.rb",
91
94
  "examples/simple_show.rb",
@@ -0,0 +1,22 @@
1
+ require 'rack/test'
2
+
3
+ class Exemplor::Environment
4
+ include Rack::Test::Methods
5
+
6
+ # Public: Sets the target app for rack/test
7
+ #
8
+ # Examples
9
+ #
10
+ # # Sinatra
11
+ # eg.app(Sinatra::Application)
12
+ # # Rails
13
+ # eg.app(ActionController::Dispatcher.new)
14
+ #
15
+ def self.app(app)
16
+ @@app = app
17
+ end
18
+
19
+ def app
20
+ @@app
21
+ end
22
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exemplor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 24023
4
+ hash: 24019
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3000
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 3000.2.0
10
+ version: 3000.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Myles Byrne
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-30 00:00:00 -05:00
18
+ date: 2010-06-10 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -49,6 +49,7 @@ files:
49
49
  - examples/no_checks.rb
50
50
  - examples/no_checks_non_string.rb
51
51
  - examples/oneliner.rb
52
+ - examples/rack.rb
52
53
  - examples/show_with_disambiguation.rb
53
54
  - examples/showing_classes.rb
54
55
  - examples/simple_show.rb
@@ -60,6 +61,7 @@ files:
60
61
  - lib/environment.rb
61
62
  - lib/examples.rb
62
63
  - lib/exemplor.rb
64
+ - lib/exemplor/rack.rb
63
65
  - lib/ext.rb
64
66
  - lib/result_printer.rb
65
67
  - vendor/orderedhash-0.0.6/gemspec.rb
@@ -127,6 +129,7 @@ test_files:
127
129
  - examples/no_checks.rb
128
130
  - examples/no_checks_non_string.rb
129
131
  - examples/oneliner.rb
132
+ - examples/rack.rb
130
133
  - examples/show_with_disambiguation.rb
131
134
  - examples/showing_classes.rb
132
135
  - examples/simple_show.rb