Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jim Remsik
committed
Jun 6, 2010
1 parent
f645c8f
commit cfd8626
Showing
3 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#book_detail | ||
.book_gallery | ||
%img{:src=> book.image, :alt=> book.title} | ||
#book_details | ||
%h1= book.title | ||
%p.meta= "by #{book.author}" | ||
|
||
%h2= number_to_currency(book.price) | ||
.buy= link_to "Purchase Book", '#' | ||
|
||
%p= book.description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,42 @@ | ||
require 'spec_helper' | ||
|
||
context "Customer on the Book details page" do | ||
context "Customer viewing the book index page" do | ||
let(:book) { Factory.create(:book) } | ||
let(:war_and_peace) { Factory.create(:war_and_peace) } | ||
|
||
before do | ||
book | ||
visit book_path(book) | ||
war_and_peace | ||
visit books_path | ||
click war_and_peace.title | ||
end | ||
|
||
it "sees a purchase link" do | ||
page.should have_xpath("//*[@id='book_details']//a[@href='#']", :text => 'Purchase Book') | ||
context "who has clicked through to the details page for War and Peace" do | ||
it "sees the book image" do | ||
page.should have_xpath("//*[@id='book_detail']//*[@class='book_gallery']/img[@alt='#{war_and_peace.title}']") | ||
end | ||
|
||
it "sees the book title" do | ||
page.should have_xpath("//*[@id='book_details']/h1", :text => war_and_peace.title) | ||
end | ||
|
||
it "sees the book author" do | ||
page.should have_xpath("//*[@id='book_details']//*[@class='meta']", :text => "by #{war_and_peace.author}") | ||
end | ||
|
||
it "sees the book price" do | ||
page.should have_content("$29.00") | ||
end | ||
|
||
it "sees the book description" do | ||
page.should have_content(war_and_peace.description) | ||
end | ||
|
||
it "sees a purchase link" do | ||
page.should have_xpath("//*[@id='book_details']//a[@href='#']", :text => 'Purchase Book') | ||
end | ||
|
||
it "does not see Ulysse" do | ||
page.should_not have_content(book.title) | ||
end | ||
end | ||
end |