Sha256: 4573c09523c5aa33f3d98ae71f2220ec681ba9c13e926bc0e8b37b0fd82512ab
Contents?: true
Size: 1.96 KB
Versions: 7
Compression:
Stored size: 1.96 KB
Contents
require 'spec_helper' describe RailsBestPractices::Reviews::SimplifyRenderInControllersReview do let(:runner) { RailsBestPractices::Core::Runner.new(:reviews => RailsBestPractices::Reviews::SimplifyRenderInControllersReview.new) } it "should simplify render action view" do content =<<-EOF def edit render :action => :edit end EOF runner.review("app/controllers/posts_controller.rb", content) runner.should have(1).errors runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:3 - simplify render in controllers" end it "should simplify render actions's template" do content =<<-EOF def edit render :template => 'books/edit' end EOF runner.review("app/controllers/posts_controller.rb", content) runner.should have(1).errors runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:3 - simplify render in controllers" end it "should simplify render an arbitrary file" do content =<<-EOF def edit render :file => '/path/to/rails/app/views/books/edit' end EOF runner.review("app/controllers/posts_controller.rb", content) runner.should have(1).errors runner.errors[0].to_s.should == "app/controllers/posts_controller.rb:3 - simplify render in controllers" end it "should not simplify render action view" do content =<<-EOF render :edit EOF runner.review("app/controllers/posts_controller", content) runner.should have(0).errors end it "should not simplify render actions's template" do content =<<-EOF def edit render 'books/edit' end EOF runner.review("app/controllers/posts_controller.rb", content) runner.should have(0).errors end it "should not simplify render an arbitrary file" do content =<<-EOF def edit render '/path/to/rails/app/views/books/edit' end EOF runner.review("app/controllers/posts_controller.rb", content) runner.should have(0).errors end end
Version data entries
7 entries across 7 versions & 2 rubygems