Remove duplicated "before"s from your specs
Take a look at rspec-action gem.
Compare 1 and 2:
1.
describe "GET index" do
context 'if user signed in' do
before { sign_in user }
before { get :index }
it { should respond_with :success }
end
context 'if user signed out' do
before { get :index }
it { should redirect_to sign_in_path }
end
end
2.
describe "GET index" do
action { get :index }
context 'if user signed in' do
before { sign_in user }
it { should respond_with :success }
end
context 'if user signed out' do
it { should redirect_to sign_in_path }
end
end
Written by Alex G
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#