sinatra-contrib 1.4.7 → 2.0.0.beta1

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.
@@ -55,7 +55,8 @@ module Sinatra
55
55
  #
56
56
  # You can refine the reloading policy with +also_reload+ and
57
57
  # +dont_reload+, to customize which files should, and should not, be
58
- # reloaded, respectively.
58
+ # reloaded, respectively. You can also use +after_reload+ to execute a
59
+ # block after any file being reloaded.
59
60
  #
60
61
  # === Classic Application
61
62
  #
@@ -66,6 +67,9 @@ module Sinatra
66
67
  #
67
68
  # also_reload '/path/to/some/file'
68
69
  # dont_reload '/path/to/other/file'
70
+ # after_reload do
71
+ # puts 'reloaded'
72
+ # end
69
73
  #
70
74
  # # Your classic application code goes here...
71
75
  #
@@ -81,6 +85,9 @@ module Sinatra
81
85
  # register Sinatra::Reloader
82
86
  # also_reload '/path/to/some/file'
83
87
  # dont_reload '/path/to/other/file'
88
+ # after_reload do
89
+ # puts 'reloaded'
90
+ # end
84
91
  # end
85
92
  #
86
93
  # # Your modular application code goes here...
@@ -205,6 +212,12 @@ module Sinatra
205
212
 
206
213
  MUTEX_FOR_PERFORM = Mutex.new
207
214
 
215
+ # Allow a block to be executed after any file being reloaded
216
+ @@after_reload = []
217
+ def after_reload(&block)
218
+ @@after_reload << block
219
+ end
220
+
208
221
  # When the extension is registered it extends the Sinatra application
209
222
  # +klass+ with the modules +BaseMethods+ and +ExtensionMethods+ and
210
223
  # defines a before filter to +perform+ the reload of the modified files.
@@ -236,6 +249,7 @@ module Sinatra
236
249
  require watcher.path
237
250
  watcher.update
238
251
  end
252
+ @@after_reload.each(&:call)
239
253
  end
240
254
 
241
255
  # Contains the methods defined in Sinatra::Base that are overridden.
@@ -0,0 +1,71 @@
1
+ require 'sinatra/base'
2
+
3
+ module Sinatra
4
+ # = Sinatra::RequiredParams
5
+ #
6
+ # Ensure required query parameters
7
+ #
8
+ # == Usage
9
+ #
10
+ # Set required query parameter keys in the argument.
11
+ # It'll halt with 400 if requried keys don't exist.
12
+ #
13
+ # get '/simple_keys' do
14
+ # required_params :p1, :p2
15
+ # end
16
+ #
17
+ # Complicated pattern is also fine.
18
+ #
19
+ # get '/complicated_keys' do
20
+ # required_params :p1, :p2 => [:p3, :p4]
21
+ # end
22
+ #
23
+ # === Classic Application
24
+ #
25
+ # In a classic application simply require the helpers, and start using them:
26
+ #
27
+ # require "sinatra"
28
+ # require "sinatra/required_params"
29
+ #
30
+ # # The rest of your classic application code goes here...
31
+ #
32
+ # === Modular Application
33
+ #
34
+ # In a modular application you need to require the helpers, and then tell
35
+ # the application to use them:
36
+ #
37
+ # require "sinatra/base"
38
+ # require "sinatra/required_params"
39
+ #
40
+ # class MyApp < Sinatra::Base
41
+ # helpers Sinatra::RequiredParams
42
+ #
43
+ # # The rest of your modular application code goes here...
44
+ # end
45
+ #
46
+ module RequiredParams
47
+ def required_params(*keys)
48
+ _required_params(params, *keys)
49
+ end
50
+
51
+ private
52
+
53
+ def _required_params(p, *keys)
54
+ keys.each do |key|
55
+ if key.is_a?(Hash)
56
+ _required_params(p, *key.keys)
57
+ key.each do |k, v|
58
+ _required_params(p[k.to_s], v)
59
+ end
60
+ elsif key.is_a?(Array)
61
+ _required_params(p, *key)
62
+ else
63
+ halt 400 unless p.has_key?(key.to_s)
64
+ end
65
+ end
66
+ true
67
+ end
68
+ end
69
+
70
+ helpers RequiredParams
71
+ end
@@ -1,8 +1,6 @@
1
1
  require 'sinatra/json'
