Sha256: ad70a445796c8dde8062a48626cc071cc1c2740ab1830b3b06cf9878bc791df9

Contents?: true

Size: 683 Bytes

Versions: 4

Compression:

Stored size: 683 Bytes

Contents

require "spec_helper"

RSpec.describe Template do
  subject { described_class.render(input, input_context) }

  [
    ["Hello World", "", "Hello World"],
    ["1 + 1 = {2}", "", "1 + 1 = 2"],
    ["Hello {name}", '{ name: "Dorian" }', "Hello Dorian"],
    [
      "Hello {user.first_name}",
      '{ user: { first_name: "Dorian" } }',
      "Hello Dorian",
    ],
    ["Hello {", "", "Hello "],
    ["", "", ""],
  ].each do |(input, input_context, expected)|
    context "#{input.inspect} #{input_context.inspect}" do
      let(:input) { input }
      let(:input_context) { input_context }

      it "succeeds" do
        expect(subject).to eq(expected)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
code-ruby-0.2.4 spec/template_spec.rb
template-ruby-0.2.4 spec/template_spec.rb
template-ruby-0.2.3 spec/template_spec.rb
template-ruby-0.2.2 spec/template_spec.rb