Sha256: fce042bbf6a63cecee92437e096d10e3fbe0a585446ed3afe52a6334263f1d1a
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
require 'spec_helper' describe Parsable do describe '.crunch' do it "outputs string with crunched values" do location = OpenStruct.new(:name => "Here") output = Parsable.crunch(\ :string => %(my+{{location.name}}@email.com), :context => {:location => location} ) expect(output).to eql(%(my+Here@email.com)) end context "no replacements" do it "returns the original" do string = %(my@email.com) output = Parsable.crunch(\ :string => string, :context => {} ) expect(output).to eql(string) end end context "method not defined" do it "replaces with empty" do location = OpenStruct.new(:name => "Here") output = Parsable.crunch(\ :string => %(my+{{location.not_name}}@email.com), :context => {:location => location} ) expect(output).to eql(%(my+@email.com)) end end context "no context key" do it "replaces with empty" do location = OpenStruct.new(:name => "Here") output = Parsable.crunch(\ :string => %(my+{{wrong_key.name}}@email.com), :context => {:location => location} ) expect(output).to eql(%(my+@email.com)) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
parsable-0.0.1 | spec/parsable_spec.rb |