Sha256: 2b38a0b57c94aee631beebaa29cd0497d9ed9ba286b50068688f03178b19d6e7
Contents?: true
Size: 1.75 KB
Versions: 2
Compression:
Stored size: 1.75 KB
Contents
# frozen_string_literal: true require 'spec_helper' module RailsBestPractices module Reviews describe UseParenthesesInMethodDefReview do let(:runner) { Core::Runner.new(reviews: UseParenthesesInMethodDefReview.new) } it 'should find missing parentheses' do content = <<-EOF class PostsController < ApplicationController def edit foo, bar end end EOF runner.review('app/controllers/posts_controller.rb', content) expect(runner.errors.size).to eq(1) expect(runner.errors[0].to_s).to eq('app/controllers/posts_controller.rb:2 - use parentheses around parameters in method definitions') end it 'should find parentheses with no error' do content = <<-EOF class PostsController < ApplicationController def edit(foo, bar) end end EOF runner.review('app/controllers/posts_controller.rb', content) expect(runner.errors.size).to eq(0) end it 'should not throw an error without parameters' do content = <<-EOF class PostsController < ApplicationController def edit end end EOF runner.review('app/controllers/posts_controller.rb', content) expect(runner.errors.size).to eq(0) end it 'should not check ignored files' do runner = Core::Runner.new(reviews: UseParenthesesInMethodDefReview.new(ignored_files: /posts_controller/)) content = <<-EOF class PostsController < ApplicationController def edit foo, bar end end EOF runner.review('app/controllers/posts_controller.rb', content) expect(runner.errors.size).to eq(0) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems