Changeset 795

Show
Ignore:
Timestamp:
10/30/07 14:51:33 (1 year ago)
Author:
iv..@gweezlebur.com
Message:

The "Break All Your Apps" changeset:

  • respond_to is gone. use provides et al now.
  • support for .herb, .xerb, .jerb, etc is gone. use
    index.html.erb etc now.
  • support for action.erb templates in Mailer is gone.
    use action.{html|text}.erb now.

Thanks to hassox and wycats for helping sort out the mailer issues
these past few days.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/merb/abstract_controller.rb

    r769 r795  
    199199    end 
    200200     
    201      
     201 
     202    def content_type 
     203      params[:format] 
     204    end 
    202205  end   
    203206   
  • trunk/lib/merb/mail_controller.rb

    r521 r795  
    102102    # 
    103103    # The files themselves should be named action_name.mime_type.extension. For 
    104     # example, a herb template that should be the HTML part of the email, and 
    105     # rendered from the "foo" action would be named foo.html.herb. 
     104    # example, an erb template that should be the HTML part of the email, and 
     105    # rendered from the "foo" action would be named foo.html.erb. 
    106106    # 
    107107    # The only mime-types currently supported are "html" and "text", which 
     
    156156    #   render_mail :html => :foo, :text => "BAR" 
    157157    def render_mail(options = @method) 
    158       # If the options are not a hash, normalize to an action hash 
     158      @_missing_templates = false # used to make sure that at least one template was found 
     159      # # If the options are not a hash, normalize to an action hash 
    159160      options = {:action => {:html => options, :text => options}} if !options.is_a?(Hash) 
    160       # Normalize :html => :sym and :text => :sym to an action hash 
    161       options[:action] ||= {} 
    162         options[:action][:html] = options.delete(:html) if options[:html].is_a?(Symbol) 
    163         options[:action][:text] = options.delete(:text) if options[:text].is_a?(Symbol) 
    164       options.delete(:action) if options[:action].empty? 
    165  
    166       # set type to action or template, if the hash includes :action or :template 
    167       type = options.keys.find {|x| x.to_s =~ /(action|template)/} 
    168       # normalize :action/:template => ... to :action/template => {:html => ..., :text => ...} 
    169       options[type] = {:html => options[type], :text => options[type]} if type && !options[type].is_a?(Hash) 
    170       for mime_type in [:html, :text] 
    171         # if action or template, get the template to render. If not, get the string to render. If none 
    172         # are available, use the default params[:action] 
    173         renderer = (type && options[type][mime_type] ? options[type][mime_type] : options[mime_type]).to_s 
    174         # action or template 
    175         if type && options[type][mime_type] 
    176           # build the template to render 
    177           mime_renderer = renderer + ".#{mime_type}" if !(renderer =~ /.#{mime_type}$/) 
    178           if find_template(type => mime_renderer) 
    179             @mail.send((mime_type == :html ? "rawhtml=" : "text="),  
    180               render(type => mime_renderer, :layout => mimed_layout(mime_type, options[:layout])))  
    181           elsif find_template(type => renderer) && mime_type == :text 
    182             @mail.text = render(type => renderer, :layout => options[:layout]) 
     161       
     162      # Take care of the options 
     163      use_options = {} 
     164      opts = options.dup 
     165      actions = opts.delete(:action) if opts[:action].is_a?(Hash) 
     166      templates = opts.delete(:template) if opts[:template].is_a?(Hash) 
     167       
     168      # Prepare the options hash for each format 
     169      # We need to delete anything relating to the other format here 
     170      # before we try to render the template. 
     171      [:html, :text].each do |fmt| 
     172        opts_hash = use_options[fmt] = {} 
     173        opts_hash[fmt] = opts.delete(fmt) 
     174        opts_hash[fmt] ||= actions[fmt] if actions && actions[fmt] 
     175        opts_hash[:tempalte] = templates[fmt] if templates && templates[fmt] 
     176      end 
     177       
     178      # Send the result to the mailer 
     179      { :html => "rawhtml=", :text => "text="}.each do |fmt,meth| 
     180        begin 
     181          value = render use_options[fmt].merge!(opts).merge!(:clean_context => true, :format => fmt) 
     182          @mail.send(meth,value) unless value.nil? || value.empty? 
     183        rescue => e 
     184          # An error should be logged if no template is found instead of an error raised 
     185          if @_missing_templates 
     186            MERB_LOGGER.error(e) 
     187          else 
     188            @_missing_templates = true 
    183189          end 
    184         # string to render 
    185         else 
    186           @mail.send((mime_type == :html ? "rawhtml=" : "text="), renderer) 
    187190        end 
    188191      end 
     192      @mail 
    189193    end 
    190194     
     
    246250    end 
    247251     
    248     private 
    249     def mimed_layout(mime_type, layout = nil) 
    250       if layout && layout != :application 
    251         layout_choice = find_template(:layout => layout + ".#{mime_type}") || 
    252           find_template(:layout => layout) 
    253       elsif name = find_template(:layout => self.class.name.snake_case + ".#{mime_type}") 
    254         layout_choice = name 
    255       elsif name = find_template(:layout => self.class.name.snake_case) 
    256         layout_choice = name 
    257       elsif name = find_template(:layout => "application.#{mime_type}") 
    258         layout_choice = name 
    259       else 
    260         layout_choice = find_template(:layout => "application") 
    261       end 
    262       unless layout_choice 
    263         raise "No mail layout found" 
    264       end 
    265       layout_choice = layout_choice.split("/").last.split(".")[0...-1].join(".") 
    266     end 
    267      
    268252  end 
    269253end 
  • trunk/lib/merb/mixins/render.rb

    r786 r795  
    2727    # 
    2828    #   Merb::Template::Haml 
    29     # 
    30     # Erubis template ext:  .erb  
    31     # Markaby template ext: .mab 
    32     # Builder template ext: .builder 
    33     # Haml template ext: .haml 
    3429    # 
    3530    # In addition, you can identify the type of output with an  
     
    378373        extensions = Template::EXTENSIONS.keys 
    379374        glob = "#{path}.#{@_template_format}.{#{opts[:ext] || extensions.join(",")}}" 
    380         glob_old = old_style_template_glob(path, extensions, opts) 
    381         Dir[glob].first || Dir[glob_old].first || (@_merb_unmatched = glob << "<br/>Or on the old scheme<br/>" << glob_old; nil) 
     375        Dir[glob].first || (@_merb_unmatched = glob; nil) 
    382376      end 
    383377       
     
    385379      # request of the developer. 
    386380      def choose_template_format(types, opts) 
    387         opts[:format] ||= (content_type_set? ? content_type : params[:format] ) 
     381        opts[:format] ||= content_type 
    388382        @_template_format = [(opts.keys & types.keys)].flatten.first # Check for render :js => etc 
    389383        @_template_format ||= opts[:format] || :html                                            
     
    406400      end 
    407401       
    408       # this method is to support the old style of extensions.   
    409       # the newer template.format.engine should take it's place 
    410       def old_style_template_glob(path, extensions, opts) #:nodoc: 
    411         ext = [] 
    412         case opts[:format] 
    413         when :js 
    414           ext << %w(jerb) 
    415         when :xml 
    416           ext << %w(xerb rxml builder) 
    417         when :html 
    418           ext << %w(herb rhtml erb) 
    419         end 
    420         out = "#{path}.{#{(opts[:ext] || ext << extensions).join(",")}}" 
    421       end 
    422402  end   
    423403end 
  • trunk/lib/merb/mixins/responder.rb

    r784 r795  
    6969    Merb.add_mime_type(:all,nil,%w[*/*]) 
    7070    Merb.add_mime_type(:yaml,:to_yaml,%w[application/x-yaml text/yaml]) 
    71     Merb.add_mime_type(:txt,:to_text,%w[text/plain]) 
     71    Merb.add_mime_type(:text,:to_text,%w[text/plain]) 
    7272    Merb.add_mime_type(:html,nil,%w[text/html application/xhtml+xml application/html]) 
    7373    Merb.add_mime_type(:xml,:to_xml,%w[application/xml text/xml application/x-xml], :Encoding => "UTF-8") 
     
    7979  module ResponderMixin 
    8080     
    81     def respond_to(&block) 
    82       responder = Rest::Responder.new(request.accept, params) 
    83       block.call(responder) 
    84       responder.respond(headers) 
    85       @_status = responder.status if responder.status 
    86       responder.body 
    87     end 
    88      
    89     def determine_content_type 
     81    # def respond_to(&block) 
     82    #   responder = Rest::Responder.new(request.accept, params) 
     83    #   block.call(responder) 
     84    #   responder.respond(headers) 
     85    #   @_status = responder.status if responder.status 
     86    #   responder.body 
     87    # end 
     88     
     89    def perform_content_negotiation 
    9090      raise Merb::ControllerExceptions::NotAcceptable if provided_formats.empty? 
    9191      if fmt = params[:format] 
     
    114114     
    115115    def content_type 
    116       @_content_type ||= determine_content_type 
     116      unless content_type_set? 
     117        @_content_type = perform_content_negotiation 
     118        raise Merb::ControllerExceptions::NotAcceptable.new("Unknown content_type for response: #{@_content_type}") unless 
     119          Merb.available_mime_types.has_key?(@_content_type) 
     120        headers['Content-Type'] = Merb.available_mime_types[@_content_type].first 
     121      end 
     122      @_content_type 
    117123    end 
    118124     
     
    129135      class Responder 
    130136       
    131         attr_reader :body, :type, :status 
    132        
    133         def initialize(accept_header, params={}) 
    134           MERB_LOGGER.info accept_header 
    135           @accepts = Responder.parse(accept_header) 
    136           @params = params 
    137           @stack  = {} 
    138         end 
    139        
    140         def method_missing(symbol, &block) 
    141           raise "respond_to expects a block" unless block_given? 
    142           # the first method we encounter here will be used for the catch all mime-type */* 
    143           @default_content_type ||= symbol 
    144           @stack[symbol] = block 
    145         end 
    146          
    147         def respond(headers) 
    148           unless @stack.keys.all?{|k| TYPES.has_key?(k) } 
    149             raise "unrecognized mime type in respond_to block" 
    150           end 
    151           mime_type = negotiate_content 
    152           if mime_type 
    153             headers['Content-Type'] = mime_type.super_range 
    154             @params[:format] = mime_type.to_sym 
    155             @body   = @stack[mime_type.to_sym].call 
    156           else 
    157             raise ControllerExceptions::NotAcceptable 
    158           end 
    159         end 
    160  
    161137        protected 
    162138           
     
    177153          end 
    178154           
    179         private 
    180          
    181           def negotiate_content 
    182             if @params[:format] 
    183               negotiate_by_format 
    184             elsif @accepts.first.to_sym == :all || (@stack.keys & @accepts.map(&:to_sym)).size > 0 
    185               negotiate_by_accept_header 
    186             end 
    187           end 
    188            
    189           def negotiate_by_format 
    190             format = @params[:format].to_sym 
    191             if @stack[format] 
    192               if @accepts.map {|a| a.to_sym }.include?(format) 
    193                 @accepts.detect{|a| a.to_sym == format } 
    194               else 
    195                 AcceptType.new(TYPES[format].first,0) 
    196               end 
    197             end 
    198           end 
    199            
    200           def negotiate_by_accept_header 
    201             @accepts.each do |accept| 
    202               if accept.to_sym == :all 
    203                 if @default_content_type 
    204                   return AcceptType.new(TYPES[@default_content_type].first,0) 
    205                 else 
    206                   raise "no formats specified in respond_to block" 
    207                 end 
    208               end 
    209               return accept if @stack[accept.to_sym] 
    210             end 
    211           end 
    212          
    213155      end 
    214156 
  • trunk/lib/merb/test/fake_request.rb

    r603 r795  
    6363        'HTTP_CONNECTION' => 'keep-alive', 
    6464        'REQUEST_METHOD' => 'GET'       
    65       } 
     65      } unless defined?(DEFAULT_ENV) 
    6666    end 
    6767  end 
  • trunk/spec/fixtures/controllers/render_spec_controllers.rb

    r784 r795  
    1111 
    1212# Fake class so we can render subdirectories of views 
    13 class Examples < Merb::Controller; end 
     13class Examples < Merb::Controller;  
     14end 
    1415 
    1516module Nested 
     
    4748 
    4849class ExtensionTemplateController < Merb::Controller 
     50  provides :js, :xml 
    4951  def erubis_templates 
    50     respond_to do |format| 
    51       format.html { render } 
    52       format.js   { render } 
    53       format.xml  { render } 
    54     end 
     52    render 
    5553  end 
    5654 
    5755  def haml_templates 
    58     respond_to do |format| 
    59       format.html { render } 
    60       format.js   { render } 
    61       format.xml  { render } 
    62     end 
     56    render 
    6357  end 
    6458 
    6559  def markaby_templates 
    66     respond_to do |format| 
    67       format.html { render } 
    68       format.js   { render } 
    69       format.xml  { render } 
    70     end 
     60    render 
    7161  end 
    7262 
    7363  def old_style_erubis 
    74     respond_to do |format| 
    75       format.html { render } 
    76       format.js   { render } 
    77       format.xml  { render } 
    78     end 
     64    render 
    7965  end 
    8066 
    8167  def old_style_erubis2 
    82     respond_to do |format| 
    83       format.html { render } 
    84       format.js   { render } 
    85       format.xml  { render } 
    86     end 
     68    render 
    8769  end 
    8870 
    8971  def old_style_erubis3 
    90     respond_to do |format| 
    91       format.html { render } 
    92       format.xml  { render } 
    93     end 
     72    render 
    9473  end 
    9574 
    9675  def old_style_haml 
    97     respond_to do |format| 
    98       format.html { render } 
    99       format.js   { render } 
    100       format.xml  { render } 
    101     end 
     76    render 
    10277  end 
    10378 
    10479  def old_style_markaby 
    105     respond_to do |format| 
    106       format.html { render } 
    107       format.js   { render } 
    108       format.xml  { render } 
    109     end 
     80    render 
    11081  end 
    11182 
    11283  def old_style_builder 
    113     respond_to do |format| 
    114       format.html { render } 
    115       format.js   { render } 
    116       format.xml  { render } 
    117     end 
     84    render 
    11885  end 
    11986 
  • trunk/spec/merb/mail_controller_spec.rb

    r684 r795  
    5050  end 
    5151   
     52  def tenth 
     53    render_mail 
     54  end 
     55   
    5256end 
    5357 
     
    8387  it "should render files in its directory without a mimetype extension by default" do 
    8488    deliver :second 
    85     @delivery.text.should == "BASIC\nSECOND\nLAYOUT" 
     89    @delivery.text.should == "TEXT\nSECOND\nENDTEXT" 
    8690  end 
    8791   
     
    118122  it "should hold onto instance variables" do 
    119123    deliver :eighth 
    120     @delivery.text.should == "BASIC\nTEST\nLAYOUT"     
     124    @delivery.html.should == "BASIC\nTEST\nLAYOUT"     
    121125  end 
    122126   
     
    125129    @res = StringIO.new     
    126130    call_action :one 
    127     @delivery.text.should == "BASIC\nONE_CONTROLLER\nLAYOUT"     
     131    @delivery.html.should == "BASIC\nONE_CONTROLLER\nLAYOUT"     
     132  end 
     133   
     134  it "should not raise an error if there are no templates" do 
     135    lambda do 
     136      deliver :tenth     
     137    end.should_not raise_error 
     138  end 
     139   
     140  it "should log an error if there are no templates available" do 
     141    MERB_LOGGER.should_receive(:error).once 
     142    deliver :tenth 
    128143  end 
    129144   
  • trunk/spec/merb/render_spec.rb

    r784 r795  
    5050    lambda { 
    5151      c.render_no_layout(:template => nil) 
    52     }.should raise_error(Exception, "called find_template without an :action or :layout"
     52    }.should raise_error(Merb::ControllerExceptions::TemplateNotFound
    5353  end 
    5454 
     
    146146      c = new_controller 
    147147      content = c.render(:template => "erubis") 
    148       c.template.should == "erubis.herb" 
     148      c.template.should == "erubis.html.erb" 
    149149    end 
    150150 
     
    185185      c.template.should == "erubis_templates.xml.erb" 
    186186    end 
    187  
    188     it "should provide backwards compatibility and render old_style_erubis.herb" do 
    189       c = new_spec_controller(:format => 'html') 
    190       c.dispatch(:old_style_erubis) 
    191       c.template.should == "old_style_erubis.herb" 
    192     end 
    193  
    194     it "should provide backwards compatibility and render old_syle_erubis.jerb" do 
    195       c = new_spec_controller(:format => 'js') 
    196       c.dispatch(:old_style_erubis) 
    197       c.template.should == "old_style_erubis.jerb" 
    198     end 
    199  
    200     it "should provide backwards compatibility and render old_style_erubis2.rhtml" do 
    201       c = new_spec_controller(:format => 'html') 
    202       c.dispatch(:old_style_erubis2) 
    203       c.template.should == "old_style_erubis2.rhtml" 
    204     end 
    205  
    206     it "should provide backwards compatibility and render old_style_erubis3.rhtml" do 
    207       c = new_spec_controller(:format => 'html') 
    208       c.dispatch(:old_style_erubis3) 
    209       c.template.should == "old_style_erubis3.erb" 
    210     end 
    211187     
    212188    it "should render js in nested partials when the format is javascript" do 
     
    222198    end 
    223199 
    224     # it "should render js with .rhtml" do 
    225     #   c = new_spec_controller(:format => 'js') 
    226     #   c.dispatch(:old_style_erubis2) 
    227     #   c.template.should == "old_style_erubis2.rhtml" 
    228     # end 
    229  
    230200  end 
    231201 
     
    256226      c.dispatch(:markaby_templates) 
    257227      c.template.should == "markaby_templates.xml.mab" 
    258     end 
    259  
    260     it "should render all actions with .mab" do 
    261       %w( html js xml ).each do |format| 
    262         c = new_spec_controller(:format => format) 
    263         c.dispatch(:old_style_markaby) 
    264         c.template.should == "old_style_markaby.mab" 
    265       end 
    266228    end 
    267229  end 
     
    297259      end 
    298260 
    299       it "should render all actions with .haml" do 
    300         %w( html js xml ).each do |format| 
    301           c = new_spec_controller(:format => format) 
    302           c.dispatch(:old_style_haml) 
    303           c.template.should == "old_style_haml.haml" 
    304         end 
    305       end 
    306261    end 
    307262 
     
    323278      end 
    324279 
    325       it "should render all actions with .builder" do 
    326         %w( html js xml ).each do |format| 
    327           c = new_spec_controller(:format => format) 
    328           c.dispatch(:old_style_builder) 
    329           c.template.should == "old_style_builder.builder" 
    330         end 
    331       end 
    332  
    333       it "should provide backwards compatibility and render old_style_erubis.xerb" do 
    334         c = new_spec_controller(:format => "xml") 
    335         c.dispatch(:old_style_erubis) 
    336         c.template.should == "old_style_erubis.xerb" 
    337       end 
    338  
    339       it "should provide backwards compatibility and render old_style_erubis2.rxml" do 
    340         c = new_spec_controller(:format => "xml") 
    341         c.dispatch(:old_style_erubis2) 
    342         c.template.should == "old_style_erubis2.rxml" 
    343       end 
    344  
    345       it "should provide backwards compatibility and render old_style_erubis3.rxml" do 
    346         c = new_spec_controller(:format => "xml") 
    347         c.dispatch(:old_style_erubis3) 
    348         c.template.should == "old_style_erubis3.builder" 
    349       end 
    350280    end 
    351281  end 
  • trunk/spec/merb/responder_spec.rb

    r784 r795  
    224224 
    225225class ResponderSpecController < Merb::Controller 
    226    
    227226  def index 
    228     respond_to do |format| 
    229       format.html { "html" } 
    230       format.xml  { "xml" } 
    231       format.yaml { "yaml" } 
    232     end 
     227    only_provides :html, :xml, :yaml 
     228    content_type.to_s 
    233229  end 
    234230   
    235231  def create 
    236     respond_to do |format| 
    237       format.xml { render :nothing => 201 } 
    238     end 
    239   end 
    240    
     232    only_provides :xml 
     233    render :nothing => 201 
     234  end 
    241235end 
    242236 
    243237class CrazyResponderSpecController < Merb::Controller 
    244    
    245238  def index 
    246     respond_to do |format| 
    247       format.donkey { "donkey" } 
    248     end 
    249   end 
    250    
    251 end 
    252  
    253 class RespondToVsNoRespondToController < Merb::Controller 
    254    
    255   def with_respond_to 
    256     respond_to do |type| 
    257       type.html { "a response" } 
    258     end 
    259   end 
    260    
    261   def without_respond_to 
    262     "a response" 
    263   end 
     239    only_provides :donkey 
     240    content_type 
     241    "donkey" 
     242  end   
    264243end 
    265244 
     
    325304  end 
    326305   
    327   it "should raise runtime error when respond_to type is not in TYPES" do 
     306  it "should raise 406 when negotiated type is not in TYPES" do 
    328307    r = Merb::Test::FakeRequest.new 
    329308    c = CrazyResponderSpecController.build(r, r.body) 
    330     lambda{c.dispatch(:index)}.should raise_error(RuntimeError) 
    331   end 
    332    
    333   it "should return the same whether respond_to is used or not and Accept is */*" do 
    334     r1 = Merb::Test::FakeRequest.new(:http_accept => '*/*') 
    335     c1 = RespondToVsNoRespondToController.build(r1, r1.body) 
    336     c1.dispatch(:without_respond_to) 
    337     r2 = Merb::Test::FakeRequest.new(:http_accept => '*/*') 
    338     c2 = RespondToVsNoRespondToController.build(r2, r2.body) 
    339     c2.dispatch(:with_respond_to) 
    340     c1.headers['Content-Type'].should == c2.headers['Content-Type'] 
    341   end 
    342    
     309    lambda{c.dispatch(:index)}.should raise_error(Merb::ControllerExceptions::NotAcceptable) 
     310  end 
     311     
    343312  it "should call the block for the supported response type yaml" do 
    344313    c = new_responder_spec_controller(:http_accept => 'text/yaml') 
     
    387356    ResponderSpecController.build(@request, @request.body) 
    388357  end 
    389  
    390358end 
    391359 
     
    404372  end 
    405373 
    406   it "should have a determine_content_type" do 
    407     @responder.should respond_to(:determine_content_type
     374  it "should have a perform_content_negotiation" do 
     375    @responder.should respond_to(:perform_content_negotiation
    408376  end 
    409377   
     
    412380    @responder.should_receive(:provided_formats). 
    413381      at_least(:once).and_return([:html]) 
    414     @responder.determine_content_type 
     382    @responder.perform_content_negotiation 
    415383  end 
    416384   
     
    418386    @responder.should_receive(:provided_formats). 
    419387      at_least(:once).and_return([:html]) 
    420     @responder.determine_content_type 
     388    @responder.perform_content_negotiation 
    421389  end 
    422390   
     
    424392    @responder.should_receive(:params).at_least(:once). 
    425393      and_return({:format => "html"}) 
    426     @responder.determine_content_type 
     394    @responder.perform_content_negotiation 
    427395  end 
    428396 
     
    431399    @responder.should_receive(:request).once.and_return(@request) 
    432400    @request.should_receive(:accept).once.and_return("text/html") 
    433     @responder.determine_content_type 
     401    @responder.perform_content_negotiation 
    434402  end 
    435403 
    436404  it "should not use request.accept when params[:format] is not nil" do 
    437405    @responder.should_receive(:request).exactly(0).times 
    438     @responder.determine_content_type 
     406    @responder.perform_content_negotiation 
    439407  end 
    440408   
    441409  it "should return :html when params[:format] = :html" do 
    442     @responder.determine_content_type.should == :html     
     410    @responder.perform_content_negotiation.should == :html     
    443411  end 
    444412   
     
    446414    @responder.should_receive(:provided_formats).at_least(:once). 
    447415      and_return([:xml]) 
    448     lambda {@responder.determine_content_type}.should raise_error(Merb::ControllerExceptions::NotAcceptable) 
     416    lambda {@responder.perform_content_negotiation}.should raise_error(Merb::ControllerExceptions::NotAcceptable) 
    449417  end 
    450418   
     
    453421    @responder.stub!(:params).and_return({}) 
    454422    @request.should_receive(:accept).once.and_return("*/*") 
    455     @responder.determine_content_type.should == :xml 
     423    @responder.perform_content_negotiation.should == :xml 
    456424  end 
    457425 
     
    460428    @responder.stub!(:params).and_return({}) 
    461429    @request.should_receive(:accept).once.and_return("text/xml, text/html") 
    462     @responder.determine_content_type.should == :xml 
     430    @responder.perform_content_negotiation.should == :xml 
    463431  end 
    464432   
     
    467435    @responder.stub!(:params).and_return({}) 
    468436    @request.should_receive(:accept).once.and_return("text/xml, text/json") 
    469     lambda {@responder.determine_content_type}.should raise_error(Merb::ControllerExceptions::NotAcceptable) 
     437    lambda {@responder.perform_content_negotiation}.should raise_error(Merb::ControllerExceptions::NotAcceptable) 
    470438  end 
    471439   
     
    474442    @responder.should_receive(:params).exactly(0).times 
    475443    @responder.should_receive(:request).exactly(0).times 
    476     lambda {@responder.determine_content_type}.should raise_error(Merb::ControllerExceptions::NotAcceptable) 
     444    lambda {@responder.perform_content_negotiation}.should raise_error(Merb::ControllerExceptions::NotAcceptable) 
    477445  end 
    478446end 
  • trunk/spec/spec_helper.rb

    r627