Skip to content

Instantly share code, notes, and snippets.

@supriya
Created July 29, 2009 15:16
Show Gist options
  • Save supriya/158209 to your computer and use it in GitHub Desktop.
Save supriya/158209 to your computer and use it in GitHub Desktop.
context "views an individual card" do
setup do
FakeDataLoader.clear_tables
FakeDataLoader.bootstrap!(1)
@pan = "1111222233334444"
@card = Card.find_by_pan(@pan)
get :show, :id => @card.id
end
context "that was sold cross-store" do
setup do
old_store = @card.store
@card.card_creation_transaction.update_attribute(:store_id, Factory(:store).id)
get :show, :id => @card.id
@card.card_creation_transaction.update_attribute(:store_id, old_store.id)
end
should "display a notice that the store is cross-sale" do
assert_select(".cross-sale", 1)
end
end
should_respond_with :ok
should "show some basic details about the card" do
assert_select "td.card-safe-account-number"
assert_select "td.card-balance"
assert_select "td.cardholder"
assert_select "td.cardholder .name"
assert_select "td.cardholder .line1"
assert_select "td.cardholder .location"
assert_select "td.contact-info .phone-number"
assert_select "td.contact-info .mobile-number"
assert_select "td.contact-info .email-address"
assert_select "td.card-safe-account-number"
assert_select "td.card-balance"
assert_select "td.cardholder-product"
end
should "link to the issuing agent's show page" do
assert_select "a.back-to-agent"
end
should "link to the issuing store's show page" do
assert_select "a.back-to-store"
end
should "show a table of the of card's accounting entries" do
assert_select "table.accounting-entries"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment