spec/lib/fasterer/method_call_spec.rb in fasterer-0.8.0 vs spec/lib/fasterer/method_call_spec.rb in fasterer-0.8.1
- old
+ new
@@ -435,6 +435,38 @@
# expect(method_call.method_name).to eq('hello')
# expect(method_call.receiver).to be_a(Fasterer::MethodCall)
# expect(method_call.receiver.name).to eq('hi')
end
end
+
+ describe '#lambda_literal?' do
+ describe 'lambda literal without arguments' do
+ let(:code) { '-> {}' }
+
+ let(:call_element) { ripper }
+
+ it 'should be true' do
+ expect(method_call).to be_lambda_literal
+ end
+ end
+
+ describe 'lambda literal with an argument' do
+ let(:code) { '->(_) {}' }
+
+ let(:call_element) { ripper }
+
+ it 'should be true' do
+ expect(method_call).to be_lambda_literal
+ end
+ end
+
+ describe 'lambda method' do
+ let(:code) { 'lambda {}' }
+
+ let(:call_element) { ripper }
+
+ it 'should be false' do
+ expect(method_call).not_to be_lambda_literal
+ end
+ end
+ end
end