Sha256: af2b3756ede88d753b1385d6e0b35303b081048a626ea6b3e808fe6aa32bc510

Contents?: true

Size: 1.09 KB

Versions: 12

Compression:

Stored size: 1.09 KB

Contents

require "spec_helper"

RSpec.describe ::Code::Parser do
  subject { ::Code::Parser.parse(input) }

  [
    "a",
    "admin?",
    "update!",
    "*args",
    "**kargs",
    "&block",
    "update!(user)",
    "puts(1)",
    "print(1)",
    "defined?(a)",
    "each{}",
    "each do end",
    "render(a, *b, **c, &d) { |e, *f, **g, &h| puts(e) }",
    "&render {}"
  ].each do |input|
    context input do
      let!(:input) { input }

      it { subject }
    end
  end

  [
    "update! /* cool */ { }",
    "each{/* cool */}",
    "render(/* cool */ a)",
    "render(a /* cool */)",
    "render(a, /* cool */ b)",
    "render(a, b /* cool */)",
    "render(/* cool */ a: 1)",
    "render(a: 1 /* cool */)",
    "render(a: 1, /* cool */ b: 2)",
    "render(a: 1, b: 2 /* cool */)",
    "render { /* cool */ |a, b| }",
    "render { |/* cool */ a, b| }",
    "render { |a /* cool */, b| }",
    "render { |a: 1, /* cool */ b: 2| }",
    "render { |a: 1, b: 2 /* cool */| }"
  ].each do |input|
    context input do
      let!(:input) { input }

      it { expect(subject.to_json).to include("cool") }
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
template-ruby-parser-0.1.8 spec/code/parser/call_spec.rb
code-ruby-parser-0.1.8 spec/code/parser/call_spec.rb
template-ruby-parser-0.1.7 spec/code/parser/call_spec.rb
code-ruby-parser-0.1.7 spec/code/parser/call_spec.rb
template-ruby-parser-0.1.6 spec/code/parser/call_spec.rb
code-ruby-parser-0.1.6 spec/code/parser/call_spec.rb
template-ruby-parser-0.1.5 spec/code/parser/call_spec.rb
code-ruby-parser-0.1.5 spec/code/parser/call_spec.rb
template-ruby-parser-0.1.4 spec/code/parser/call_spec.rb
code-ruby-parser-0.1.4 spec/code/parser/call_spec.rb
template-ruby-parser-0.1.3 spec/code/parser/call_spec.rb
code-ruby-parser-0.1.3 spec/code/parser/call_spec.rb