-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from mmozuras/doc-controller-tests
Fix #141: fix doc_controller tests
- Loading branch information
Showing
2 changed files
with
32 additions
and
33 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,7 @@ | |
factory :version do | ||
name :version_name | ||
end | ||
|
||
factory :book do | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,37 @@ | ||
require File.expand_path("../../test_helper", __FILE__) | ||
|
||
class DocControllerTest < ActionController::TestCase | ||
# test "should get index" do | ||
# get :index | ||
# assert_response :success | ||
# end | ||
test "should get index" do | ||
book = FactoryGirl.create(:book, :code =>'en') | ||
get :index | ||
assert_response :success | ||
end | ||
|
||
# test "should get file" do | ||
# get :file | ||
# assert_response :success | ||
# end | ||
test "gets the latest version of a man page" do | ||
file = FactoryGirl.create(:doc_file, :name => 'test-command') | ||
doc = FactoryGirl.create(:doc, :plain => "Doc 1", :blob_sha => "d670460b4b4aece5915caf5c68d12f560a9fe3e4") | ||
vers = FactoryGirl.create(:version, :name => "v1.0", :vorder => Version.version_to_num("1.0")) | ||
dver = FactoryGirl.create(:doc_version, :doc_file => file, :version => vers, :doc => doc) | ||
get :man, :file => 'test-command' | ||
assert_response :success | ||
end | ||
|
||
# test "gets the latest version of a man page" do | ||
# file = FactoryGirl.create(:doc_file, :name => 'test-command') | ||
# doc = FactoryGirl.create(:doc, :plain => "Doc 1") | ||
# vers = FactoryGirl.create(:version, :name => "v1.0") | ||
# dver = FactoryGirl.create(:doc_version, :doc_file => file, :version => vers, :doc => doc) | ||
# get :man, :file => 'test-command' | ||
# assert_response :success | ||
# end | ||
test "gets a specific version of a man page" do | ||
file = FactoryGirl.create(:doc_file, :name => 'test-command') | ||
doc = FactoryGirl.create(:doc, :plain => "Doc 1", :blob_sha => "d670460b4b4aece5915caf5c68d12f560a9fe3e4") | ||
vers = FactoryGirl.create(:version, :name => "v1.0", :vorder => Version.version_to_num("1.0")) | ||
dver = FactoryGirl.create(:doc_version, :doc_file => file, :version => vers, :doc => doc) | ||
get :man, :file => 'test-command', :version => 'v1.0' | ||
assert_response :success | ||
end | ||
|
||
# test "gets a specific version of a man page" do | ||
# file = FactoryGirl.create(:doc_file, :name => 'test-command') | ||
# doc = FactoryGirl.create(:doc, :plain => "Doc 1") | ||
# vers = FactoryGirl.create(:version, :name => "v1.0") | ||
# dver = FactoryGirl.create(:doc_version, :doc_file => file, :version => vers, :doc => doc) | ||
# get :man, :file => 'test-command', :version => 'v1.0' | ||
# assert_response :success | ||
# end | ||
|
||
# test "tries to prepend 'git-' to find a command" do | ||
# file = FactoryGirl.create(:doc_file, :name => 'git-commit') | ||
# doc = FactoryGirl.create(:doc, :plain => "Doc 1") | ||
# vers = FactoryGirl.create(:version, :name => "v1.0") | ||
# dver = FactoryGirl.create(:doc_version, :doc_file => file, :version => vers, :doc => doc) | ||
# get :man, :file => 'commit', :version => 'v1.0' | ||
# assert_response :success | ||
# end | ||
test "tries to prepend 'git-' to find a command" do | ||
file = FactoryGirl.create(:doc_file, :name => 'git-commit') | ||
doc = FactoryGirl.create(:doc, :plain => "Doc 1") | ||
vers = FactoryGirl.create(:version, :name => "v1.0") | ||
dver = FactoryGirl.create(:doc_version, :doc_file => file, :version => vers, :doc => doc) | ||
get :man, :file => 'commit', :version => 'v1.0' | ||
assert_redirected_to '/docs/git-commit' | ||
end | ||
|
||
end |