2
2
  require 'sinatra/base'
3
3
 
4
- $KCODE = "UTF-8" unless RUBY_VERSION > "1.9.0"
5
-
6
4
  module Sinatra
7
5
  #
8
6
  # = Sinatra::RespondWith
@@ -117,7 +115,7 @@ module Sinatra
117
115
  @app.halt result
118
116
  end
119
117
  end
120
- @app.halt 406
118
+ @app.halt 500, "Unknown template engine"
121
119
  end
122
120
 
123
121
  def method_missing(method, *args, &block)
@@ -179,7 +177,11 @@ module Sinatra
179
177
  if Tilt.respond_to?(:mappings)
180
178
  klass = Tilt.mappings[Tilt.normalize(engine)].first
181
179
  else
182
- klass = Tilt[engine]
180
+ begin
181
+ klass = Tilt[engine]
182
+ rescue LoadError
183
+ next
184
+ end
183
185
  end
184
186
  find_template(settings.views, template, klass) do |file|
185
187
  next unless File.exist? file
@@ -249,7 +251,7 @@ module Sinatra
249
251
  }
250
252
  engines.default = []
251
253
  (defined? JRUBY_VERSION) ? jrubyify(engines) : engines
252
- end
254
+ end
253
255
 
254
256
  def self.registered(base)
255
257
  base.set :ext_map, Hash.new { |h,k| h[k] = [] }
@@ -1,10 +1,11 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- # Run `rake sinatra-contrib.gemspec` to update the gemspec.
4
- require File.expand_path('../lib/sinatra/contrib/version', __FILE__)
3
+ $:.unshift File.expand_path("../../lib", __FILE__)
4
+ require "sinatra/version"
5
+
5
6
  Gem::Specification.new do |s|
6
7
  s.name = "sinatra-contrib"
7
- s.version = Sinatra::Contrib::VERSION
8
+ s.version = Sinatra::VERSION
8
9
  s.description = "Collection of useful Sinatra extensions"
9
10
  s.homepage = "http://github.com/sinatra/sinatra-contrib"
10
11
  s.license = "MIT"
@@ -137,7 +138,6 @@ Gem::Specification.new do |s|
137
138
  "lib/sinatra/contrib/version.rb",
138
139
  "lib/sinatra/cookies.rb",
139
140
  "lib/sinatra/custom_logger.rb",
140
- "lib/sinatra/decompile.rb",
141
141
  "lib/sinatra/engine_tracking.rb",
142
142
  "lib/sinatra/extension.rb",
143
143
  "lib/sinatra/json.rb",
@@ -147,6 +147,7 @@ Gem::Specification.new do |s|
147
147
  "lib/sinatra/reloader.rb",
148
148
  "lib/sinatra/respond_with.rb",
149
149
  "lib/sinatra/streaming.rb",
150
+ "lib/sinatra/required_params.rb",
150
151
  "lib/sinatra/test_helpers.rb",
151
152
  "sinatra-contrib.gemspec",
152
153
  "spec/capture_spec.rb",
@@ -192,7 +193,6 @@ Gem::Specification.new do |s|
192
193
  "spec/content_for_spec.rb",
193
194
  "spec/cookies_spec.rb",
194
195
  "spec/custom_logger_spec.rb",
195
- "spec/decompile_spec.rb",
196
196
  "spec/extension_spec.rb",
197
197
  "spec/json_spec.rb",
198
198
  "spec/link_header_spec.rb",
@@ -210,17 +210,21 @@ Gem::Specification.new do |s|
210
210
  "spec/respond_with/not_html.sass",
211
211
  "spec/respond_with_spec.rb",
212
212
  "spec/spec_helper.rb",
213
- "spec/streaming_spec.rb"
213
+ "spec/streaming_spec.rb",
214
+ "spec/required_params_spec.rb",
214
215
  ]
215
216
 
216
- s.add_dependency "sinatra", "~> 1.4.0"
217
+ s.required_ruby_version = '>= 2.2.0'
218
+
219
+ s.add_dependency "sinatra", Sinatra::VERSION
220
+ s.add_dependency "mustermann", "1.0.0.beta2"
217
221
  s.add_dependency "backports", ">= 2.0"
218
222
  s.add_dependency "tilt", ">= 1.3", "< 3"
219
223
  s.add_dependency "rack-test"
