Sha256: d9ca0fa689bbfff54b52c5cc1a0c1ecdf97192601aaefb247ac6db4ca7bf3146

Contents?: true

Size: 703 Bytes

Versions: 1

Compression:

Stored size: 703 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 {user.first_name}",
      "",
      "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

1 entries across 1 versions & 1 rubygems

Version Path
template-ruby-0.1.0 spec/template_spec.rb