1 class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
2 include SharedAuthentication
5 And 'I own project "Delta"' do
6 @project = Project.find_by_name "Delta"
7 @project ||= create(:project, name: "Delta", namespace: @user.namespace)
8 @project.team << [@user, :master]
11 Then 'I should see files from repository in master' do
12 current_path.should == project_tree_path(@project, "master")
13 page.should have_content "Gemfile"
14 page.should have_content "app"
15 page.should have_content "README"
18 And 'I should see rendered README which contains correct links' do
19 page.should have_content "Welcome to GitLab GitLab is a free project and repository management application"
20 page.should have_link "GitLab API doc"
21 page.should have_link "GitLab API website"
22 page.should have_link "Rake tasks"
23 page.should have_link "backup and restore procedure"
26 And 'I click on Gitlab API in README' do
27 click_link "GitLab API doc"
30 Then 'I should see correct document rendered' do
31 current_path.should == project_blob_path(@project, "master/doc/api/README.md")
32 page.should have_content "All API requests require authentication"
35 And 'I click on Rake tasks in README' do
36 click_link "Rake tasks"
39 Then 'I should see correct directory rendered' do
40 current_path.should == project_tree_path(@project, "master/doc/raketasks")
41 page.should have_content "backup_restore.md"
42 page.should have_content "maintenance.md"
45 And 'I navigate to the doc/api/README' do
48 click_link "README.md"
51 And 'I see correct file rendered' do
52 current_path.should == project_blob_path(@project, "master/doc/api/README.md")
53 page.should have_content "Contents"
54 page.should have_link "Users"
55 page.should have_link "Rake tasks"
58 And 'I click on users in doc/api/README' do
62 Then 'I should see the correct document file' do
63 current_path.should == project_blob_path(@project, "master/doc/api/users.md")
64 page.should have_content "Get a list of users."
67 And 'I click on raketasks in doc/api/README' do
68 click_link "Rake tasks"
71 When 'I visit markdown branch' do
72 visit project_tree_path(@project, "markdown")
75 Then 'I should see files from repository in markdown branch' do
76 current_path.should == project_tree_path(@project, "markdown")
77 page.should have_content "Gemfile"
78 page.should have_content "app"
79 page.should have_content "README"
82 And 'I see correct file rendered in markdown branch' do
83 current_path.should == project_blob_path(@project, "markdown/doc/api/README.md")
84 page.should have_content "Contents"
85 page.should have_link "Users"
86 page.should have_link "Rake tasks"
89 Then 'I should see correct document rendered for markdown branch' do
90 current_path.should == project_blob_path(@project, "markdown/doc/api/README.md")
91 page.should have_content "All API requests require authentication"
94 Then 'I should see correct directory rendered for markdown branch' do
95 current_path.should == project_tree_path(@project, "markdown/doc/raketasks")
96 page.should have_content "backup_restore.md"
97 page.should have_content "maintenance.md"
100 Then 'I should see the users document file in markdown branch' do
101 current_path.should == project_blob_path(@project, "markdown/doc/api/users.md")
102 page.should have_content "Get a list of users."
105 Given 'I go to wiki page' do
107 current_path.should == project_wiki_path(@project, "home")
110 And 'I add various links to the wiki page' do
111 fill_in "wiki[content]", with: "[test](test)\n[GitLab API doc](doc/api/README.md)\n[Rake tasks](doc/raketasks)\n"
112 fill_in "wiki[message]", with: "Adding links to wiki"
113 click_button "Create page"
116 Then 'Wiki page should have added links' do
117 current_path.should == project_wiki_path(@project, "home")
118 page.should have_content "test GitLab API doc Rake tasks"
121 And 'I click on test link' do
125 Then 'I see new wiki page named test' do
126 current_path.should == project_wiki_path(@project, "test")
127 page.should have_content "Editing"
130 When 'I go back to wiki page home' do
131 visit project_wiki_path(@project, "home")
132 current_path.should == project_wiki_path(@project, "home")
135 And 'I click on GitLab API doc link' do
136 click_link "GitLab API"
139 Then 'I see Gitlab API document' do
140 current_path.should == project_blob_path(@project, "master/doc/api/README.md")
141 page.should have_content "Status codes"
144 And 'I click on Rake tasks link' do
145 click_link "Rake tasks"
148 Then 'I see Rake tasks directory' do
149 current_path.should == project_tree_path(@project, "master/doc/raketasks")
150 page.should have_content "backup_restore.md"
151 page.should have_content "maintenance.md"
154 Given 'I visit to the help page' do
158 And 'I select a page with markdown' do
159 click_link "Rake Tasks"
162 Then 'I should see a help page with markdown' do
163 page.should have_content "GitLab provides some specific rake tasks to enable special features or perform maintenance tasks"
166 Given 'I go directory which contains README file' do
167 visit project_tree_path(@project, "master/doc/api")
168 current_path.should == project_tree_path(@project, "master/doc/api")
171 And 'I click on a relative link in README' do
175 Then 'I should see the correct markdown' do
176 current_path.should == project_blob_path(@project, "master/doc/api/users.md")
177 page.should have_content "List users"