220
- s.add_dependency "rack-protection"
224
+ s.add_dependency "rack-protection", Sinatra::VERSION
221
225
  s.add_dependency "multi_json"
222
226
 
223
- s.add_development_dependency "rspec", "~> 2.3"
227
+ s.add_development_dependency "rspec", "~> 3.4"
224
228
  s.add_development_dependency "haml"
225
229
  s.add_development_dependency "erubis"
226
230
  s.add_development_dependency "slim"
@@ -229,7 +233,7 @@ Gem::Specification.new do |s|
229
233
  s.add_development_dependency "builder"
230
234
  s.add_development_dependency "liquid"
231
235
  s.add_development_dependency "redcarpet"
232
- s.add_development_dependency "RedCloth"
236
+ s.add_development_dependency "RedCloth", "~> 4.2.9"
233
237
  s.add_development_dependency "asciidoctor"
234
238
  s.add_development_dependency "radius"
235
239
  s.add_development_dependency "coffee-script"
@@ -23,11 +23,11 @@ describe Sinatra::Capture do
23
23
  require "#{engine}"
24
24
 
25
25
  it "captures content" do
26
- render(engine, "simple_#{lang}").should == "Say Hello World!"
26
+ expect(render(engine, "simple_#{lang}")).to eq("Say Hello World!")
27
27
  end
28
28
 
29
29
  it "allows nested captures" do
30
- render(engine, "nested_#{lang}").should == "Say Hello World!"
30
+ expect(render(engine, "nested_#{lang}")).to eq("Say Hello World!")
31
31
  end
32
32
  end
33
33
 
@@ -39,12 +39,12 @@ describe Sinatra::Capture do
39
39
  it_behaves_like "a template language", :erb
40
40
 
41
41
  it "handles utf-8 encoding" do
42
- render(:erb, "utf_8").should == "UTF-8 –"
42
+ expect(render(:erb, "utf_8")).to eq("UTF-8 –")
43
43
  end
44
44
 
45
45
  it "handles ISO-8859-1 encoding" do
46
- render(:erb, "iso_8859_1").should == "ISO-8859-1 -"
47
- end if RUBY_VERSION >= '1.9'
46
+ expect(render(:erb, "iso_8859_1")).to eq("ISO-8859-1 -")
47
+ end
48
48
  end
49
49
  end
50
50
 
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  foo: bar
3
+ bar: <%= "bar" %>
3
4
  something: 42
4
5
  nested:
5
6
  a: 1
@@ -12,19 +12,19 @@ describe Sinatra::ConfigFile do
12
12
 
13
13
  it 'should set options from a simple config_file' do
14
14
  config_file 'key_value.yml'
15
- settings.foo.should == 'bar'
16
- settings.something.should == 42
15
+ expect(settings.foo).to eq('bar')
16
+ expect(settings.something).to eq(42)
17
17
  end
18
18
 
19
19
  it 'should create indifferent hashes' do
20
20
  config_file 'key_value.yml'
21
- settings.nested['a'].should == 1
22
- settings.nested[:a].should == 1
21
+ expect(settings.nested['a']).to eq(1)
22
+ expect(settings.nested[:a]).to eq(1)
23
23
  end
24
24
 
25
- it 'should render options in ERB tags' do
26
- config_file 'key_value.yml.erb'
27
- settings.foo.should == "bar"
25
+ it 'should render options in ERB tags when using .yml files' do
26
+ config_file 'key_value.yml'
27
+ settings.bar.should == "bar"
28
28
  settings.something.should == 42
29
29
  settings.nested['a'].should == 1
30
30
  settings.nested[:a].should == 1
@@ -32,31 +32,45 @@ describe Sinatra::ConfigFile do
32
32
  settings.nested[:b].should == 2
33
33
  end
34
34
 
35
+ it 'should render options in ERB tags when using .yml.erb files' do
36
+ config_file 'key_value.yml.erb'
37
+ expect(settings.foo).to eq("bar")
38
+ expect(settings.something).to eq(42)
39
+ expect(settings.nested['a']).to eq(1)
40
+ expect(settings.nested[:a]).to eq(1)
41
+ expect(settings.nested['b']).to eq(2)
42
+ expect(settings.nested[:b]).to eq(2)
43
+ end
44
+
45
+ it 'should raise error if config file extension is not .yml or .erb' do
46
+ expect{ config_file 'config.txt' }.to raise_error(Sinatra::ConfigFile::UnsupportedConfigType)
47
+ end
48
+
35
49
  it 'should recognize env specific settings per file' do
