From 1d6293c4edd8dd88b196f959afdfa1b91e23f0c3 Mon Sep 17 00:00:00 2001 From: Rada Bogdan Date: Fri, 1 Sep 2017 14:31:43 +0300 Subject: [PATCH] add test for symbol type --- spec/unit/kansen/mapper/note_parser_spec.rb | 4 ++++ spec/unit/kansen/mapper/note_type_spec.rb | 2 +- spec/unit/kansen/parser/symbol_spec.rb | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 spec/unit/kansen/parser/symbol_spec.rb diff --git a/spec/unit/kansen/mapper/note_parser_spec.rb b/spec/unit/kansen/mapper/note_parser_spec.rb index 2ca209d..93e0550 100644 --- a/spec/unit/kansen/mapper/note_parser_spec.rb +++ b/spec/unit/kansen/mapper/note_parser_spec.rb @@ -28,5 +28,9 @@ expect(Kansen::Mapper::NoteParser.parse('constant', 'BasicObject')). to be_a BasicObject end + it 'returns symbol' do + expect(Kansen::Mapper::NoteParser.parse('symbol', 'foo')). + to be_a Symbol + end end end diff --git a/spec/unit/kansen/mapper/note_type_spec.rb b/spec/unit/kansen/mapper/note_type_spec.rb index fcbf5d1..d6a6262 100644 --- a/spec/unit/kansen/mapper/note_type_spec.rb +++ b/spec/unit/kansen/mapper/note_type_spec.rb @@ -11,7 +11,7 @@ context 'when valid type' do %w{ - string integer float constant + string integer float constant symbol }.each do |type| it "returns #{type} type" do expect(subject.perform(type)).to eq type diff --git a/spec/unit/kansen/parser/symbol_spec.rb b/spec/unit/kansen/parser/symbol_spec.rb new file mode 100644 index 0000000..52ae304 --- /dev/null +++ b/spec/unit/kansen/parser/symbol_spec.rb @@ -0,0 +1,9 @@ +require 'spec_helper' + +describe Kansen::Parser::Integer do + describe '.parse' do + it 'converts note to integer' do + expect(Kansen::Parser::Symbol.parse('kansen')).to eq :kansen + end + end +end