adamwiggins / rush

Ruby replacement for bash+ssh

This URL has Read+Write access

rush / spec / string_ext_spec.rb
100644 24 lines (18 sloc) 0.464 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require File.dirname(__FILE__) + '/base'
 
describe String do
before do
@string = "abc"
end
 
it "heads from the front of the string" do
@string.head(1).should == 'a'
end
 
it "tails from the back of the string" do
@string.tail(1).should == 'c'
end
 
it "gives the whole string when head exceeds length" do
@string.head(999).should == @string
end
 
it "gives the whole string when tail exceeds length" do
@string.tail(999).should == @string
end
end