Guest User

book_reqs1

a guest
Jun 24th, 2014
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.54 KB | None | 0 0
  1. require 'book'
  2.  
  3. describe Book do
  4.  
  5.   before do
  6.     @book = Book.new
  7.   end
  8.  
  9.   describe 'title' do
  10.     it 'should capitalize the first letter' do
  11.       @book.title = "inferno"
  12.       @book.title.should == "Inferno"
  13.     end
  14.  
  15.     it 'should capitalize every word' do
  16.       @book.title = "stuart little"
  17.       @book.title.should == "Stuart Little"
  18.     end
  19.  
  20.     describe 'should capitalize every word except...' do
  21.       describe 'articles' do
  22.         specify 'the' do
  23.           @book.title = "alexander the great"
  24.           @book.title.should == "Alexander the Great"
  25.         end
  26.  
  27.         specify 'a' do
  28.           @book.title = "to kill a mockingbird"
  29.           @book.title.should == "To Kill a Mockingbird"
  30.         end
  31.  
  32.         specify 'an' do
  33.           @book.title = "to eat an apple a day"
  34.           @book.title.should == "To Eat an Apple a Day"
  35.         end
  36.       end
  37.  
  38.       specify 'conjunctions' do
  39.         @book.title = "war and peace"
  40.         @book.title.should == "War and Peace"
  41.       end
  42.  
  43.       specify 'prepositions' do
  44.         @book.title = "love in the time of cholera"
  45.         @book.title.should == "Love in the Time of Cholera"
  46.       end
  47.     end
  48.  
  49.     describe 'should always capitalize...' do
  50.       specify 'I' do
  51.         @book.title = "what i wish i knew when i was 20"
  52.         @book.title.should == "What I Wish I Knew When I Was 20"
  53.       end
  54.  
  55.       specify 'the first word' do
  56.         @book.title = "the man in the iron mask"
  57.         @book.title.should == "The Man in the Iron Mask"
  58.       end
  59.     end
  60.   end
  61. end
Advertisement
Add Comment
Please, Sign In to add comment