Reputation: 122
So I'm still very new to this and I was trying to test a very basic controller function, just to get started, but I keep getting the pending message:
Pending: Failures listed here are expected and do not affect your suite's status
There's probably something small I'm not seeing or forgetting... Some help would be greatly appreciated!
This is what I have in the spec>controllers>reviews_controller_spec.rb
file:
require 'rails_helper'
describe ReviewsController do
describe "GET #index" do
it "gets index"
end
end
This is in my controller:
class ReviewsController < ApplicationController
def index
@reviews = Review.all
end
def new
@review = Review.new
end
def create
review_params = params.require( :review ).permit( :title, :rating )
@review = Review.new( review_params )
if @review.save
redirect_to @review
else
render 'new'
end
end
end
Upvotes: 1
Views: 2350
Reputation: 1374
You're getting that message because you haven't filled out at least one of your tests. In this case, it looks like your it "gets index"
test. Rspec is just reminding you that the implementation of this test is pending. It's fine. It's common practice to fill out the overall structure of your tests first with "it" statements and then filling in the tests later. Also if you use rails generate
and have it set up with rspec, then often rspec creates the template for relevant tests in your controller or helper folders, for example, and those tests are also "pending" to start out with
Upvotes: 2