Commit e863be2f8a6c77d978be5ebf5b72a6f17fae0d00

specs for the nav links and language switcher
  
452452 end
453453end
454454
455describe "Navigation Links" do
456 it 'should go to the TOC' do
457 visits('/front-matter/foreword')
458 @response = click_link('Home')
459 @response.status.should == 200
460 @response.url.should contain('/table-of-contents')
461 end
462
463 it 'should go to the next page' do
464 visits('/front-matter/foreword')
465 @response = click_link('Next')
466 @response.status.should == 200
467 @response.url.should contain('/front-matter/preface')
468 end
469
470 it 'should go to the previous page' do
471 visits('/front-matter/preface')
472 @response = click_link('Previous')
473 @response.status.should == 200
474 @response.url.should contain('/front-matter/foreword')
475 end
476
477 it 'should go to the first page of the next chapter' do
478 visits('/front-matter/contributors')
479 @response = click_link('Next')
480 @response.status.should == 200
481 @response.url.should contain('/introduction/ruby')
482 end
483
484 it 'should go to the last page of the previous chapter' do
485 visits('/introduction/ruby')
486 @response = click_link('Previous')
487 @response.status.should == 200
488 @response.url.should contain('/front-matter/contributors')
489 end
490
491 it 'should go to the TOC' do
492 visits('/appendix/gems') # last page of the last chapter
493 @response = click_link('Next')
494 @response.status.should == 200
495 @response.url.should contain('/table-of-contents')
496 end
497end
498
499describe 'Language switcher' do
500 before(:each) do
501 visits('/en')
502 end
503
504 it 'should respect the current page' do
505 pending 'FIXME: Specs with non-English characters fail if not ran through autotest'
506 visits('/en/introduction/ruby')
507 @response = click_link('Français')
508 @response.status.should == 200
509 @response.url.should contain('/fr/introduction/ruby')
510 end
511
512 it 'should go to the French language' do
513 pending 'FIXME: Specs with non-English characters fail if not ran through autotest'
514 @response = click_link('Français')
515 @response.status.should == 200
516 @response.url.should contain('/fr')
517 end
518
519 it 'should go to the Japanese language' do
520 pending 'FIXME: Specs with non-English characters fail if not ran through autotest'
521 @response = click_link('日本語')
522 @response.status.should == 200
523 @response.url.should contain('/jp')
524 end
525
526 it 'should go to the Portugese language' do
527 pending 'FIXME: Specs with non-English characters fail if not ran through autotest'
528 @response = click_link('Português')
529 @response.status.should == 200
530 @response.url.should contain('/pt')
531 end
532
533 it 'should go to the German language' do
534 @response = click_link('Deutsch')
535 @response.status.should == 200
536 @response.url.should contain('/de')
537 end
538
539 it 'should go to the Chinese language' do
540 pending 'FIXME: Specs with non-English characters fail if not ran through autotest'
541 @response = click_link('中文')
542 @response.status.should == 200
543 @response.url.should contain('/zh')
544 end
545
546 it 'should go to the Spanish language' do
547 pending 'FIXME: Specs with non-English characters fail if not ran through autotest'
548 @response = click_link('Español')
549 @response.status.should == 200
550 @response.url.should contain('/es')
551 end
552
553 it 'should go to the Russian language' do
554 pending 'FIXME: Specs with non-English characters fail if not ran through autotest'
555 @response = click_link('Русский')
556 @response.status.should == 200
557 @response.url.should contain('/ru')
558 end
559
560 it 'should go to the Bosnian language' do
561 @response = click_link('Bosanski')
562 @response.status.should == 200
563 @response.url.should contain('/bs')
564 end
565
566 it 'should go to the Dutch language' do
567 @response = click_link('Nederlands')
568 @response.status.should == 200
569 @response.url.should contain('/nl')
570 end
571
572 it 'should go to the Arabic language' do
573 pending 'FIXME: Specs with non-English characters fail if not ran through autotest'
574 @response = click_link('العربية')
575 @response.status.should == 200
576 @response.url.should contain('/ar')
577 end
578end
579
455580private
456581
457582def request_chapter(chapter)