Sha256: 2972b9832a0f875b885f1938de9277a4d20cd32d23dc5ed0ad791f4fe7c7ae5b
Contents?: true
Size: 1.24 KB
Versions: 28
Compression:
Stored size: 1.24 KB
Contents
require File.join(File.dirname(__FILE__) + '/../../spec_helper') describe RailsBestPractices::Checks::ReplaceInstanceVariableWithLocalVariableCheck do before(:each) do @runner = RailsBestPractices::Core::Runner.new(RailsBestPractices::Checks::ReplaceInstanceVariableWithLocalVariableCheck.new) end it "should replace instance variable with local varialbe" do content = <<-EOF <%= @post.title %> EOF @runner.check('app/views/posts/_post.html.erb', content) errors = @runner.errors errors.should_not be_empty 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.check('app/views/posts/_post.html.haml', content) errors = @runner.errors errors.should_not be_empty errors[0].to_s.should == "app/views/posts/_post.html.haml:1 - replace instance variable with local variable" end it "should not replace instance variable with local varialbe" do content = <<-EOF <%= post.title %> EOF @runner.check('app/views/posts/_post.html.erb', content) errors = @runner.errors errors.should be_empty end end
Version data entries
28 entries across 28 versions & 1 rubygems