36
50
  config_file 'with_envs.yml'
37
- settings.foo.should == 'test'
51
+ expect(settings.foo).to eq('test')
38
52
  end
39
53
 
40
54
  it 'should recognize env specific settings per setting' do
41
55
  config_file 'with_nested_envs.yml'
42
- settings.database[:adapter].should == 'sqlite'
56
+ expect(settings.database[:adapter]).to eq('sqlite')
43
57
  end
44
58
 
45
59
  it 'should not set present values to nil if the current env is missing' do
46
60
  # first let's check the test is actually working properly
47
61
  config_file('missing_env.yml') { set :foo => 42, :environment => :production }
48
- settings.foo.should == 10
62
+ expect(settings.foo).to eq(10)
49
63
  # now test it
50
64
  config_file('missing_env.yml') { set :foo => 42, :environment => :test }
51
- settings.foo.should == 42
65
+ expect(settings.foo).to eq(42)
52
66
  end
53
67
 
54
68
  it 'should prioritize settings in latter files' do
55
69
  # first let's check the test is actually working properly
56
70
  config_file 'key_value.yml'
57
- settings.foo.should == 'bar'
71
+ expect(settings.foo).to eq('bar')
58
72
  # now test it
59
73
  config_file 'key_value_override.yml'
60
- settings.foo.should == 'foo'
74
+ expect(settings.foo).to eq('foo')
61
75
  end
62
76
  end
@@ -1,2 +1,2 @@
1
1
  - if content_for? :foo
2
- = yield_content :foo
2
+ = yield_content :foo
@@ -1,2 +1,2 @@
1
1
  - if content_for? :foo
2
- = yield_content :foo
2
+ = yield_content :foo
@@ -11,7 +11,7 @@ describe Sinatra::ContentFor do
11
11
  Tilt.prefer Tilt::ERBTemplate
12
12
 
13
13
  extend Forwardable
14
- def_delegators :subject, :content_for, :yield_content
14
+ def_delegators :subject, :content_for, :clear_content_for, :yield_content
15
15
  def render(engine, template)
16
16
  subject.send(:render, engine, template, :layout => false).gsub(/\s/, '')
17
17
  end
@@ -19,17 +19,22 @@ describe Sinatra::ContentFor do
19
19
  describe "without templates" do
20
20
  it 'renders blocks declared with the same key you use when rendering' do
21
21
  content_for(:foo) { "foo" }
22
- yield_content(:foo).should == "foo"
22
+ expect(yield_content(:foo)).to eq("foo")
23
23
  end
24
24
 
25
25
  it 'renders blocks more than once' do
26
26
  content_for(:foo) { "foo" }
27
- 3.times { yield_content(:foo).should == "foo" }
27
+ 3.times { expect(yield_content(:foo)).to eq("foo") }
28
28
  end
29
29
 
30
30
  it 'does not render a block with a different key' do
31
31
  content_for(:bar) { "bar" }
32
- yield_content(:foo).should be_empty
32
+ expect(yield_content(:foo)).to be_empty
33
+ end
34
+
35
+ it 'renders default content if no block matches the key and a default block is specified' do
36
+ content_for(:bar) { "bar" }
37
+ expect(yield_content(:foo) { "foo" }).to eq("foo")
33
38
  end
34
39
 
35
40
  it 'renders multiple blocks with the same key' do
@@ -37,7 +42,7 @@ describe Sinatra::ContentFor do
37
42
  content_for(:foo) { "bar" }
38
43
  content_for(:bar) { "WON'T RENDER ME" }
39
44
  content_for(:foo) { "baz" }
40
- yield_content(:foo).should == "foobarbaz"
45
+ expect(yield_content(:foo)).to eq("foobarbaz")
41
46
  end
42
47
 
43
48
  it 'renders multiple blocks more than once' do
@@ -45,13 +50,25 @@ describe Sinatra::ContentFor do
45
50
  content_for(:foo) { "bar" }
46
51
  content_for(:bar) { "WON'T RENDER ME" }
47
52
  content_for(:foo) { "baz" }
48
- 3.times { yield_content(:foo).should == "foobarbaz" }
53
+ 3.times { expect(yield_content(:foo)).to eq("foobarbaz") }
49
54
  end
50
55
 
51
56
  it 'passes values to the blocks' do
52
57
  content_for(:foo) { |a| a.upcase }
53
- yield_content(:foo, 'a').should == "A"
54
- yield_content(:foo, 'b').should == "B"
58
+ expect(yield_content(:foo, 'a')).to eq("A")
59
+ expect(yield_content(:foo, 'b')).to eq("B")
60
+ end
61
+
62
+ it 'clears named blocks with the specified key' do
63
+ content_for(:foo) { "foo" }
64
+ expect(yield_content(:foo)).to eq("foo")
65
+ clear_content_for(:foo)
66
+ expect(yield_content(:foo)).to be_empty
67
+ end
68
+
69
+ it 'takes an immediate value instead of a block' do
70
+ content_for(:foo, "foo")
71
+ expect(yield_content(:foo)).to eq("foo")
55
72
  end
56
73
  end
57
74
 
@@ -64,56 +81,61 @@ describe Sinatra::ContentFor do
64
81
  begin
65
82
  require inner
66
83
  rescue LoadError => e
67
- pending "Skipping: " << e.message
84
+ skip "Skipping: " << e.message
68
85
  end
69
86
  end
70
87
 
71
88
  describe "with yield_content in Ruby" do
72
89
  it 'renders blocks declared with the same key you use when rendering' do
73
90
  render inner, :same_key
74
- yield_content(:foo).strip.should == "foo"
91
+ expect(yield_content(:foo).strip).to eq("foo")
75
92
  end
76
93
 
77
94
  it 'renders blocks more than once' do
78
95
  render inner, :same_key
79
- 3.times { yield_content(:foo).strip.should == "foo" }
96
+ 3.times { expect(yield_content(:foo).strip).to eq("foo") }
80
97
  end
81
98
 
82
99
  it 'does not render a block with a different key' do
83
100
  render inner, :different_key
84
- yield_content(:foo).should be_empty
101
+ expect(yield_content(:foo)).to be_empty
102
+ end
103
+
104
+ it 'renders default content if no block matches the key and a default block is specified' do
105
+ render inner, :different_key
106
+ expect(yield_content(:foo) { "foo" }).to eq("foo")
85
107
  end
86
108
 
87
109
  it 'renders multiple blocks with the same key' do
88
110
  render inner, :multiple_blocks
89
- yield_content(:foo).gsub(/\s/, '').should == "foobarbaz"
111
+ expect(yield_content(:foo).gsub(/\s/, '')).to eq("foobarbaz")
90
112
  end
91
113
 
92
114
  it 'renders multiple blocks more than once' do
93
115
  render inner, :multiple_blocks
94
- 3.times { yield_content(:foo).gsub(/\s/, '').should == "foobarbaz" }
116
+ 3.times { expect(yield_content(:foo).gsub(/\s/, '')).to eq("foobarbaz") }
95
117
  end
96
118
 
97
119
  it 'passes values to the blocks' do
98
120
  render inner, :takes_values
99
- yield_content(:foo, 1, 2).gsub(/\s/, '').should == "<i>1</i>2"
121
+ expect(yield_content(:foo, 1, 2).gsub(/\s/, '')).to eq("<i>1</i>2")
100
122
  end
101
123
  end
102
124
 
103
125
  describe "with content_for in Ruby" do
104
126
  it 'renders blocks declared with the same key you use when rendering' do
105
127
  content_for(:foo) { "foo" }
106
- render(inner, :layout).should == "foo"
128
+ expect(render(inner, :layout)).to eq("foo")
107
129
  end
108
130
 
109
131
  it 'renders blocks more than once' do
110
132
  content_for(:foo) { "foo" }
111
- render(inner, :multiple_yields).should == "foofoofoo"
133
+ expect(render(inner, :multiple_yields)).to eq("foofoofoo")
112
134
  end
113
135
 
114
136
  it 'does not render a block with a different key' do
115
137
  content_for(:bar) { "foo" }
116
- render(inner, :layout).should be_empty
138
+ expect(render(inner, :layout)).to be_empty
117
139
  end
118
140
 
119
141
  it 'renders multiple blocks with the same key' do
