spec/parsing/numbers/positive_integer_spec.rb in music-transcription-0.17.1 vs spec/parsing/numbers/positive_integer_spec.rb in music-transcription-0.19.0
- old
+ new
@@ -2,16 +2,27 @@
describe Parsing::PositiveIntegerParser do
parser = Parsing::PositiveIntegerParser.new
["1","50","05","502530"].each do |str|
+ res = parser.parse(str)
+ i = str.to_i
+
it "should parse '#{str}'" do
- parser.parse(str).should_not be nil
+ res.should_not be nil
end
+
+ it 'should return node that is convertible to integer using #to_i method' do
+ res.to_i.should eq(i)
+ end
+
+ it 'should return node that is convertible to integer using #to_num method' do
+ res.to_num.should eq(i)
+ end
end
["0"].each do |str|
it "should not parse '#{str}'" do
- parser.parse(str).should be nil
+ parser.should_not parse(str)
end
end
end