Sha256: 2fdc3f50d5ee3ab3aa29c2b917de3aa530671e3e914c2daf14c2ef211d03476c
Contents?: true
Size: 1.28 KB
Versions: 17
Compression:
Stored size: 1.28 KB
Contents
require 'spec_helper' describe RailsBestPractices::Reviews::MoveCodeIntoControllerReview do let(:runner) { RailsBestPractices::Core::Runner.new(:reviews => RailsBestPractices::Reviews::MoveCodeIntoControllerReview.new) } it "should move code into controller for method call" do content = <<-EOF <% Post.find(:all).each do |post| %> <%=h post.title %> <%=h post.content %> <% end %> EOF runner.review('app/views/posts/index.html.erb', content) runner.should have(1).errors runner.errors[0].to_s.should == "app/views/posts/index.html.erb:1 - move code into controller" end it "should move code into controller for assign" do content = <<-EOF <% @posts = Post.all %> <% @posts.each do |post| %> <%=h post.title %> <%=h post.content %> <% end %> EOF runner.review('app/views/posts/index.html.erb', content) runner.should have(1).errors runner.errors[0].to_s.should == "app/views/posts/index.html.erb:1 - move code into controller" end it "should not move code into controller" do content = <<-EOF <% @posts.each do |post| %> <%=h post.title %> <%=h post.content %> <% end %> EOF runner.review('app/views/posts/index.html.erb', content) runner.should have(0).errors end end
Version data entries
17 entries across 17 versions & 2 rubygems