Commit b04427d2c3650ce77d70aabc27734954bd886719

Authored by Antonio Terceiro
1 parent e81d08b3

Adding the content needed by the online documentation feature

features/online_manual.feature
  1 +@docs
1 Feature: online manual 2 Feature: online manual
2 As a user 3 As a user
3 I want to read the manual 4 I want to read the manual
4 So that I know how to do something in Noosfero 5 So that I know how to do something in Noosfero
5 6
  7 + Background:
  8 + Given the documentation is built
  9 +
6 Scenario: initial page of online manual 10 Scenario: initial page of online manual
7 When I go to /doc 11 When I go to /doc
8 Then I should see "Noosfero online manual" 12 Then I should see "Noosfero online manual"
features/step_definitions/documentation_steps.rb 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +require File.join(Rails.root, 'test', 'noosfero_doc_test')
  2 +include Noosfero::DocTest
  3 +
  4 +Given 'the documentation is built' do
  5 + setup_doc_test
  6 +end
  7 +
  8 +After('@docs') do
  9 + tear_down_doc_test
  10 +end
test/noosfero_doc_test.rb
@@ -2,11 +2,12 @@ module Noosfero::DocTest @@ -2,11 +2,12 @@ module Noosfero::DocTest
2 2
3 ROOT = File.join(Rails.root, "test", "tmp", "doc") 3 ROOT = File.join(Rails.root, "test", "tmp", "doc")
4 4
5 - def create_doc(section, topic, language, title) 5 + def create_doc(section, topic, language, title, body = nil)
6 dir = File.join(ROOT, section) 6 dir = File.join(ROOT, section)
7 FileUtils.mkdir_p(dir) 7 FileUtils.mkdir_p(dir)
8 File.open("#{dir}/#{topic}.#{language}.xhtml", "w") do |f| 8 File.open("#{dir}/#{topic}.#{language}.xhtml", "w") do |f|
9 f.puts "<h1>#{title}</h1>" 9 f.puts "<h1>#{title}</h1>"
  10 + f.puts body
10 end 11 end
11 end 12 end
12 13
@@ -14,8 +15,8 @@ module Noosfero::DocTest @@ -14,8 +15,8 @@ module Noosfero::DocTest
14 FileUtils.mkdir_p(ROOT) 15 FileUtils.mkdir_p(ROOT)
15 16
16 # root 17 # root
17 - create_doc('', 'index', 'en', 'Root')  
18 - create_doc('', 'toc', 'en', 'Root') 18 + create_doc('', 'index', 'en', 'Noosfero online manual')
  19 + create_doc('', 'toc', 'en', '', '<ul><li><a href="/doc/user">User features</a></li><li><a href="/doc/cms">Content Management</a></li></ul>')
19 # cms 20 # cms
20 create_doc('cms', 'index', 'en', 'Content Management') 21 create_doc('cms', 'index', 'en', 'Content Management')
21 create_doc('cms', 'index', 'pt', 'Gerenciamento de conteúdo') 22 create_doc('cms', 'index', 'pt', 'Gerenciamento de conteúdo')
@@ -28,10 +29,12 @@ module Noosfero::DocTest @@ -28,10 +29,12 @@ module Noosfero::DocTest
28 # user 29 # user
29 create_doc('user', 'index', 'en', 'User features') 30 create_doc('user', 'index', 'en', 'User features')
30 create_doc('user', 'index', 'pt', 'Funcionalidades de Usuário') 31 create_doc('user', 'index', 'pt', 'Funcionalidades de Usuário')
31 - create_doc('user', 'toc', 'en', '') 32 + create_doc('user', 'toc', 'en', '<ul><li><a href="/doc/user/commenting-articles">Commenting articles</a></li><li><a href="/doc/user/acceptins-friends">Accepting friends</a></li></ul>')
32 create_doc('user', 'toc', 'pt', '') 33 create_doc('user', 'toc', 'pt', '')
33 create_doc('user', 'accepting-friends', 'en', 'Accepting friends') 34 create_doc('user', 'accepting-friends', 'en', 'Accepting friends')
34 create_doc('user', 'accepting-friends', 'pt', 'Aceitando amigos') 35 create_doc('user', 'accepting-friends', 'pt', 'Aceitando amigos')
  36 + create_doc('user', 'commenting-articles', 'en', 'Commenting articles', 'How to access')
  37 + create_doc('user', 'commenting-articles', 'pt', 'Comentando artigos')
35 38
36 DocSection.stubs(:root_dir).returns(ROOT) 39 DocSection.stubs(:root_dir).returns(ROOT)
37 end 40 end