spec/seq_spec.rb in rouge-lang-0.0.6 vs spec/seq_spec.rb in rouge-lang-0.0.7
- old
+ new
@@ -11,11 +11,11 @@
end
describe "#seq" do
it "should return the original object" do
seq.seq.should be seq
- end
+ end
end
describe "the unimplemented methods" do
it { expect { seq.first
}.to raise_exception NotImplementedError }
@@ -193,9 +193,33 @@
it { should be_an_instance_of Rouge::Seq::Array }
it { should eq Rouge::Seq::Array.new([:a], 0) }
let(:arrayseq) { Rouge::Seq::Array.new([:a], 0) }
it { Rouge::Seq.seq(arrayseq).should be arrayseq }
+ end
+
+ context Set do
+ subject { Rouge::Seq.seq(Set.new([1, 2, 3])) }
+ it { should be_an_instance_of Rouge::Seq::Array }
+ it { should eq Rouge::Seq::Array.new([1, 2, 3], 0) }
+ end
+
+ context Hash do
+ subject { Rouge::Seq.seq({:a => "a", :b => "b"}) }
+ it { should be_an_instance_of Rouge::Seq::Array }
+ it { should eq Rouge::Seq::Array.new([[:a, "a"], [:b, "b"]], 0) }
+ end
+
+ context String do
+ subject { Rouge::Seq.seq("foo") }
+ it { should be_an_instance_of Rouge::Seq::Array }
+ it { should eq Rouge::Seq::Array.new(['f', 'o', 'o'], 0) }
+ end
+
+ context Enumerator do
+ subject { Rouge::Seq.seq(1.upto(3)) }
+ it { should be_an_instance_of Rouge::Seq::Array }
+ it { should eq Rouge::Seq::Array.new([1, 2, 3], 0) }
end
end
end
# vim: set sw=2 et cc=80: