test/model/spec_string.rb in pione-0.1.3 vs test/model/spec_string.rb in pione-0.1.4
- old
+ new
@@ -18,12 +18,12 @@
@a.should.not == @b
end
it 'should expand variables' do
vtable = VariableTable.new({
- Variable.new("var1") => PioneString.new("a"),
- Variable.new("var2") => PioneString.new("b")
+ Variable.new("var1") => PioneString.new("a").to_seq,
+ Variable.new("var2") => PioneString.new("b").to_seq
})
PioneString.new("{$var1}:{$var2}").eval(vtable).should ==
PioneString.new("a:b")
end
@@ -33,74 +33,7 @@
PioneString.new("1 + 1 = 2")
PioneString.new("1 + 2 = <? 1 + 2 ?>").eval(vtable).should ==
PioneString.new("1 + 2 = 3")
end
- describe 'pione method ==' do
- it 'should true' do
- @a.call_pione_method("==", PioneString.new("a")).should.true
- end
-
- it 'should false' do
- @a.call_pione_method("==", @b).should.not.true
- end
-
- it 'should raise type error' do
- should.raise(PioneModelTypeError) do
- @a.call_pione_method("==", PioneInteger.new(1))
- end
- end
- end
-
- describe 'pione method !=' do
- it 'should true' do
- @a.call_pione_method("!=", @b).should.true
- end
-
- it 'should false' do
- @a.call_pione_method("!=", PioneString.new("a")).should.not.true
- end
-
- it 'should raise type error' do
- should.raise(PioneModelTypeError) do
- @a.call_pione_method("!=", PioneInteger.new(1))
- end
- end
- end
-
- describe 'pione method +' do
- it 'should get appended string' do
- @a.call_pione_method("+", @b).should == PioneString.new("ab")
- end
-
- it 'should raise type error' do
- should.raise(PioneModelTypeError) do
- @a.call_pione_method("!=", PioneInteger.new(1))
- end
- end
- end
-
- describe 'pione method as_string' do
- it 'should get string' do
- @a.call_pione_method("as_string").should == @a
- end
- end
-
- describe 'pione method length' do
- it 'should get length of string' do
- @a.call_pione_method("length").should == PioneInteger.new(1)
- end
- end
-
- describe 'pione method include?' do
- it 'should get truth' do
- PioneString.new("acd").call_pione_method("include?", @a).should.true
- PioneString.new("acd").call_pione_method("include?", @b).should.false
- end
-
- it 'should raise type error' do
- should.raise(PioneModelTypeError) do
- @a.call_pione_method("include?", PioneInteger.new(1))
- end
- end
- end
+ test_pione_method("string")
end