Created
January 24, 2012 11:01
-
-
Save mrship/1669633 to your computer and use it in GitHub Desktop.
RSpec testing within a block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PdfRenderer | |
describe Header do | |
let(:pdf) { mock(Prawn::Document) } | |
subject { Header.new(pdf) } | |
describe "#render" do | |
it "draws the header" do | |
pdf.should_receive(:repeat).with(:all) do | |
pdf.should_receive(:move_down) # this fails | |
end | |
subject.render | |
end | |
end | |
end | |
end | |
module PdfRenderer | |
class Header | |
attr_reader :pdf | |
def initialize(pdf) | |
@pdf = pdf | |
end | |
def render | |
pdf.repeat :all do | |
pdf.move_down 13.mm | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment