Take the 2008 Git User's Survey and help out! [ hide ]

public
Description: Mirror of the ARTS Rails plugin.
Homepage: http://glu.ttono.us/articles/2006/05/29/guide-test-driven-rjs-with-arts
Clone URL: git://github.com/richpoirier/arts.git
Search Repo:
Update ARTS for 1.2, removing lined response
kevinc (author)
Mon Jan 29 00:22:27 -0800 2007
commit  305478855d1a9b2158feb5dc26bbf123bd00cadc
tree    bc3bb02f6408bd2bdaff11dcb0eec4d49830de6f
parent  c6325ec227e44700051385250d43448ccdcdbf7f
...
2
3
4
5
 
6
7
8
...
2
3
4
 
5
6
7
8
0
@@ -2,6 +2,6 @@ author: Kevin Clark
0
 summary: RJS Assertion Plugin
0
 homepage: http://glu.ttono.us
0
 plugin:
0
-version: 0.5
0
+version: 0.6
0
 license: MIT
0
 rails_version: 1.1.2+
0
\ No newline at end of file
...
9
10
11
12
 
13
14
15
...
29
30
31
32
 
33
34
35
36
 
37
38
39
...
53
54
55
56
 
57
58
 
59
60
61
...
74
75
76
77
 
78
79
 
80
81
82
...
94
95
96
 
 
 
 
97
98
99
...
110
111
112
113
114
115
116
117
118
119
120
121
122
123
 
124
125
126
...
9
10
11
 
12
13
14
15
...
29
30
31
 
32
33
34
35
 
36
37
38
39
...
53
54
55
 
56
57
 
58
59
60
61
...
74
75
76
 
77
78
 
79
80
81
82
...
94
95
96
97
98
99
100
101
102
103
...
114
115
116
 
 
 
 
117
118
119
120
121
122
 
123
124
125
126
0
@@ -9,7 +9,7 @@ module Arts
0
   def assert_rjs(action, *args, &block)
0
     respond_to?("assert_rjs_#{action}") ?
0
       send("assert_rjs_#{action}", *args) :
0
- assert(lined_response.include?(create_generator.send(action, *args, &block)),
0
+ assert_response_contains(create_generator.send(action, *args, &block),
0
          generic_error(action, args))
0
   end
0
   
0
@@ -29,11 +29,11 @@ module Arts
0
           assert_match Regexp.new("new Insertion\.#{position.to_s.camelize}(.*#{item_id}.*,.*#{content.source}.*);"),
0
                        @response.body
0
         when String
0
- assert lined_response.include?("new Insertion.#{position.to_s.camelize}(\"#{item_id}\", #{content});"),
0
+ assert_response_contains("new Insertion.#{position.to_s.camelize}(\"#{item_id}\", #{content});",
0
                  "No insert_html call found for \n" +
0
                  " position: '#{position}' id: '#{item_id}' \ncontent: \n" +
0
                  "#{content}\n" +
0
- "in response:\n#{lined_response}"
0
+ "in response:\n#{@response.body}")
0
         else
0
           raise "Invalid content type"
0
       end
0
@@ -53,9 +53,9 @@ module Arts
0
           assert_match Regexp.new("Element.update(.*#{div}.*,.*#{content.source}.*);"),
0
                        @response.body
0
         when String
0
- assert lined_response.include?("Element.update(\"#{div}\", #{content});"),
0
+ assert_response_contains("Element.update(\"#{div}\", #{content});",
0
                  "No replace_html call found on div: '#{div}' and content: \n#{content}\n" +
0
- "in response:\n#{lined_response}"
0
+ "in response:\n#{@response.body}")
0
         else
0
           raise "Invalid content type"
0
       end
0
@@ -74,9 +74,9 @@ module Arts
0
           assert_match Regexp.new("Element.replace(.*#{div}.*,.*#{content.source}.*);"),
0
                        @response.body
0
         when String
0
- assert lined_response.include?("Element.replace(\"#{div}\", #{content});"),
0
+ assert_response_contains("Element.replace(\"#{div}\", #{content});",
0
                  "No replace call found on div: '#{div}' and content: \n#{content}\n" +
0
- "in response:\n#{lined_response}"
0
+ "in response:\n#{@response.body}")
0
         else
0
           raise "Invalid content type"
0
       end
0
@@ -94,6 +94,10 @@ module Arts
0
   
0
   protected
0
   
0
+ def assert_response_contains(str, message)
0
+ assert @response.body.to_s.index(str), message
0
+ end
0
+
0
   def build_method_chain!(args)
0
     content = create_generator.send(:[], args.shift) # start $('some_id')....
0
     
0
@@ -110,17 +114,13 @@ module Arts
0
     content
0
   end
0
   
0
- def lined_response
0
- @response.body.split("\n")
0
- end
0
-
0
   def create_generator
0
     block = Proc.new { |*args| yield *args if block_given? }
0
     JavaScriptGenerator.new self, &block
0
   end
0
   
0
   def generic_error(action, args)
0
- "#{action} with args [#{args.join(" ")}] does not show up in response:\n#{lined_response}"
0
+ "#{action} with args [#{args.join(" ")}] does not show up in response:\n#{@response.body}"
0
   end
0
   
0
   def extract_matchable_content(args)

Comments

    No one has commented yet.