rspec2-rails-views-matchers 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/.travis.yml +4 -0
- data/README.md +35 -1
- data/docs/CHANGELOG.md +7 -2
- data/lib/rspec/rails/views/matchers/have_tag.rb +4 -2
- data/lib/version.rb +1 -1
- data/rspec2-rails-views-matchers.gemspec +1 -0
- data/spec/matchers/have_tag_spec.rb +7 -3
- metadata +31 -17
- data/Gemfile.lock +0 -30
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -11,9 +11,12 @@ Why?
|
|
11
11
|
* you need to test some complex views
|
12
12
|
* and you want to use rspec2
|
13
13
|
* and assert\_select seems is something strange to you
|
14
|
-
* [rspec-rails](http://github.com/rspec/rspec-rails)
|
14
|
+
* have_tag in [rspec-rails](http://github.com/rspec/rspec-rails) are deprecated now
|
15
15
|
* you need user-firendly output in error messages
|
16
16
|
|
17
|
+
Being true
|
18
|
+
==========
|
19
|
+
|
17
20
|
Install
|
18
21
|
-------
|
19
22
|
|
@@ -33,9 +36,40 @@ some examples:
|
|
33
36
|
without_tag "p", :text => /content/i
|
34
37
|
end
|
35
38
|
|
39
|
+
additional list of defined matchers ("form" matchers)
|
40
|
+
-----------------------------------------------------
|
41
|
+
|
42
|
+
- [have_form](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:have_form)
|
43
|
+
- [with_checkbox](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_checkbox)
|
44
|
+
- [with_file_field](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_file_field)
|
45
|
+
- [with_hidden_field](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_hidden_field)
|
46
|
+
- [with_option](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_option)
|
47
|
+
- [with_password_field](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_password_field)
|
48
|
+
- [with_radio_button](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_radio_button)
|
49
|
+
- [with_select](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_select)
|
50
|
+
- [with_submit](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_submit)
|
51
|
+
- [with_text_area](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_text_area)
|
52
|
+
- [with_text_field](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_text_field)
|
53
|
+
|
54
|
+
and of course you can use <strong>without_</strong>matchers
|
55
|
+
|
36
56
|
More info
|
37
57
|
---------
|
38
58
|
|
39
59
|
You can find [on RubyDoc](http://rubydoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers), take a look at {RSpec::Matchers#have\_tag have\_tag} method.
|
40
60
|
|
41
61
|
Also, please read {file:docs/CHANGELOG.md CHANGELOG}, it might be helpful.
|
62
|
+
|
63
|
+
Contribution
|
64
|
+
============
|
65
|
+
|
66
|
+
1. fork
|
67
|
+
2. add tests for feature
|
68
|
+
3. write implementation
|
69
|
+
4. send pull request
|
70
|
+
|
71
|
+
Contributors
|
72
|
+
============
|
73
|
+
|
74
|
+
- [Kelly Felkins](http://github.com/kellyfelkins)
|
75
|
+
- [Ryan Wilcox](http://github.com/rwilcox)
|
data/docs/CHANGELOG.md
CHANGED
@@ -9,15 +9,20 @@ unreleased(TODO)
|
|
9
9
|
* raise exception when wrong parametres specified(:count and :minimum simultaneously)
|
10
10
|
* organize code
|
11
11
|
* add :without to have\_tag?
|
12
|
-
*
|
12
|
+
* ?make possible constructions like:
|
13
13
|
|
14
14
|
rendered.should have(3).tags('div').with(:class => 'some-class').and_content(/some content/)
|
15
15
|
|
16
|
+
0.0.6
|
17
|
+
-----
|
18
|
+
|
19
|
+
* allow for single quotes in content matchers (thanks to [Kelly Felkins](http://github.com/kellyfelkins)).
|
20
|
+
|
16
21
|
0.0.5 (trial-trip)
|
17
22
|
----------------------
|
18
23
|
|
19
24
|
* added some experimental matchers:
|
20
|
-
* have\_form
|
25
|
+
* have\_form
|
21
26
|
* with\_hidden\_field
|
22
27
|
* with\_text\_field
|
23
28
|
* with\_password\_field
|
@@ -104,9 +104,11 @@ module RSpec
|
|
104
104
|
false
|
105
105
|
end
|
106
106
|
else
|
107
|
-
|
107
|
+
css_param = text.gsub(/'/) { %q{\000027} }
|
108
|
+
new_scope = @current_scope.css(":content('#{css_param}')",Class.new {
|
108
109
|
def content node_set, text
|
109
|
-
|
110
|
+
match_text = text.gsub(/\\000027/, "'")
|
111
|
+
node_set.find_all { |node| node.content == match_text }
|
110
112
|
end
|
111
113
|
}.new)
|
112
114
|
unless new_scope.empty?
|
data/lib/version.rb
CHANGED
@@ -178,6 +178,8 @@ HTML
|
|
178
178
|
before :each do
|
179
179
|
render_html <<HTML
|
180
180
|
<div>sample text</div>
|
181
|
+
<span>sample with 'single' quotes</span>
|
182
|
+
<span>sample with 'single' and "double" quotes</span>
|
181
183
|
<p>one </p>
|
182
184
|
<p> two</p>
|
183
185
|
<p> three </p>
|
@@ -185,9 +187,11 @@ HTML
|
|
185
187
|
end
|
186
188
|
|
187
189
|
it "should find tags" do
|
188
|
-
rendered.should have_tag('div',
|
189
|
-
rendered.should have_tag('p',
|
190
|
-
rendered.should have_tag('div',
|
190
|
+
rendered.should have_tag('div', :text => 'sample text' )
|
191
|
+
rendered.should have_tag('p', :text => 'one ' )
|
192
|
+
rendered.should have_tag('div', :text => /SAMPLE/i )
|
193
|
+
rendered.should have_tag('span', :text => "sample with 'single' quotes")
|
194
|
+
rendered.should have_tag('span', :text => %Q{sample with 'single' and "double" quotes})
|
191
195
|
end
|
192
196
|
|
193
197
|
it "should not find tags" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec2-rails-views-matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- kucaahbe
|
@@ -15,13 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-07 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
22
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
23
|
none: false
|
26
24
|
requirements:
|
27
25
|
- - ">="
|
@@ -32,12 +30,12 @@ dependencies:
|
|
32
30
|
- 0
|
33
31
|
- 0
|
34
32
|
version: 2.0.0
|
33
|
+
requirement: *id001
|
34
|
+
name: rspec
|
35
|
+
prerelease: false
|
35
36
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
|
39
|
-
prerelease: false
|
40
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
40
|
requirements:
|
43
41
|
- - ~>
|
@@ -48,12 +46,26 @@ dependencies:
|
|
48
46
|
- 4
|
49
47
|
- 4
|
50
48
|
version: 1.4.4
|
49
|
+
requirement: *id002
|
50
|
+
name: nokogiri
|
51
|
+
prerelease: false
|
51
52
|
type: :runtime
|
52
|
-
version_requirements: *id002
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
requirement: *id003
|
54
64
|
name: simplecov
|
55
65
|
prerelease: false
|
56
|
-
|
66
|
+
type: :development
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
57
69
|
none: false
|
58
70
|
requirements:
|
59
71
|
- - ">="
|
@@ -62,8 +74,10 @@ dependencies:
|
|
62
74
|
segments:
|
63
75
|
- 0
|
64
76
|
version: "0"
|
77
|
+
requirement: *id004
|
78
|
+
name: rake
|
79
|
+
prerelease: false
|
65
80
|
type: :development
|
66
|
-
version_requirements: *id003
|
67
81
|
description: Nokogiri based 'have_tag' and 'with_tag' for rspec-2 without assert_select dependencies and useful error messages
|
68
82
|
email:
|
69
83
|
- kucaahbe@ukr.net
|
@@ -76,9 +90,9 @@ extra_rdoc_files: []
|
|
76
90
|
files:
|
77
91
|
- .gitignore
|
78
92
|
- .rspec
|
93
|
+
- .travis.yml
|
79
94
|
- .yardopts
|
80
95
|
- Gemfile
|
81
|
-
- Gemfile.lock
|
82
96
|
- README.md
|
83
97
|
- Rakefile
|
84
98
|
- docs/CHANGELOG.md
|
@@ -122,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
136
|
requirements: []
|
123
137
|
|
124
138
|
rubyforge_project: rspec2-rails-views-matchers
|
125
|
-
rubygems_version: 1.
|
139
|
+
rubygems_version: 1.3.7
|
126
140
|
signing_key:
|
127
141
|
specification_version: 3
|
128
142
|
summary: Nokogiri based 'have_tag' and 'with_tag' for rspec-2 without assert_select dependencies and useful error messages
|
data/Gemfile.lock
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
rspec2-rails-views-matchers (0.0.5)
|
5
|
-
nokogiri (~> 1.4.4)
|
6
|
-
rspec (>= 2.0.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
diff-lcs (1.1.2)
|
12
|
-
nokogiri (1.4.4)
|
13
|
-
rspec (2.5.0)
|
14
|
-
rspec-core (~> 2.5.0)
|
15
|
-
rspec-expectations (~> 2.5.0)
|
16
|
-
rspec-mocks (~> 2.5.0)
|
17
|
-
rspec-core (2.5.1)
|
18
|
-
rspec-expectations (2.5.0)
|
19
|
-
diff-lcs (~> 1.1.2)
|
20
|
-
rspec-mocks (2.5.0)
|
21
|
-
simplecov (0.4.1)
|
22
|
-
simplecov-html (~> 0.4.3)
|
23
|
-
simplecov-html (0.4.3)
|
24
|
-
|
25
|
-
PLATFORMS
|
26
|
-
ruby
|
27
|
-
|
28
|
-
DEPENDENCIES
|
29
|
-
rspec2-rails-views-matchers!
|
30
|
-
simplecov
|