Last active
December 19, 2015 11:29
-
-
Save prusswan/5948035 to your computer and use it in GitHub Desktop.
Rails 4 in Action 1P review notes
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
1.2.4 Scaffolding | |
binstubs was only introduced later on, so bin/rails makes no sense | |
Listing 1.16 | |
update(purchase_params) is used instead of update_attributes(params[:purchase]) | |
Chapter 2 | |
Some mentioning of current tools that assist with the tdd process such as guard/debugger/pry could be useful here. | |
Listing 3.4 | |
assets group is deprecated | |
Listing 3.5 | |
Text should corresponding to the listing for references to rspec-rails versions (2.13.x) | |
3.3.3 Applying a stylesheet | |
custom stylesheet no longer relevant? (according to https://github.com/steveklabnik/ticketee) | |
Listing 3.9 | |
`visit root_url` (named route in place of string paths) is more idiomatic | |
Listing 3.11 | |
Some mentioning of the limited scaffold_controller generator (and its various options to exclude generation of specs like --no-controller-specs) | |
could be useful, either here or later, to make the point that it already comes with useful defaults such as | |
set_model and model_params methods. | |
Or earlier, when scaffold is used for the first and only time (it shows up in the console output) | |
Listing 3.16 | |
<p> without matching closing tag | |
Listing 3.17 | |
Effects of strong_parameters should be mentioned here since it is default in Rails 4. | |
Expecting a ForbiddenAttributesError here | |
Listing 3.23 | |
In the Warning box, validates_uniqueness_of is actually a convention from Rails 2 | |
even though it is equivalent to the current `validates` idiom. | |
Listing 3.24 | |
Doesn't make sense, the example doesn't have anything to do with projects#new, and mentioning it can only lead to confusion | |
4.1.1 The Factory Girl | |
typo: factory_girl_rails | |
why is factory_girl needed as well? | |
Listing 4.2 spec/support/factories/project_factory.rb | |
Inconsistent path, should be spec/factories | |
4.1.2 Adding a link to a project | |
5 examples, 2 pending is inconsistent (generated spec files were removed earlier) | |
Listing 4.9 | |
Inconsisted factory_girl syntax | |
5.1.3 Defining a has_many association | |
index syntax for generated migration has changed | |
Listing 5.7 Listing 5.7 spec/factories/ticket_factory.rb | |
Inconsistent: previously spec/support/factories was used | |
Listing 5.10 Listing 5.10 update action, TicketsController | |
why leave out the method header? `def update; end` | |
6.1 Authentication Basics | |
user.authentication should be user.authenticate | |
Missing labels for code listings | |
6.2 Signing Up | |
name of the spec file (signing_up_spec.rb) is only mentioned much later, needs to be earlier | |
Missing labels for code listings | |
what is @ticket.errors doing in user form partial?! | |
There should be 19 examples right before "Implemented sign up." | |
There should be 21 examples right before "Implement profile pages" | |
NO mention of user_factory.rb! | |
Significant content needed for user_profile_spec.rb to work is missing: | |
https://github.com/steveklabnik/ticketee/commit/dec14182e98d368e9465cf4af24c86ecaa130482 | |
6.3 Signing in | |
Code listing for sessions#new view should match: https://github.com/steveklabnik/ticketee/blob/master/app/views/sessions/new.html.erb | |
6.4 Linking tickets to users | |
require_signin! is not defined | |
6.4.1 Attributing tickets to users | |
signing_in_spec.rb doesn't exist and shouldn't be failing | |
Listing 6.1 | |
Wrong code, check against: https://github.com/steveklabnik/ticketee/commit/339a4067d62b2e2bd7b0b994a9714720052d413f | |
6.4.5 Fixing the Deleting Tickets feature | |
There should be 22 examples at the end. | |
sign_in_as! can be used for sign_in_spec.rb as well | |
7.1 Turning users into admins | |
spec/support/factories should be spec/factories | |
7.2.2 Fixing three broken scenarios | |
creating_projects_spec.rb should be failing as well | |
There should be 27 examples at the end. | |
7.3 Hiding links | |
36 examples at the end. | |
7.4 Namespace routing | |
37 examples at the end. | |
Listing 7.11 | |
Missing step for filling password_confirmation | |
7.5.3 The new action | |
Missing password_confirmation field | |
7.5.4 The create action | |
38 examples at the end | |
7.5.5 Creating admin users | |
shouldn't mention attr_accessible for to_s method | |
39 examples at the end | |
7.5.6 Editing users | |
`find_user` should be `set_user` | |
7.5.7 The edit and update actions | |
`find_user` should be `set_user` | |
`validates :email, presence: true` will cause signing_up.spec to fail, User#user_params need to be updated | |
42 examples at the end | |
7.5.9 Ensuring you can't delete yourself | |
44 examples at the end | |
8.2 Restricting by scope | |
`find_project` should be `set_project` | |
8.3.2 Fixing the four failing features | |
45 examples | |
8.3.3 One more thing | |
`find_project` should be `set_project` | |
`scope :self_for` should be just `scope :for` | |
8.3.4 Fixing signing up | |
45 examples | |
8.4 Blocking access to tickets | |
`find_project` should be `set_project` | |
46 examples | |
Listing 8.6 spec/controllers/tickets_controller_spec.rb | |
sign_in(:user, user) should be sigin_in(user) | |
8.5.3 Adding abilities | |
48 examples | |
8.6.2 Authorizing editing | |
50 examples | |
8.8 Hiding links based on permission | |
scenario "Edit ticket link is shown to a user with permission" needs `ticket` on first line | |
60 examples | |
8.9.1 Viewing projects | |
62 examples | |
8.9.2 And the rest | |
64 examples | |
Listing 8.18 db/seeds.rb | |
[email protected] should be [email protected], missing password_confirmation parameter | |
65 examples | |
9.1.3 Using CarrierWave | |
66 examples | |
Listing 9.6 db/migrate/[date]_create_assets.rb | |
invalid migration file | |
remove_column :tickets, :asset, :string (so that it is reversible) | |
9.2.3 Using nested attributes | |
Not mentioned: `mount_uploader :asset, AssetUploader` was moved from ticket.rb to asset.rb | |
66 examples | |
9.3.4 Privatizing assets | |
uploads should be added to .gitignore | |
68 examples | |
Listing 9.12 spec/features/creating_tickets_spec.rb | |
Rails.root.join is needed for File #1 as well | |
9.4.5 Responding to an asynchronous request | |
Files#new is incomplete: https://github.com/steveklabnik/ticketee/commit/d6034be26d3b100c901128ccb80ea0f396c3b8b6 | |
9.4.6 Sending parameters for an asynchronous request | |
Consider the use of jquery-turbolinks, and headless javascript testing | |
68 examples |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment