spec/excise/base_spec.rb in excise-0.2.0 vs spec/excise/base_spec.rb in excise-0.2.1

- old
+ new

@@ -3,34 +3,34 @@ module Excise describe "Base" do context 'only a pattern' do let(:base) { Base.new(pattern) } let(:pattern) { '[{first}]' } + let(:string) { '[value]' } it "should parse strings" do - base.string = '[value]' - base.parse.should be_a Hash + base.parse(string).should be_a Hash end end context 'pattern and string' do - subject { Base.new(pattern, string).parse } + subject { Base.new(pattern).parse(string) } let(:string) { '[this] (patterned) <STRING>' } let(:pattern) { '[{first}] ({second}) <{third}>' } it { should be_a Hash } its(:keys) { should eq [:first, :second, :third] } its(:values) { should eq ['this', 'patterned', 'STRING'] } end - describe '#parse_string' do + describe '#parse' do let(:pattern) { Base.new('[{first}]') } it "should take a string and parse it" do - output = pattern.parse_string('[value]') + output = pattern.parse('[value]') output.should eq Hash[{first: 'value'}] - output = pattern.parse_string('[other]') + output = pattern.parse('[other]') output.should eq Hash[{first: 'other'}] end end end end