spec/parser_spec.rb in parsable-0.1.1 vs spec/parser_spec.rb in parsable-0.1.2
- old
+ new
@@ -23,23 +23,23 @@
context 'no function method' do
before :each do
@parsed = Parsable::Parser.new(:string => %(my+{{location.name}}@email.com)).parse.first
end
it "parses object name" do
- expect(@parsed[:object]).to eql('location')
+ expect(@parsed.object).to eql('location')
end
it "parses attribute" do
- expect(@parsed[:attribute]).to eql('name')
+ expect(@parsed.attribute).to eql('name')
end
end
context "function method" do
it "parses function method" do
string = %(my+{{url_safe(location.name)}}@email.com)
parsed = Parsable::Parser.new(:string => string).parse.first
- expect(parsed[:function]).to eql('url_safe')
+ expect(parsed.function).to eql('url_safe')
end
end
end
context 'when multiple variables' do
@@ -51,26 +51,26 @@
expect(@parsed.size).to eql(2)
end
context 'no function method' do
it "parses object names" do
- expect(@parsed.first[:object]).to eql('location')
- expect(@parsed.last[:object]).to eql('email')
+ expect(@parsed.first.object).to eql('location')
+ expect(@parsed.last.object).to eql('email')
end
it "parses attributes" do
- expect(@parsed.first[:attribute]).to eql('name')
- expect(@parsed.last[:attribute]).to eql('domain')
+ expect(@parsed.first.attribute).to eql('name')
+ expect(@parsed.last.attribute).to eql('domain')
end
end
context "function method" do
it "parses function methods" do
string = %(my+{{url_safe(location.name)}}@{{email.domain}}.com)
parsed = Parsable::Parser.new(:string => string).parse
- expect(parsed.first[:function]).to eql('url_safe')
- expect(parsed.last[:function]).to be_nil
+ expect(parsed.first.function).to eql('url_safe')
+ expect(parsed.last.function).to be_nil
end
end
end
end