Initial commit

This commit is contained in:
2013-06-28 01:22:16 -04:00
commit cda1fef08a
74 changed files with 2011 additions and 0 deletions

0
test/fixtures/.gitkeep vendored Normal file
View File

11
test/fixtures/posts.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
user:
title: MyString
body: MyText
two:
user:
title: MyString
body: MyText

11
test/fixtures/users.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

0
test/functional/.gitkeep Normal file
View File

View File

@@ -0,0 +1,49 @@
require 'test_helper'
class PostsControllerTest < ActionController::TestCase
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
put :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

View File

View File

@@ -0,0 +1,12 @@
require 'test_helper'
require 'rails/performance_test_help'
class BrowsingTest < ActionDispatch::PerformanceTest
# Refer to the documentation for all available options
# self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
# :output => 'tmp/performance', :formats => [:flat] }
def test_homepage
get '/'
end
end

13
test/test_helper.rb Normal file
View File

@@ -0,0 +1,13 @@
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
fixtures :all
# Add more helper methods to be used by all tests here...
end

0
test/unit/.gitkeep Normal file
View File

View File

@@ -0,0 +1,4 @@
require 'test_helper'
class PostsHelperTest < ActionView::TestCase
end

7
test/unit/post_test.rb Normal file
View File

@@ -0,0 +1,7 @@
require 'test_helper'
class PostTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

7
test/unit/user_test.rb Normal file
View File

@@ -0,0 +1,7 @@
require 'test_helper'
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end