Sha256: db6292d7bc2abe0e4ce9774017e18fd9244afecb87473d22c7653fb0c8adb3da

Contents?: true

Size: 1.06 KB

Versions: 13

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

module RailsBestPractices
  module Reviews
    describe RemoveEmptyHelpersReview do
      let(:runner) { Core::Runner.new(reviews: RemoveEmptyHelpersReview.new) }

      it "should remove empty helpers" do
        content =<<-EOF
        module PostsHelper
        end
        EOF
        runner.review('app/helpers/posts_helper.rb', content)
        runner.should have(1).errors
        runner.errors[0].to_s.should == "app/helpers/posts_helper.rb:1 - remove empty helpers"
      end

      it "should not remove empty helpers" do
        content =<<-EOF
        module PostsHelper
          def post_link(post)
            post_path(post)
          end
        end
        EOF
        runner.review('app/helpers/posts_helper.rb', content)
        runner.should have(0).errors
      end

      it "should not remove empty application_helper" do
        content =<<-EOF
        module ApplicationHelper
        end
        EOF
        runner.review('app/helpers/application_helper.rb', content)
        runner.should have(0).errors
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rails_best_practices-1.14.4 spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
rails_best_practices-1.14.3 spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
rails_best_practices-1.14.2 spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
rails_best_practices-1.14.1 spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
rails_best_practices-1.14.0 spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
rails_best_practices-1.13.8 spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
rails_best_practices-1.13.5 spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
rails_best_practices-1.13.4 spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
rails_best_practices-1.13.3 spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
rails_best_practices-1.13.2 spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
rails_best_practices-1.13.1 spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
rails_best_practices-1.13.0 spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb
rails_best_practices-1.12.0 spec/rails_best_practices/reviews/remove_empty_helpers_review_spec.rb