0
@@ -71,12 +71,12 @@ describe "when drawing text" do
0
- @pdf.y.should
be_close(position - @pdf.font_metrics.font_height(12),
0
+ @pdf.y.should
.be.close(position - @pdf.font_metrics.font_height(12),
0
@pdf.text "Foo\nBar\nBaz"
0
- @pdf.y.should
be_close(position - 3*@pdf.font_metrics.font_height(12),
0
+ @pdf.y.should
.be.close(position - 3*@pdf.font_metrics.font_height(12),
0
@@ -154,13 +154,13 @@ describe "when drawing text" do
0
@pdf.text "Blaz", :at => [150,150]
0
text = observer(FontObserver)
0
- text.page_fonts.size.should eql(2)
0
- text.page_fonts[0][0].should eql(:Helvetica)
0
- text.page_fonts[1][0].should eql(:Helvetica)
0
+ text.page_fonts.size.should == 2
0
+ text.page_fonts[0][0].should == :Helvetica
0
+ text.page_fonts[1][0].should == :Helvetica
0
it "should raise an exception when an unknown font is used" do
0
- lambda { @pdf.font "Pao bu" }.should
raise_error(Prawn::Errors::UnknownFont)
0
+ lambda { @pdf.font "Pao bu" }.should
.raise(Prawn::Errors::UnknownFont)
0
if "spec".respond_to?(:encode!)
0
@@ -168,22 +168,22 @@ describe "when drawing text" do
0
it "should raise an exception when a utf-8 incompatible string is rendered" do
0
str.force_encoding("ASCII-8BIT")
0
- lambda { @pdf.text str }.should
raise_error(Prawn::Errors::IncompatibleStringEncoding)
0
+ lambda { @pdf.text str }.should
.raise(Prawn::Errors::IncompatibleStringEncoding)
0
it "should not raise an exception when a shift-jis string is rendered" do
0
datafile = "#{Prawn::BASEDIR}/data/shift_jis_text.txt"
0
- sjis_str = File.open(datafile, "r:shift_jis") { |f| f.gets }
0
- lambda { @pdf.text sjis_str }.should_not raise_error(Prawn::Errors::IncompatibleStringEncoding)
0
+ sjis_str = File.open(datafile, "r:shift_jis") { |f| f.gets }
0
+ lambda { @pdf.text sjis_str }.should.not.raise(Prawn::Errors::IncompatibleStringEncoding)
0
# Handle non utf-8 string encodings in a sane way on non-M17N aware VMs
0
it "should raise an exception when a corrupt utf-8 string is rendered" do
0
- lambda { @pdf.text str }.should
raise_error(Prawn::Errors::IncompatibleStringEncoding)
0
+ lambda { @pdf.text str }.should
.raise(Prawn::Errors::IncompatibleStringEncoding)
0
it "should raise an exception when a shift-jis string is rendered" do
0
sjis_str = File.read("#{Prawn::BASEDIR}/data/shift_jis_text.txt")
0
- lambda { @pdf.text sjis_str }.should
raise_error(Prawn::Errors::IncompatibleStringEncoding)
0
+ lambda { @pdf.text sjis_str }.should
.raise(Prawn::Errors::IncompatibleStringEncoding)
There’s also bacon (http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/307405) and facon (http://facon.rubyforge.org/rdocs/) which work quite well.
tmm1: have you tried them on Ruby 1.9.0_3 ?
The reason I went for test/spec is that at its core, it’s just Test::Unit, so I didn’t expect it to break because of that.
The reason I went for Mocha is because I’m familiar with it :)
Bacon + Facon + Autotest FTW! :)
I haven’t tested on 1.9 though, but give me a few :)
Oh, and bacon for autotest just needs a .bacon in your test/ or spec/ dir.
Seems to work on 1.9 in a few of my packages…
raggi, if you want to fork and see if you can get things working, I’d be happy to look at it. I can’t really make any promises, but I’d consider moving to Bacon/Facon if that’s what ya’ll want.
Still, I see the benefit of Test::Unit compatibility… some of my friends are anti-BDD curmudgeons :)
Understood re. BDD, the thing I love about bacon is it’s so light, and fast.
We switched from rspec to bacon when we wanted to make Ramaze 1.9 compatible. IIRC, our bacon suite passes successfully on rubinius, jruby, mri and ruby 1.9.
tmm1—why did y’all make the switch—and how would you compare the two now?
Because rspec was horribly broken on 1.9. I am a huge fan of bacon- its compact (only 300 lines!), simple (no magic, so it works on all the ruby implementations) and I prefer its syntax over rspec’s (imho, rspec is confusing and unintuitive)
rspec is huge. moving to bacon cut a few of our test run times significantly.
There may be other reasons too, but the whole lightweight nature of bacon is very appealing.
Since patching for autotest support (now upstream), I’m using it all the time.
WRT this discussion, I have made a Prawn fork yesterday that uses bacon and facon. It did highlight a couple of areas where facon still needs work, some of which I completed in my facon fork.