Created
November 4, 2013 01:05
-
-
Save bryanaknight/7296659 to your computer and use it in GitHub Desktop.
Blogger controller test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class ArticlesControllerTest < ActionController::TestCase | |
test "index method lists all articles" do | |
Article.create(title: "First", body: "Body") | |
Article.create(title: "Second", body: "Body") | |
articles = Article.all | |
assert_equal 2, articles.count | |
#when I run rake, getting 4 articles instead of 2 | |
end | |
end | |
#TEST HELPER | |
ENV["RAILS_ENV"] ||= "test" | |
require File.expand_path('../../config/environment', __FILE__) | |
require 'rails/test_help' | |
class ActiveSupport::TestCase | |
ActiveRecord::Migration.check_pending! | |
fixtures :all | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment