Sha256: 17ce8184128a12a9b17b2f8e2776f00e10456d9e97d64eaf248a739f05b903bd
Contents?: true
Size: 1.56 KB
Versions: 17
Compression:
Stored size: 1.56 KB
Contents
require 'spec_helper' module RailsBestPractices module Reviews describe ReplaceInstanceVariableWithLocalVariableReview do let(:runner) { Core::Runner.new(reviews: ReplaceInstanceVariableWithLocalVariableReview.new) } it "should replace instance variable with local varialbe" do content = <<-EOF <%= @post.title %> EOF runner.review('app/views/posts/_post.html.erb', content) runner.should have(1).errors runner.errors[0].to_s.should == "app/views/posts/_post.html.erb:1 - replace instance variable with local variable" end it "should replace instance variable with local varialbe in haml file" do content = <<-EOF = @post.title EOF runner.review('app/views/posts/_post.html.haml', content) runner.should have(1).errors runner.errors[0].to_s.should == "app/views/posts/_post.html.haml:1 - replace instance variable with local variable" end it "should replace instance variable with local varialbe in slim file" do content = <<-EOF = @post.title EOF runner.review('app/views/posts/_post.html.slim', content) runner.should have(1).errors runner.errors[0].to_s.should == "app/views/posts/_post.html.slim:1 - replace instance variable with local variable" end it "should not replace instance variable with local varialbe" do content = <<-EOF <%= post.title %> EOF runner.review('app/views/posts/_post.html.erb', content) runner.should have(0).errors end end end end
Version data entries
17 entries across 17 versions & 1 rubygems