OSDN Git Service

Make changes to tests
[wvm/gitlab.git] / features / steps / project / project_markdown_render.rb
1 class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
2   include SharedAuthentication
3   include SharedPaths
4
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]
9   end
10
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"
16   end
17
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"
24   end
25
26   And 'I click on Gitlab API in README' do
27     click_link "GitLab API doc"
28   end
29
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"
33   end
34
35   And 'I click on Rake tasks in README' do
36     click_link "Rake tasks"
37   end
38
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"
43   end
44
45   And 'I navigate to the doc/api/README' do
46     click_link "doc"
47     click_link "api"
48     click_link "README.md"
49   end
50
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"
56   end
57
58   And 'I click on users in doc/api/README' do
59     click_link "Users"
60   end
61
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."
65   end
66
67   And 'I click on raketasks in doc/api/README' do
68     click_link "Rake tasks"
69   end
70
71   When 'I visit markdown branch' do
72     visit project_tree_path(@project, "markdown")
73   end
74
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"
80   end
81
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"
87   end
88
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"
92   end
93
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"
98   end
99
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."
103   end
104
105   Given 'I go to wiki page' do
106     click_link "Wiki"
107     current_path.should == project_wiki_path(@project, "home")
108   end
109
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"
114   end
115
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"
119   end
120
121   And 'I click on test link' do
122     click_link "test"
123   end
124
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"
128   end
129
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")
133   end
134
135   And 'I click on GitLab API doc link' do
136     click_link "GitLab API"
137   end
138
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"
142   end
143
144   And 'I click on Rake tasks link' do
145     click_link "Rake tasks"
146   end
147
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"
152   end
153
154   Given 'I visit to the help page' do
155     visit help_path
156   end
157
158   And 'I select a page with markdown' do
159     click_link "Rake Tasks"
160   end
161
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"
164   end
165
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")
169   end
170
171   And 'I click on a relative link in README' do
172     click_link "Users"
173   end
174
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"
178   end
179 end