Welcome to the Story Toss codebase. I built this app as a capstone project after I read Jason Swett's Complete Guide to Rails Testing. You can read all about it on my blog.
In building this app, I followed a more test-centric development process than I had ever done before, at least in Rails.
Here are the testing rules of thumb that I set for myself at the beginning of this project:
- When I add a feature, write tests for it before working on anything else.
- Don't commit before writing tests or making sure the change is covered by existing tests. I made exceptions to this rule at the beginning and end of the project, when I was working mostly in the views and it didn't make sense to write system specs until after several interrelated features were finished.
- When I'm building a model, use TDD as much as possible.
By the end of the project, these rules felt less like rules and more like just plain writing code. I didn't have to remind myself as often to write tests before committing, because the habit of testing had become a more seamless part my development process. And the more I did it, the more grateful I was that I'd done so: more than once an obscure bug came up that I found within just a few minutes, thanks to my tests. I shudder to think of the hours it might otherwise have taken me to track down those bugs.
Bug reports and pull requests are welcome on GitHub at https://github.com/fpsvogel/storytoss.
- Ruby 3+
- Node.js 14+
- PostgreSQL 9.3+
- Checkout the storytoss git tree from Github:
$ git clone git://github.com/fpsvogel/storytoss.git $ cd storytoss storytoss$
- Run Bundler to install gems needed by the project:
storytoss$ bundle
- If this is your first time using PostgreSQL, log in to PostgreSQL and create a user:
$ psql -U postgres postgres=# create role "your_username" login createdb postgres=# exit
- Create the development and test databases:
storytoss$ rails db:create
- If you see an error about peer authentication, then you need to change one or two settings in pg_hba.conf, then try creating the databases again.
- Load the schema into the new database:
storytoss$ rails db:schema:load
- Seed the database:
storytoss$ rails db:seed
Distributed under the MIT License.