Sha256: a0850ff2285c18bd3c8b659e34771d84a1100c06c894e71c88ce477ee2747626

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

require "spec_helper"

describe Docks::Languages::ERB do
  subject { Docks::Languages::ERB.instance }

  describe ".extensions" do
    let(:extensions) { [subject.class.extensions].flatten }

    it "includes .erb as an extension" do
      expect(extensions).to include "erb"
    end
  end

  describe "#helper_markup_for" do
    let(:mixed_arguments) { ["hello", 10, false, :goodbye, { bar: "baz", "baz" => :qux }] }
    let(:mixed_arguments_output) { "\"hello\", 10, false, :goodbye, bar: \"baz\",\n#{" " * 38}\"baz\" => :qux" }
    let(:argumentless_hash) { { "baz" => :qux } }
    let(:argumentless_hash_output) { "\"baz\" => :qux" }

    it "converts an array of arguments into the corresponding function" do
      expect(subject.helper_markup_for("foo", mixed_arguments)).to eq "<%= foo #{mixed_arguments_output} %>"
    end

    it "converts a hash with an arguments key into the corresponding function" do
      expect(subject.helper_markup_for("foo", arguments: mixed_arguments)).to eq "<%= foo #{mixed_arguments_output} %>"
    end

    it "converts a hash without an array key into a function with the hash as the only param" do
      expect(subject.helper_markup_for("foo", argumentless_hash)).to eq "<%= foo #{argumentless_hash_output} %>"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
docks_app-0.0.3 spec/lib/languages/erb_language_spec.rb
docks_app-0.0.2 spec/lib/languages/erb_language_spec.rb
docks_app-0.0.1 spec/lib/languages/erb_language_spec.rb