diff --git a/sinatra-contrib/lib/sinatra/namespace.rb b/sinatra-contrib/lib/sinatra/namespace.rb index 15e14862..ab619295 100644 --- a/sinatra-contrib/lib/sinatra/namespace.rb +++ b/sinatra-contrib/lib/sinatra/namespace.rb @@ -183,7 +183,7 @@ module Sinatra def namespace_errors @errors end - + def error(*codes, &block) args = Sinatra::Base.send(:compile!, "ERROR", /^#{@pattern}/, block) codes = codes.map { |c| Array(c) }.flatten diff --git a/sinatra-contrib/spec/capture_spec.rb b/sinatra-contrib/spec/capture_spec.rb index d621d3ef..ecead8f3 100644 --- a/sinatra-contrib/spec/capture_spec.rb +++ b/sinatra-contrib/spec/capture_spec.rb @@ -61,13 +61,13 @@ Say Hello <%= a.strip %> @@ simple_slim -| Say +| Say - a = capture do | World | Hello #{a.strip}! @@ nested_slim -| Say +| Say - a = capture do - b = capture do | World diff --git a/sinatra-contrib/spec/content_for_spec.rb b/sinatra-contrib/spec/content_for_spec.rb index b318ac21..ce29b909 100644 --- a/sinatra-contrib/spec/content_for_spec.rb +++ b/sinatra-contrib/spec/content_for_spec.rb @@ -138,13 +138,13 @@ describe Sinatra::ContentFor do render(inner, :passes_values).should == "12" end end - + describe "with content_for? in Ruby" do - it 'renders block if key is set' do + it 'renders block if key is set' do content_for(:foo) { "foot" } render(inner, :footer).should == "foot" end - + it 'does not render a block if different key' do content_for(:different_key) { "foot" } render(inner, :footer).should be_empty diff --git a/sinatra-contrib/spec/namespace_spec.rb b/sinatra-contrib/spec/namespace_spec.rb index 0b5ead4c..98009967 100644 --- a/sinatra-contrib/spec/namespace_spec.rb +++ b/sinatra-contrib/spec/namespace_spec.rb @@ -54,7 +54,7 @@ describe Sinatra::Namespace do send(verb, "/fox/bar").should be_ok body.should == "fox" unless verb == :head end - + it "sets params correctly from route" do namespace("/foo") { send(verb, "/:bar") { params[:bar] }} send(verb, "/foo/bar").should be_ok @@ -89,7 +89,7 @@ describe Sinatra::Namespace do it 'allows defining routes without a pattern' do namespace(%r{/foo}) { send(verb) { 'bar' } } send(verb, '/foo').should be_ok - body.should == 'bar' unless verb == :head + body.should == 'bar' unless verb == :head end end @@ -509,7 +509,7 @@ describe Sinatra::Namespace do mock_app { class AError < StandardError; end class BError < AError; end - + error(AError) { body('auth failed'); 401} namespace('/en') do get '/foo' do