Simply Rails 2 by Patrick Lenz
Author:Patrick Lenz
Language: eng
Format: mobi, epub, pdf
Publisher: SitePoint Pty. Ltd.
Published: 2008-08-16T04:00:00+00:00
Testing Vote Storage
To test the basics of the vote-casting functionality, add the following test to test/functional/votes_controller_test.rb. It simply confirms that new votes are stored correctly:
28-votes_controller_test.rb (excerpt)
class VotesControllerTest < ActionController::TestCase
def test_should_accept_vote
assert stories(:two).votes.empty?
post :create, :story_id => stories(:two)
assert ! assigns(:story).votes.empty?
end
end
The test uses a before-and-after check to confirm that this action, which is supposed to modify data, is indeed doing its job. Let’s look at each line in turn.
The first line confirms that the story initially has no votes:
assert stories(:two).votes.empty?
Download
Simply Rails 2 by Patrick Lenz.epub
Simply Rails 2 by Patrick Lenz.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(21661)
Hello! Python by Anthony Briggs(20890)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(19357)
Dependency Injection in .NET by Mark Seemann(18942)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(18567)
Kotlin in Action by Dmitry Jemerov(18357)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(18164)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(17026)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(16953)
Grails in Action by Glen Smith Peter Ledbrook(16143)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(13829)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(11830)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(10650)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10592)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(9754)
Hit Refresh by Satya Nadella(9101)
The Kubernetes Operator Framework Book by Michael Dame(8534)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8358)
Robo-Advisor with Python by Aki Ranin(8303)