Commit aed1c955e3c5eade69d7cbbcca064b5ce514a1fd
- Diff rendering mode:
- inline
- side by side
spec/requests/pages_spec.rb
(125 / 0)
|   | |||
| 202 | 202 | end | |
| 203 | 203 | end | |
| 204 | 204 | ||
| 205 | describe "Navigation Links" do | ||
| 206 | it 'should go to the TOC' do | ||
| 207 | visits('/front-matter/foreword') | ||
| 208 | @response = click_link('Home') | ||
| 209 | @response.status.should == 200 | ||
| 210 | @response.url.should contain('/table-of-contents') | ||
| 211 | end | ||
| 212 | |||
| 213 | it 'should go to the next page' do | ||
| 214 | visits('/front-matter/foreword') | ||
| 215 | @response = click_link('Next') | ||
| 216 | @response.status.should == 200 | ||
| 217 | @response.url.should contain('/front-matter/preface') | ||
| 218 | end | ||
| 219 | |||
| 220 | it 'should go to the previous page' do | ||
| 221 | visits('/front-matter/preface') | ||
| 222 | @response = click_link('Previous') | ||
| 223 | @response.status.should == 200 | ||
| 224 | @response.url.should contain('/front-matter/foreword') | ||
| 225 | end | ||
| 226 | |||
| 227 | it 'should go to the first page of the next chapter' do | ||
| 228 | visits('/front-matter/contributors') | ||
| 229 | @response = click_link('Next') | ||
| 230 | @response.status.should == 200 | ||
| 231 | @response.url.should contain('/introduction/ruby') | ||
| 232 | end | ||
| 233 | |||
| 234 | it 'should go to the last page of the previous chapter' do | ||
| 235 | visits('/introduction/ruby') | ||
| 236 | @response = click_link('Previous') | ||
| 237 | @response.status.should == 200 | ||
| 238 | @response.url.should contain('/front-matter/contributors') | ||
| 239 | end | ||
| 240 | |||
| 241 | it 'should go to the TOC' do | ||
| 242 | visits('/appendix/gems') # last page of the last chapter | ||
| 243 | @response = click_link('Next') | ||
| 244 | @response.status.should == 200 | ||
| 245 | @response.url.should contain('/table-of-contents') | ||
| 246 | end | ||
| 247 | end | ||
| 248 | |||
| 249 | describe 'Language switcher' do | ||
| 250 | before(:each) do | ||
| 251 | visits('/en') | ||
| 252 | end | ||
| 253 | |||
| 254 | it 'should respect the current page' do | ||
| 255 | pending 'FIXME: Specs with non-English characters fail if not ran through autotest' | ||
| 256 | visits('/en/introduction/ruby') | ||
| 257 | @response = click_link('Français') | ||
| 258 | @response.status.should == 200 | ||
| 259 | @response.url.should contain('/fr/introduction/ruby') | ||
| 260 | end | ||
| 261 | |||
| 262 | it 'should go to the French language' do | ||
| 263 | pending 'FIXME: Specs with non-English characters fail if not ran through autotest' | ||
| 264 | @response = click_link('Français') | ||
| 265 | @response.status.should == 200 | ||
| 266 | @response.url.should contain('/fr') | ||
| 267 | end | ||
| 268 | |||
| 269 | it 'should go to the Japanese language' do | ||
| 270 | pending 'FIXME: Specs with non-English characters fail if not ran through autotest' | ||
| 271 | @response = click_link('日本語') | ||
| 272 | @response.status.should == 200 | ||
| 273 | @response.url.should contain('/jp') | ||
| 274 | end | ||
| 275 | |||
| 276 | it 'should go to the Portugese language' do | ||
| 277 | pending 'FIXME: Specs with non-English characters fail if not ran through autotest' | ||
| 278 | @response = click_link('Português') | ||
| 279 | @response.status.should == 200 | ||
| 280 | @response.url.should contain('/pt') | ||
| 281 | end | ||
| 282 | |||
| 283 | it 'should go to the German language' do | ||
| 284 | @response = click_link('Deutsch') | ||
| 285 | @response.status.should == 200 | ||
| 286 | @response.url.should contain('/de') | ||
| 287 | end | ||
| 288 | |||
| 289 | it 'should go to the Chinese language' do | ||
| 290 | pending 'FIXME: Specs with non-English characters fail if not ran through autotest' | ||
| 291 | @response = click_link('中文') | ||
| 292 | @response.status.should == 200 | ||
| 293 | @response.url.should contain('/zh') | ||
| 294 | end | ||
| 295 | |||
| 296 | it 'should go to the Spanish language' do | ||
| 297 | pending 'FIXME: Specs with non-English characters fail if not ran through autotest' | ||
| 298 | @response = click_link('Español') | ||
| 299 | @response.status.should == 200 | ||
| 300 | @response.url.should contain('/es') | ||
| 301 | end | ||
| 302 | |||
| 303 | it 'should go to the Russian language' do | ||
| 304 | pending 'FIXME: Specs with non-English characters fail if not ran through autotest' | ||
| 305 | @response = click_link('Русский') | ||
| 306 | @response.status.should == 200 | ||
| 307 | @response.url.should contain('/ru') | ||
| 308 | end | ||
| 309 | |||
| 310 | it 'should go to the Bosnian language' do | ||
| 311 | @response = click_link('Bosanski') | ||
| 312 | @response.status.should == 200 | ||
| 313 | @response.url.should contain('/bs') | ||
| 314 | end | ||
| 315 | |||
| 316 | it 'should go to the Dutch language' do | ||
| 317 | @response = click_link('Nederlands') | ||
| 318 | @response.status.should == 200 | ||
| 319 | @response.url.should contain('/nl') | ||
| 320 | end | ||
| 321 | |||
| 322 | it 'should go to the Arabic language' do | ||
| 323 | pending 'FIXME: Specs with non-English characters fail if not ran through autotest' | ||
| 324 | @response = click_link('العربية') | ||
| 325 | @response.status.should == 200 | ||
| 326 | @response.url.should contain('/ar') | ||
| 327 | end | ||
| 328 | end | ||
| 329 | |||
| 205 | 330 | private | |
| 206 | 331 | ||
| 207 | 332 | def request_chapter(chapter) |

