diff options
author | Jeff Dean <jeff@zilkey.com> | 2008-11-12 02:05:19 -0500 |
---|---|---|
committer | Jeff Dean <jeff@zilkey.com> | 2008-11-12 02:05:19 -0500 |
commit | 40bc386ed8cc403050292ab19428f1e467fa1737 (patch) | |
tree | a51e14c1ec6e1512ae34278fbad6c5c6f1ac03ef /railties/doc/guides/source/creating_plugins/string_to_squawk.txt | |
parent | 7f24653e7a39da9eb85b282e929d0712b2f1c9b7 (diff) | |
download | rails-40bc386ed8cc403050292ab19428f1e467fa1737.tar.gz rails-40bc386ed8cc403050292ab19428f1e467fa1737.tar.bz2 rails-40bc386ed8cc403050292ab19428f1e467fa1737.zip |
Plugin Guide: cleaned up file paths, made formatting more consistent
Diffstat (limited to 'railties/doc/guides/source/creating_plugins/string_to_squawk.txt')
-rw-r--r-- | railties/doc/guides/source/creating_plugins/string_to_squawk.txt | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/railties/doc/guides/source/creating_plugins/string_to_squawk.txt b/railties/doc/guides/source/creating_plugins/string_to_squawk.txt index 50516cef69..63f1131442 100644 --- a/railties/doc/guides/source/creating_plugins/string_to_squawk.txt +++ b/railties/doc/guides/source/creating_plugins/string_to_squawk.txt @@ -10,10 +10,10 @@ Most plugins store their code classes in the plugin's lib directory. When you a First, you need to write the tests. Testing plugins is very similar to testing rails apps. The generated test file should look something like this: +*vendor/plugins/yaffle/test/core_ext_test.rb* + [source, ruby] -------------------------------------------------------- -# File: vendor/plugins/yaffle/test/core_ext_test.rb - require 'test/unit' class CoreExtTest < Test::Unit::TestCase @@ -26,11 +26,10 @@ end Start off by removing the default test, and adding a require statement for your test helper. +*vendor/plugins/yaffle/test/core_ext_test.rb* + [source, ruby] -------------------------------------------------------- -# File: vendor/plugins/yaffle/test/core_ext_test.rb - -require 'test/unit' require File.dirname(__FILE__) + '/test_helper.rb' class CoreExtTest < Test::Unit::TestCase @@ -53,10 +52,10 @@ No tests were specified Great - now you are ready to start development. The first thing we'll do is to add a method to String called `to_squawk` which will prefix the string with the word ``squawk!''. The test will look something like this: +*vendor/plugins/yaffle/init.rb* + [source, ruby] -------------------------------------------------------- -# File: vendor/plugins/yaffle/init.rb - class CoreExtTest < Test::Unit::TestCase def test_string_should_respond_to_squawk assert_equal true, "".respond_to?(:to_squawk) @@ -72,17 +71,17 @@ class CoreExtTest < Test::Unit::TestCase end -------------------------------------------------------- +*vendor/plugins/yaffle/init.rb* + [source, ruby] -------------------------------------------------------- -# File: vendor/plugins/yaffle/init.rb - require "core_ext" -------------------------------------------------------- +*vendor/plugins/yaffle/lib/core_ext.rb* + [source, ruby] -------------------------------------------------------- -# File: vendor/plugins/yaffle/lib/core_ext.rb - String.class_eval do def to_squawk "squawk! #{self}".strip |