Sha256: 4d3f2f472a9630181fd90ac251f8cc56836bfd096ebc7dff1ee92a5b9a142aa1
Contents?: true
Size: 1.73 KB
Versions: 5
Compression:
Stored size: 1.73 KB
Contents
require 'spec_helper' describe Parsable do let(:context) { Parsable::Context.new } before :each do context.system_store 'location', 'name', 'Here' end describe '.crunch' do it "outputs string with crunched values" do output = Parsable.crunch(\ :string => %(my+{{location.name}}@email.com), :context => context ) expect(output).to eql(%(my+Here@email.com)) end context "nil string" do it "does nothing" do output = Parsable.crunch(\ :string => nil, :context => context ) expect(output).to eql("") end end context "no replacements" do it "returns the original" do string = %(my@email.com) output = Parsable.crunch(\ :string => string, :context => context ) expect(output).to eql(string) end end context "same replacement" do it "replaces both strings" do string = %(my{{location.name}}@email.com{{location.name}}) output = Parsable.crunch(\ :string => string, :context => context ) expect(output).to eql(%(myHere@email.comHere)) end end context "method not defined" do it "replaces with empty" do output = Parsable.crunch(\ :string => %(my+{{location.not_name}}@email.com), :context => context ) expect(output).to eql(%(my+@email.com)) end end context "no context key" do it "replaces with empty" do output = Parsable.crunch(\ :string => %(my+{{wrong_key.name}}@email.com), :context => context ) expect(output).to eql(%(my+@email.com)) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
parsable-0.1.4 | spec/parsable_spec.rb |
parsable-0.1.3 | spec/parsable_spec.rb |
parsable-0.1.2 | spec/parsable_spec.rb |
parsable-0.1.1 | spec/parsable_spec.rb |
parsable-0.1.0 | spec/parsable_spec.rb |