@@ -121,7 +143,7 @@ describe Sinatra::ContentFor do
121
143
  content_for(:foo) { "bar" }
122
144
  content_for(:bar) { "WON'T RENDER ME" }
123
145
  content_for(:foo) { "baz" }
124
- render(inner, :layout).should == "foobarbaz"
146
+ expect(render(inner, :layout)).to eq("foobarbaz")
125
147
  end
126
148
 
127
149
  it 'renders multiple blocks more than once' do
@@ -129,24 +151,31 @@ describe Sinatra::ContentFor do
129
151
  content_for(:foo) { "bar" }
130
152
  content_for(:bar) { "WON'T RENDER ME" }
131
153
  content_for(:foo) { "baz" }
132
- render(inner, :multiple_yields).should == "foobarbazfoobarbazfoobarbaz"
154
+ expect(render(inner, :multiple_yields)).to eq("foobarbazfoobarbazfoobarbaz")
133
155
  end
134
156
 
135
157
  it 'passes values to the blocks' do
136
158
  content_for(:foo) { |a,b| "<i>#{a}</i>#{b}" }
137
- render(inner, :passes_values).should == "<i>1</i>2"
159
+ expect(render(inner, :passes_values)).to eq("<i>1</i>2")
160
+ end
161
+
162
+ it 'clears named blocks with the specified key' do
163
+ content_for(:foo) { "foo" }
164
+ expect(render(inner, :layout)).to eq("foo")
165
+ clear_content_for(:foo)
166
+ expect(render(inner, :layout)).to be_empty
138
167
  end
139
168
  end
140
169
 
141
170
  describe "with content_for? in Ruby" do
142
171
  it 'renders block if key is set' do
143
172
  content_for(:foo) { "foot" }
144
- render(inner, :footer).should == "foot"
173
+ expect(render(inner, :footer)).to eq("foot")
145
174
  end
146
175
 
147
176
  it 'does not render a block if different key' do
148
177
  content_for(:different_key) { "foot" }
149
- render(inner, :footer).should be_empty
178
+ expect(render(inner, :footer)).to be_empty
150
179
  end
151
180
  end
152
181
 
@@ -160,7 +189,7 @@ describe Sinatra::ContentFor do
160
189
  begin
161
190
  require outer
162
191
  rescue LoadError => e
163
- pending "Skipping: " << e.message
192
+ skip "Skipping: " << e.message
164
193
  end
165
194
  end
166
195
 
@@ -177,33 +206,33 @@ describe Sinatra::ContentFor do
177
206
  end
178
207
 
179
208
  it 'renders blocks declared with the same key you use when rendering' do
180
- get('/same_key').should be_ok
181
- body.should == "foo"
209
+ expect(get('/same_key')).to be_ok
210
+ expect(body).to eq("foo")
182
211
  end
183
212
 
184
213
  it 'renders blocks more than once' do
185
- get('/multiple_yields/same_key').should be_ok
186
- body.should == "foofoofoo"
214
+ expect(get('/multiple_yields/same_key')).to be_ok
215
+ expect(body).to eq("foofoofoo")
187
216
  end
188
217
 
189
218
  it 'does not render a block with a different key' do
190
- get('/different_key').should be_ok
191
- body.should be_empty
219
+ expect(get('/different_key')).to be_ok
220
+ expect(body).to be_empty
192
221
  end
193
222
 
194
223
  it 'renders multiple blocks with the same key' do
195
- get('/multiple_blocks').should be_ok
196
- body.should == "foobarbaz"
224
+ expect(get('/multiple_blocks')).to be_ok
225
+ expect(body).to eq("foobarbaz")
197
226
  end
198
227
 
199
228
  it 'renders multiple blocks more than once' do
200
- get('/multiple_yields/multiple_blocks').should be_ok
201
- body.should == "foobarbazfoobarbazfoobarbaz"
229
+ expect(get('/multiple_yields/multiple_blocks')).to be_ok
230
+ expect(body).to eq("foobarbazfoobarbazfoobarbaz")
202
231
  end
203
232
 
204
233
  it 'passes values to the blocks' do
205
- get('/passes_values/takes_values').should be_ok
206
- body.should == "<i>1</i>2"
234
+ expect(get('/passes_values/takes_values')).to be_ok
235
+ expect(body).to eq("<i>1</i>2")
207
236
  end
208
237
  end
209
238
  end