Sha256: 9017b59663e0c2b37056c4ff426a436c19fcc85c9e6359c9fa19fba92c140172

Contents?: true

Size: 640 Bytes

Versions: 6

Compression:

Stored size: 640 Bytes

Contents

require "spec_helper"

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

  [
    "a.b",
    "a.b.c",
    "a(1).b.c(2)",
    "user.first_name",
    "User.all",
    "User::Email.first",
    "User.each do |user| user.update(created_at: Time.now) end"
  ].each do |input|
    context input do
      let!(:input) { input }

      it { expect { subject }.to_not raise_error }
    end
  end

  [
    "a /* cool */ . b",
    "a . /* cool */ b",
    "a . # cool\n /* cool */ b"
  ].each do |input|
    context input do
      let!(:input) { input }

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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
template-ruby-parser-0.1.2 spec/code/parser/chained_call_spec.rb
code-ruby-parser-0.1.2 spec/code/parser/chained_call_spec.rb
template-ruby-parser-0.1.1 spec/code/parser/chained_call_spec.rb
code-ruby-parser-0.1.1 spec/code/parser/chained_call_spec.rb
template-ruby-parser-0.1.0 spec/code/parser/chained_call_spec.rb
code-ruby-parser-0.1.0 spec/code/parser/chained_call_spec.rb