$ composer global require friendsofphp/php-cs-fixer
# > n = Node.find_where(terms2){|v| !v["Section"].empty?} | |
# => #<Node key="Sections" value=Hash children=1> | |
# > puts n.path | |
# => [0]["Departments"]["Department"][3]["Courses"]["Course"][1]["Sections"] | |
class Node | |
attr_reader :parent, :key, :value, :children | |
def initialize(parent, key, value) | |
@parent = parent | |
@key = key | |
@value = value |
Definition: the practice of frequently integrating one's new or changed code with the existing code repository -Wikipedia
Merging new code into master often sounds awesome, but we've been learning the value of testing and the importance of a passing test suite.
But, as your projects grow, your test suite should grow as well. We're all lazy and forget to run the entire test suite everytime we create a new commit. For large projects, running the entire test suite can take hours. So we do what all lazy people do, make a computer to the work for us.
In a large application, running all the tests at once using rake spec
can make it difficult to check the output of the test you're working on. Especially if you have many failing or pending tests. Run a single test by running rspec:
rspec spec/models/account.rb
You can be even more specific and run a specific example from a test file. For example, given the following tests:
11: describe "#deposit!" do
- TDD Test Driven Development. Write examples before implementation.
- BDD Behaviour-Driven Development is about implementing an application by describing its behavior from the perspective of its stakeholders. (The Rspec Book)
- RSpec (mention alternatives, write a simple hand sewn test)
+# Learning | |
+#Proper Variable Naming - make the variable name descriptive and concise | |
=>don't name after the data structure | |
=>avoid numbered variables (var1, var2, var3) | |
=>avoid single character names (except for short blocks or indexes) | |
+#Proper Method Naming | |
=>use the right suffix (! or ?) | |
=>the name should reflect the method's single responsibility | |
+#Keep it DRY |