Sha256: 133ef825ed29b62678d2401b13f303938745989535d7b3f7405df3a356f91c65
Contents?: true
Size: 1.57 KB
Versions: 1
Compression:
Stored size: 1.57 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_best_practices-1.9.1 | spec/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review_spec.rb |