Permalink
Browse files

Adding tests.

  • Loading branch information...
yoosee committed Apr 3, 2016
1 parent 0bdf27d commit 45b54b11a74bc1de959fc34a03cc8a08e1659fcc
Showing with 30 additions and 0 deletions.
  1. +22 −0 test/controllers/articles_controller_test.rb
  2. +8 −0 test/models/article_test.rb
@@ -0,0 +1,22 @@
class ArticlesControllerTest < ActionController::TestCase
test "should create article" do
assert_difference 'Article.count' do
post :create, article: { title: 'test title' }
end
assert_redirected_to article_path(assigns :article)
end
test "get index" do
get :index
assert_response :success
assert_not_nil assigns :articles
end
test "get individual by alt_url" do
assert_response :success
assert_not_nil assigns :article
end
end
@@ -0,0 +1,8 @@
class ArticleTest < ActiveSupport::TestCase
test "should not save article without title" do
article = Article.new
assert_not article.save
end
end

0 comments on commit 45b54b1

Please sign in to comment.