spec/code/parser/function_spec.rb in template-ruby-0.4.0 vs spec/code/parser/function_spec.rb in template-ruby-0.5.0
- old
+ new
@@ -1,32 +1,16 @@
require "spec_helper"
RSpec.describe Code::Parser::Function do
- subject { described_class.new.parse(input) }
+ subject { Code::Parser.parse(input) }
[
"() => {}",
- '() => { "Hello" }',
- "(a) => { }",
- "(a = 1)=> {}",
- "(a, b) =>{}",
- "(a, b = 2, c = b)=>{}",
- "(a:)=>{}",
- "(a:, b:)=>{}",
- "(a, b:, c)=>{}",
- "(a:, b: 1)=>{}",
- "(a, b: 1, c)=>{}",
- "(*args)=>{}",
- "(*args, **kargs)=>{}",
- "(&block)=>{}",
- "(a = b = 1 + 1 b)=>{}",
- "(a: b = 1 + 1 b)=>{}",
+ "(a, b) => { add(a, b) }",
+ "(a:, b:) => { add(a, b) }"
].each do |input|
- context input.inspect do
+ context input do
let(:input) { input }
-
- it "succeeds" do
- expect { subject }.to_not raise_error
- end
+ it { subject }
end
end
end