Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
App updates for finding/displaying the right doc
* model updates to find the current/specified version of a man page * controller updates to load up the right doc * view updates to display the pregenerated HTML * tests
- Loading branch information
Showing
9 changed files
with
111 additions
and
23 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
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
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
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
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 |
---|---|---|
|
@@ -4,5 +4,5 @@ | |
</div> | ||
|
||
<div id='main'> | ||
<pre><%= @doc %></pre> | ||
<%= @doc.html %> | ||
</div> |
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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FactoryGirl.define do | ||
sequence :plain do |n| | ||
"Doc #{n}" | ||
end | ||
|
||
sequence :version_name do |n| | ||
"v#{n}.0" | ||
end | ||
|
||
factory :doc_file do | ||
end | ||
|
||
factory :doc do | ||
plain :plain | ||
end | ||
|
||
factory :doc_version do | ||
doc_file | ||
version | ||
doc | ||
end | ||
|
||
factory :version do | ||
name :version_name | ||
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
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,7 +1,25 @@ | ||
require 'test_helper' | ||
require File.expand_path("../../test_helper", __FILE__) | ||
|
||
class DocVersionTest < ActiveSupport::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
test 'finds most recent version' do | ||
range = 0..3 | ||
file = Factory(:doc_file, :name => 'test-command') | ||
docs = range.map{|i| Factory(:doc, :plain => "Doc #{i}")} | ||
vers = range.map{|i| Factory(:version, :name => "v#{i}.0")} | ||
dver = range.map{|i| Factory(:doc_version, :doc_file => file, :version => vers[i], :doc => docs[i])} | ||
|
||
dv = DocVersion.latest_for('test-command') | ||
assert_equal docs[3], dv.doc | ||
end | ||
|
||
test 'finds a specific version' do | ||
range = 0..3 | ||
file = Factory(:doc_file, :name => 'test-command') | ||
docs = range.map{|i| Factory(:doc, :plain => "Doc #{i}")} | ||
vers = range.map{|i| Factory(:version, :name => "v#{i}.0")} | ||
dver = range.map{|i| Factory(:doc_version, :doc_file => file, :version => vers[i], :doc => docs[i])} | ||
|
||
dv = DocVersion.for_version('test-command', 'v2.0') | ||
assert_equal docs[2], dv.doc | ||
end | ||
end |