John,

  I know this is quite old, but I wanted to apply your same example in 
Rspec 2.  I'm getting the following when I attempt to do so.

application_helper.rb
===========================
module ApplicationHelper

  # Return a title on a per-page basis.
  def title(page_title)
    content_for(:title) { page_title }
  end

end

application_helper_spec.rb
===========================
require 'spec_helper'

describe ApplicationHelper do

  describe "#title" do
    it "should pass through page title to tile variable" do
      self.should_receive(:content_for).with(:title, "funtitle")
      title "funtitle"
    end
  end

end


Results
==========================

  1) ApplicationHelper#title should pass through page title to tile 
variable
     Failure/Error: title "funtitle"
       #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0xb0b4fb8> 
received :content_for with unexpected arguments
         expected: (:title, "funtitle")
              got: (:title)
     # ./app/helpers/application_helper.rb:5:in `title'
     # ./spec/helpers/application_helper_spec.rb:9:in `block (3 levels) 
in <top (required)>'

  Can you see anything I'm doing wrong?

Thanks,
Paul

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to