aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/plugins.md
diff options
context:
space:
mode:
authorPrem Sichanugrist <s@sikachu.com>2012-09-03 21:21:24 -0400
committerPrem Sichanugrist <s@sikac.hu>2012-09-17 15:54:23 -0400
commit721afdcc4b58c65f36122b10ec998b913a147912 (patch)
treef57d8f393c4bda7180b13e32eb4182093f0f1a54 /guides/source/plugins.md
parent5a4622b8b8aad53361b281583f587a39611e7aa3 (diff)
downloadrails-721afdcc4b58c65f36122b10ec998b913a147912.tar.gz
rails-721afdcc4b58c65f36122b10ec998b913a147912.tar.bz2
rails-721afdcc4b58c65f36122b10ec998b913a147912.zip
Fix remaining formatting problems in the guide
Diffstat (limited to 'guides/source/plugins.md')
-rw-r--r--guides/source/plugins.md70
1 files changed, 35 insertions, 35 deletions
diff --git a/guides/source/plugins.md b/guides/source/plugins.md
index eb8193052d..263f5b1351 100644
--- a/guides/source/plugins.md
+++ b/guides/source/plugins.md
@@ -28,10 +28,10 @@ Setup
-----
_"vendored plugins"_ were available in previous versions of Rails, but they are deprecated in
-Rails 3.2, and will not be available in the future.
+Rails 3.2, and will not be available in the future.
-Currently, Rails plugins are built as gems, _gemified plugins_. They can be shared across
-different rails applications using RubyGems and Bundler if desired.
+Currently, Rails plugins are built as gems, _gemified plugins_. They can be shared across
+different rails applications using RubyGems and Bundler if desired.
### Generate a gemified plugin.
@@ -54,7 +54,7 @@ You can navigate to the directory that contains the plugin, run the `bundle inst
You should see:
```bash
- 2 tests, 2 assertions, 0 failures, 0 errors, 0 skips
+ 2 tests, 2 assertions, 0 failures, 0 errors, 0 skips
```
This will tell you that everything got generated properly and you are ready to start adding functionality.
@@ -81,10 +81,10 @@ end
Run `rake` to run the test. This test should fail because we haven't implemented the `to_squawk` method:
```bash
- 1) Error:
- test_to_squawk_prepends_the_word_squawk(CoreExtTest):
- NoMethodError: undefined method `to_squawk' for [Hello World](String)
- test/core_ext_test.rb:5:in `test_to_squawk_prepends_the_word_squawk'
+ 1) Error:
+ test_to_squawk_prepends_the_word_squawk(CoreExtTest):
+ NoMethodError: undefined method `to_squawk' for [Hello World](String)
+ test/core_ext_test.rb:5:in `test_to_squawk_prepends_the_word_squawk'
```
Great - now you are ready to start development.
@@ -115,7 +115,7 @@ end
To test that your method does what it says it does, run the unit tests with `rake` from your plugin directory.
```bash
- 3 tests, 3 assertions, 0 failures, 0 errors, 0 skips
+ 3 tests, 3 assertions, 0 failures, 0 errors, 0 skips
```
To see this in action, change to the test/dummy directory, fire up a console and start squawking:
@@ -191,18 +191,18 @@ end
When you run `rake`, you should see the following:
-```bash
- 1) Error:
- test_a_hickwalls_yaffle_text_field_should_be_last_squawk(ActsAsYaffleTest):
- NameError: uninitialized constant ActsAsYaffleTest::Hickwall
- test/acts_as_yaffle_test.rb:6:in `test_a_hickwalls_yaffle_text_field_should_be_last_squawk'
+```
+ 1) Error:
+ test_a_hickwalls_yaffle_text_field_should_be_last_squawk(ActsAsYaffleTest):
+ NameError: uninitialized constant ActsAsYaffleTest::Hickwall
+ test/acts_as_yaffle_test.rb:6:in `test_a_hickwalls_yaffle_text_field_should_be_last_squawk'
- 2) Error:
- test_a_wickwalls_yaffle_text_field_should_be_last_tweet(ActsAsYaffleTest):
- NameError: uninitialized constant ActsAsYaffleTest::Wickwall
- test/acts_as_yaffle_test.rb:10:in `test_a_wickwalls_yaffle_text_field_should_be_last_tweet'
+ 2) Error:
+ test_a_wickwalls_yaffle_text_field_should_be_last_tweet(ActsAsYaffleTest):
+ NameError: uninitialized constant ActsAsYaffleTest::Wickwall
+ test/acts_as_yaffle_test.rb:10:in `test_a_wickwalls_yaffle_text_field_should_be_last_tweet'
- 5 tests, 3 assertions, 0 failures, 2 errors, 0 skips
+ 5 tests, 3 assertions, 0 failures, 2 errors, 0 skips
```
This tells us that we don't have the necessary models (Hickwall and Wickwall) that we are trying to test.
@@ -266,20 +266,20 @@ ActiveRecord::Base.send :include, Yaffle::ActsAsYaffle
You can then return to the root directory (`cd ../..`) of your plugin and rerun the tests using `rake`.
-```bash
- 1) Error:
- test_a_hickwalls_yaffle_text_field_should_be_last_squawk(ActsAsYaffleTest):
- NoMethodError: undefined method `yaffle_text_field' for #<Class:0x000001016661b8>
- /Users/xxx/.rvm/gems/ruby-1.9.2-p136@xxx/gems/activerecord-3.0.3/lib/active_record/base.rb:1008:in `method_missing'
- test/acts_as_yaffle_test.rb:5:in `test_a_hickwalls_yaffle_text_field_should_be_last_squawk'
+```
+ 1) Error:
+ test_a_hickwalls_yaffle_text_field_should_be_last_squawk(ActsAsYaffleTest):
+ NoMethodError: undefined method `yaffle_text_field' for #<Class:0x000001016661b8>
+ /Users/xxx/.rvm/gems/ruby-1.9.2-p136@xxx/gems/activerecord-3.0.3/lib/active_record/base.rb:1008:in `method_missing'
+ test/acts_as_yaffle_test.rb:5:in `test_a_hickwalls_yaffle_text_field_should_be_last_squawk'
- 2) Error:
- test_a_wickwalls_yaffle_text_field_should_be_last_tweet(ActsAsYaffleTest):
- NoMethodError: undefined method `yaffle_text_field' for #<Class:0x00000101653748>
- Users/xxx/.rvm/gems/ruby-1.9.2-p136@xxx/gems/activerecord-3.0.3/lib/active_record/base.rb:1008:in `method_missing'
- test/acts_as_yaffle_test.rb:9:in `test_a_wickwalls_yaffle_text_field_should_be_last_tweet'
+ 2) Error:
+ test_a_wickwalls_yaffle_text_field_should_be_last_tweet(ActsAsYaffleTest):
+ NoMethodError: undefined method `yaffle_text_field' for #<Class:0x00000101653748>
+ Users/xxx/.rvm/gems/ruby-1.9.2-p136@xxx/gems/activerecord-3.0.3/lib/active_record/base.rb:1008:in `method_missing'
+ test/acts_as_yaffle_test.rb:9:in `test_a_wickwalls_yaffle_text_field_should_be_last_tweet'
- 5 tests, 3 assertions, 0 failures, 2 errors, 0 skips
+ 5 tests, 3 assertions, 0 failures, 2 errors, 0 skips
```
@@ -310,7 +310,7 @@ ActiveRecord::Base.send :include, Yaffle::ActsAsYaffle
When you run `rake` you should see the tests all pass:
```bash
- 5 tests, 5 assertions, 0 failures, 0 errors, 0 skips
+ 5 tests, 5 assertions, 0 failures, 0 errors, 0 skips
```
### Add an Instance Method
@@ -352,7 +352,7 @@ Run the test to make sure the last two tests fail with an error that contains "N
then update 'acts_as_yaffle.rb' to look like this:
```ruby
-# yaffle/lib/yaffle/acts_as_yaffle.rb
+# yaffle/lib/yaffle/acts_as_yaffle.rb
module Yaffle
module ActsAsYaffle
@@ -383,8 +383,8 @@ ActiveRecord::Base.send :include, Yaffle::ActsAsYaffle
Run `rake` one final time and you should see:
-```bash
- 7 tests, 7 assertions, 0 failures, 0 errors, 0 skips
+```
+ 7 tests, 7 assertions, 0 failures, 0 errors, 0 skips
```
NOTE: The use of `write_attribute` to write to the field in model is just one example of how a plugin can interact with the model, and will not always be the right method to use. For example, you could also use `send("#{self.class.yaffle_text_field}=", string.to_squawk)`.