Skip to content

Instantly share code, notes, and snippets.

@katsuyoshi
Created August 28, 2012 01:56
Show Gist options
  • Save katsuyoshi/3494237 to your computer and use it in GitHub Desktop.
Save katsuyoshi/3494237 to your computer and use it in GitHub Desktop.
spec file for nsindexpath in sugarcube
describe NSIndexPath do
describe "NSIndexPath('0', '1').to_a" do
before do
@subject = ["0", "1"].nsindexpath.to_a
end
it "should be [0, 1]" do
@subject.should == [0, 1]
end
end
describe "NSIndexPath(0, 1)" do
before do
@subject = [0, 1].nsindexpath
end
it "should equal [0, 1]" do
@subject.===([0, 1]).should == true
end
it "should equal [0]" do
@subject.===([0]).should == true
end
it "should equal [0, 0..1]" do
@subject.===([0, 0..1]).should == true
end
it "should not equal [0, 2]" do
@subject.===([0, 2]).should == false
end
it "should not equal [1, 1]" do
@subject.===([1, 1]).should == false
end
it "should not equal [1]" do
@subject.===([1]).should == false
end
it "should not equal [0, 2..3]" do
@subject.===([0, 2..3]).should == false
end
it "should equal " do
r = nil
case @subject
when [0, 1]
r = 1
end
r.should == 1
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment