spec/spec.sane.rb in sane-0.25.4 vs spec/spec.sane.rb in sane-0.25.5
- old
+ new
@@ -1,5 +1,6 @@
+raise 'must be in spec dir' unless File.basename(Dir.pwd) == 'spec'
$:.unshift File.expand_path('../lib')
require 'rubygems'
require File.dirname(__FILE__) + '/../lib/sane.rb'
begin
require 'spec/autorun'
@@ -202,11 +203,17 @@
[2].sample.should == 2
end
it 'should have String#last' do
'abc'.last(2).should == 'bc'
- 'abc'.last(3).should == 'abc'
- 'abc'.last(1).should == 'c'
- 'abc'.last(0).should == '' # this is feeling weird now...
- 'abc'.last(44).should == 'abc'
+ 'abc'.last(3).should == 'abc'
+ 'abc'.last(1).should == 'c'
+ 'abc'.last(0).should == '' # this is feeling weird now...
+ 'abc'.last(44).should == 'abc'
+ end
+
+ it "should have a try2 method" do
+ 'a'.try2.gsub(/a/, 'b').should == 'b'
+ nil.try2.gsub(/a/, 'b').should == nil
+ proc { false.try2.gsub(/a/, 'b')}.should raise_exception(NoMethodError) # why would you want try on false? huh?
end
end