public
Rubygem
Fork of thoughtbot/shoulda
Description: Makes tests easy on the fingers and the eyes
Homepage: http://www.thoughtbot.com/projects/shoulda
Clone URL: git://github.com/technicalpickles/shoulda.git
small refactorings

git-svn-id: https://svn.thoughtbot.com/plugins/shoulda/trunk@389 
7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
tsaleh (author)
Mon Mar 17 07:03:11 -0700 2008
commit  4ae2cea03674f2d0614a04a55398a68d5fe1dac1
tree    4d9e2d673331fcf47241e635724a3aa75af4e1fe
parent  53b1bb818a7a251e598241a0441d98fd45469910
...
9
10
11
 
 
 
 
12
13
 
14
15
16
...
31
32
33
34
 
35
36
37
...
56
57
58
59
 
60
61
62
...
77
78
79
80
 
81
82
83
...
99
100
101
102
 
103
104
105
...
131
132
133
134
 
135
136
137
...
164
165
166
167
 
168
169
170
...
9
10
11
12
13
14
15
16
 
17
18
19
20
...
35
36
37
 
38
39
40
41
...
60
61
62
 
63
64
65
66
...
81
82
83
 
84
85
86
87
...
103
104
105
 
106
107
108
109
...
135
136
137
 
138
139
140
141
...
168
169
170
 
171
172
173
174
0
@@ -9,8 +9,12 @@ module ThoughtBot # :nodoc:
0
         end
0
   
0
         module ClassMethods
0
+ def controller_name_from_class
0
+ self.name.gsub(/Test/, '')
0
+ end
0
+
0
           def make_show_html_tests(res)
0
- context "on GET to :show" do
0
+ context "on GET to #{controller_name_from_class}#show" do
0
               setup do
0
                 record = get_existing_record(res)
0
                 parent_params = make_parent_params(res, record)
0
@@ -31,7 +35,7 @@ module ThoughtBot # :nodoc:
0
           end
0
 
0
           def make_edit_html_tests(res)
0
- context "on GET to :edit" do
0
+ context "on GET to #{controller_name_from_class}#edit" do
0
               setup do
0
                 @record = get_existing_record(res)
0
                 parent_params = make_parent_params(res, @record)
0
@@ -56,7 +60,7 @@ module ThoughtBot # :nodoc:
0
           end
0
 
0
           def make_index_html_tests(res)
0
- context "on GET to :index" do
0
+ context "on GET to #{controller_name_from_class}#index" do
0
               setup do
0
                 record = get_existing_record(res) rescue nil
0
                 parent_params = make_parent_params(res, record)
0
@@ -77,7 +81,7 @@ module ThoughtBot # :nodoc:
0
           end
0
 
0
           def make_new_html_tests(res)
0
- context "on GET to :new" do
0
+ context "on GET to #{controller_name_from_class}#new" do
0
               setup do
0
                 record = get_existing_record(res) rescue nil
0
                 parent_params = make_parent_params(res, record)
0
@@ -99,7 +103,7 @@ module ThoughtBot # :nodoc:
0
           end
0
 
0
           def make_destroy_html_tests(res)
0
- context "on DELETE to :destroy" do
0
+ context "on DELETE to #{controller_name_from_class}#destroy" do
0
               setup do
0
                 @record = get_existing_record(res)
0
                 parent_params = make_parent_params(res, @record)
0
@@ -131,7 +135,7 @@ module ThoughtBot # :nodoc:
0
           end
0
 
0
           def make_create_html_tests(res)
0
- context "on POST to :create with #{res.create.params.inspect}" do
0
+ context "on POST to #{controller_name_from_class}#create with #{res.create.params.inspect}" do
0
               setup do
0
                 record = get_existing_record(res) rescue nil
0
                 parent_params = make_parent_params(res, record)
0
@@ -164,7 +168,7 @@ module ThoughtBot # :nodoc:
0
           end
0
 
0
           def make_update_html_tests(res)
0
- context "on PUT to :update with #{res.create.params.inspect}" do
0
+ context "on PUT to #{controller_name_from_class}#update with #{res.create.params.inspect}" do
0
               setup do
0
                 @record = get_existing_record(res)
0
                 parent_params = make_parent_params(res, @record)
...
28
29
30
31
 
32
33
34
...
56
57
58
59
 
60
61
62
...
75
76
77
78
 
79
80
81
...
100
101
102
103
 
104
105
106
...
126
127
128
129
 
130
131
132
...
28
29
30
 
31
32
33
34
...
56
57
58
 
59
60
61
62
...
75
76
77
 
78
79
80
81
...
100
101
102
 
103
104
105
106
...
126
127
128
 
129
130
131
132
0
@@ -28,7 +28,7 @@ module ThoughtBot # :nodoc:
0
           protected
0
                     
0
           def make_show_xml_tests(res) # :nodoc:
0
- context "on GET to :show as xml" do
0
+ context "on GET to #{controller_name_from_class}#show as xml" do
0
               setup do
0
                 request_xml
0
                 record = get_existing_record(res)
0
@@ -56,7 +56,7 @@ module ThoughtBot # :nodoc:
0
           end
0
 
0
           def make_index_xml_tests(res) # :nodoc:
0
- context "on GET to :index as xml" do
0
+ context "on GET to #{controller_name_from_class}#index as xml" do
0
               setup do
0
                 request_xml
0
                 parent_params = make_parent_params(res)
0
@@ -75,7 +75,7 @@ module ThoughtBot # :nodoc:
0
           end
0
 
0
           def make_destroy_xml_tests(res) # :nodoc:
0
- context "on DELETE to :destroy as xml" do
0
+ context "on DELETE to #{controller_name_from_class}#destroy as xml" do
0
               setup do
0
                 request_xml
0
                 @record = get_existing_record(res)
0
@@ -100,7 +100,7 @@ module ThoughtBot # :nodoc:
0
           end
0
 
0
           def make_create_xml_tests(res) # :nodoc:
0
- context "on POST to :create as xml" do
0
+ context "on POST to #{controller_name_from_class}#create as xml" do
0
               setup do
0
                 request_xml
0
                 parent_params = make_parent_params(res)
0
@@ -126,7 +126,7 @@ module ThoughtBot # :nodoc:
0
           end
0
 
0
           def make_update_xml_tests(res) # :nodoc:
0
- context "on PUT to :update as xml" do
0
+ context "on PUT to #{controller_name_from_class}#update as xml" do
0
               setup do
0
                 request_xml
0
                 @record = get_existing_record(res)
...
14
15
16
17
 
 
18
19
 
20
21
22
...
14
15
16
 
17
18
19
 
20
21
22
23
0
@@ -14,9 +14,10 @@ namespace :shoulda do
0
       load file
0
       klass = File.basename(file, '.rb').classify.constantize
0
       
0
- puts
0
+ puts klass.name.gsub('Test', '')
0
+
0
       test_methods = klass.instance_methods.grep(/^test/).map {|s| s.gsub(/^test: /, '')}.sort
0
- test_methods.each {|m| puts m }
0
+ test_methods.each {|m| puts " " + m }
0
     end
0
   end
0
 end

Comments

    No one has commented yet.