Readme.markdown in spud_blog-0.8.12 vs Readme.markdown in spud_blog-0.8.13

- old
+ new

@@ -70,6 +70,43 @@ <%= f.label :caption, 'Caption',:class => "control-label" %> <div class="controls"> <%= f.text_field :caption %> </div> </div> - \ No newline at end of file + +## Extending the Post Model + +Rails engines allow you to extend or even completely override classes by adding them to your local application. Source files found in your local app's path will take precedence over those found within the Spud Blog gem. Lets say you wanted to extend the SpudPost model. + +1. Create a file at `app/models/spud_post.rb` +2. Add the following code: + + # Use this helper method to pull in the SpudPost source code from the engine + Spud::Blog::Engine.require_model('spud_post') + + # Add your own methods to SpudPost + class SpudPost + attr_accessible :caption + def byline + return "'#{self.title}' was posted by #{self.author.full_name} on #{self.display_date}" + end + end + +Testing +----------------- + +Spud uses RSpec for testing. Get the tests running with a few short commands: + +1. Create and migrate the databases: + + rake db:create + rake db:migrate + +2. Load the schema in to the test database: + + rake app:db:test:prepare + +3. Run the tests with RSpec + + rspec spec + +After the tests have completed the current code coverage stats is available by opening ```/coverage/index.html``` in a browser.