Reputation: 165
So I put a "hello world" in my file to make sure I was getting to the file, and sure enough, it printed. However, none of my examples are being run. It says "no examples found". Any ideas?
require 'rails_helper'
class PostsControllerTest < ActionController::TestCase
print "hello world"
setup do
@post = posts(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:posts)
end
test "should get new" do
get :new
assert_response :success
end
test "should create post" do
assert_difference('Post.count') do
post :create, post: { body: @post.body, title: @post.title }
end
assert_redirected_to post_path(assigns(:post))
end
test "should show post" do
get :show, id: @post
assert_response :success
end
test "should get edit" do
get :edit, id: @post
assert_response :success
end
test "should update post" do
patch :update, id: @post, post: { body: @post.body, title: @post.title }
assert_redirected_to post_path(assigns(:post))
end
test "should destroy post" do
assert_difference('Post.count', -1) do
delete :destroy, id: @post
end
assert_redirected_to posts_path
end
end
If more code would help, let me know. Thanks.
Upvotes: 1
Views: 108
Reputation: 27961
That's not rspec, that's testunit, you don't run it with rspec, you run it with rake test
Upvotes: 1