Sha256: 418e4dafb4f2fda22059c1c52cdf3e7f7b91bb0397a4fc2599b7951734656448

Contents?: true

Size: 908 Bytes

Versions: 14

Compression:

Stored size: 908 Bytes

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" do
    content = <<-EOF
    <% @posts = Post.find(: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

14 entries across 14 versions & 2 rubygems

Version Path
rails_best_practices-0.10.1 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
rails_best_practices-0.10.0 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
rails_best_practices-raydog153-0.9.1 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
rails_best_practices-0.9.0 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
rails_best_practices-0.8.2 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
rails_best_practices-0.8.1 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
rails_best_practices-0.8.0 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
rails_best_practices-0.7.5 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
rails_best_practices-0.7.4 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
rails_best_practices-0.7.3 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
rails_best_practices-0.7.2 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
rails_best_practices-0.7.1 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
rails_best_practices-0.7.0 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb
rails_best_practices-0.6.7 spec/rails_best_practices/reviews/move_code_into_controller_review_spec.rb