Skip to main content
Code Review

Return to Revisions

2 of 2
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/

Check the answer from Pavel Druzyak for a different question. It answers your question as well.

Your code can be refactored to this;

describe ProjectsController do
 let(:project) { Project.create! }
 describe "GET index" do
 before(:each) { get :index }
 it { should respond_with(:success) }
 it { should assign_to(:projects).with([project]) }
 end
 describe "GET show" do
 before(:each) { get :show, {:id => @project.to_param} }
 it { should respond_with(:success) }
 it { should assign_to(:projects).with(project) }
 end
end
Can Hanhan
  • 438
  • 2
  • 6
default

AltStyle によって変換されたページ (->オリジナル) /