public
Description: A collection of RSpec matchers to be used with the Ruby on Rails project
Clone URL: git://github.com/joshknowles/rspec-on-rails-matchers.git
added support for nested view tests + updated the bundle

git-svn-id: https://rspec-on-rails-matchers.googlecode.com/svn/trunk@9 
11e6f158-dd3c-0410-a69b-4d739fb74d9d
mattAimonetti (author)
Wed Jan 02 21:50:54 -0800 2008
commit  8b99021ca5497248d5a1722313891225ade4548e
tree    7cb7d37d3b43bfe29f24846fcef39b453d207589
parent  b03a958b3932aa017348ca4d9499012ef815b264
...
12
13
14
 
 
 
 
 
 
15
16
17
18
19
20
 
 
 
 
 
 
21
22
23
...
25
26
27
 
 
 
 
 
 
28
29
30
31
32
 
 
 
 
 
 
33
34
35
36
 
 
 
 
 
 
 
37
38
39
...
42
43
44
 
 
 
 
 
 
45
46
47
48
...
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
...
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 
60
61
62
63
64
65
66
67
68
69
...
72
73
74
75
76
77
78
79
80
81
82
83
84
0
@@ -12,12 +12,24 @@ module Spec
0
           have_tag("label[for=#{attribute}]").matches?(response)
0
         end
0
       end
0
+
0
+ def with_label_for(attribute, text)
0
+ return simple_matcher("have a label for '#{attribute}' with value of '#{text}'") do |response|
0
+ with_tag("label[for=#{attribute}]").matches?(response)
0
+ end
0
+ end
0
 
0
       def have_text_field_for(attribute)
0
         return simple_matcher("have a text field for '#{attribute}'") do |response|
0
           have_tag("input##{attribute}[type=text]").matches?(response)
0
         end
0
       end
0
+
0
+ def with_text_field_for(attribute)
0
+ return simple_matcher("with a text field for '#{attribute}'") do |response|
0
+ with_tag("input##{attribute}[type=text]").matches?(response)
0
+ end
0
+ end
0
 
0
       def have_password_field_for(attribute)
0
         return simple_matcher("have a password field for '#{attribute}'") do |response|
0
@@ -25,15 +37,33 @@ module Spec
0
         end
0
       end
0
 
0
+ def with_password_field_for(attribute)
0
+ return simple_matcher("have a password field for '#{attribute}'") do |response|
0
+ with_tag("input##{attribute}[type=password]").matches?(response)
0
+ end
0
+ end
0
+
0
       def have_checkbox_for(attribute)
0
         return simple_matcher("have a checkbox for '#{attribute}'") do |response|
0
           have_tag("input##{attribute}[type=checkbox]").matches?(response)
0
         end
0
       end
0
+
0
+ def with_checkbox_for(attribute)
0
+ return simple_matcher("have a checkbox for '#{attribute}'") do |response|
0
+ have_tag("input##{attribute}[type=checkbox]").matches?(response)
0
+ end
0
+ end
0
 
0
       def have_submit_button
0
         return simple_matcher("have a submit button") do |response|
0
- have_tag("input[type=submit]").matches?(response)
0
+ with_tag("input[type=submit]").matches?(response)
0
+ end
0
+ end
0
+
0
+ def with_submit_button
0
+ return simple_matcher("have a submit button") do |response|
0
+ with_tag("input[type=submit]").matches?(response)
0
         end
0
       end
0
 
0
@@ -42,6 +72,12 @@ module Spec
0
           have_tag("a[href=#{url_or_path}]", text).matches?(response)
0
         end
0
       end
0
+
0
+ def with_link_to(url_or_path, text = nil)
0
+ return simple_matcher("have a link to '#{url_or_path}'") do |response|
0
+ with_tag("a[href=#{url_or_path}]", text).matches?(response)
0
+ end
0
+ end
0
     end
0
   end
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.