Sha256: 6e6728540e32a6c105ca85a7230685db9906acca12fe10dc35175e0bd41f64ad
Contents?: true
Size: 1.46 KB
Versions: 6
Compression:
Stored size: 1.46 KB
Contents
require 'spec_helper' describe RailsBestPractices::Reviews::ReplaceInstanceVariableWithLocalVariableReview do let(:runner) { RailsBestPractices::Core::Runner.new(:reviews => RailsBestPractices::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
Version data entries
6 entries across 6 versions & 2 rubygems