public
Rubygem
Description: Makes tests easy on the fingers and the eyes
Homepage: http://www.thoughtbot.com/projects/shoulda
Clone URL: git://github.com/thoughtbot/shoulda.git
Added shoulda_macros directory support as per 
http://thoughtbot.lighthouseapp.com/projects/5807/tickets/62
tsaleh (author)
Mon Aug 04 13:17:32 -0700 2008
commit  56a3f432b274b1762b26ba9516762c4cdc27dd17
tree    bffbdffff151d236ca9f235f41fbbbc6f9516956
parent  2cb29f5e6daf217299296282e753b5f0bef9ff37
...
114
115
116
 
 
 
 
 
 
 
 
 
 
 
 
117
118
119
120
121
122
123
 
...
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
 
135
0
@@ -114,10 +114,22 @@ More to come here, but have fun with what's there.
0
   assert_contains(['a', '1'], /\d/)
0
   assert_contains(['a', '1'], 'a')
0
 
0
+=== 3rd Party and Application Specific Macros
0
+
0
+Any *.rb file under RAILS_ROOT/test/shoulda_macros/ or vendor/(plugins|gems)/gem_name/shoulda_macros/ will be automatically required when you run your tests.  This allows you to distribute macros with your plugins, or to organize the macros inside your application.  Remember to add your macro to Test::Unit::TestCase in the macro file:
0
+
0
+  # test/shoulda_macros/security.rb
0
+  class Test::Unit::TestCase
0
+    def self.should_be_denied(opts = {})
0
+      should_set_the_flash_to(opts[:flash] || /Please log in/i)
0
+      should_redirect_to(opts[:redirect]   || 'login_url')
0
+    end
0
+  end
0
+
0
 = Credits
0
 
0
 Shoulda is maintained by {Tammer Saleh}[mailto:tsaleh@thoughtbot.com], and is funded by Thoughtbot[http://www.thoughtbot.com], inc. 
0
 
0
 = License
0
 
0
-Shoulda is Copyright © 2006-2007 Tammer Saleh, Thoughtbot. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
0
+Shoulda is Copyright © 2006-2008 Tammer Saleh, Thoughtbot. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
...
1
2
3
4
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
 
3
4
5
6
7
8
9
10
11
12
13
14
15
16
0
@@ -1,3 +1,15 @@
0
 require 'rubygems'
0
 require 'active_support'
0
-require 'shoulda'
0
\ No newline at end of file
0
+require 'shoulda'
0
+
0
+if defined?(RAILS_ROOT)
0
+  # load in the 3rd party macros from vendorized plugins and gems
1
+  Dir[File.join(RAILS_ROOT, "vendor", "{plugin,gem}", "*", "shoulda_macros", "*.rb")].each do |macro_file_path|
0
+    require macro_file_path
0
+  end
0
+
0
+  # load in the local application specific macros
0
+  Dir[File.join(RAILS_ROOT, "test", "shoulda_macros", "*.rb")].each do |macro_file_path|
0
+    require macro_file_path
0
+  end
0
+end

Comments

rmm5t Mon Aug 04 14:02:00 -0700 2008 at init.rb L9

Tammer, Shouldn’t {plugin,gem} be {plugins,gems} ?