rspec2-rails-views-matchers 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,10 +7,10 @@ Why?
7
7
  ===
8
8
 
9
9
  * you need to test some complex views
10
- * and you want to use rspec2
10
+ * and you want to use RSpec2
11
11
  * and assert\_select seems is something strange to you
12
12
  * have_tag in [rspec-rails](http://github.com/rspec/rspec-rails) are deprecated now
13
- * you need user-firendly output in error messages
13
+ * you need a user-firendly output in your error messages
14
14
 
15
15
  Being true
16
16
  ==========
@@ -18,20 +18,21 @@ Being true
18
18
  Install
19
19
  -------
20
20
 
21
- add to your Gemfile(in group :test :) ):
21
+ Add to your Gemfile (in the :test group :) ):
22
22
 
23
- gem 'rspec2-rails-views-matchers'
23
+ group :test do
24
+ gem 'rspec2-rails-views-matchers'
25
+ end
24
26
 
25
- Instructions for [installing nokogiri here.](http://nokogiri.org/tutorials/installing_nokogiri.html)
27
+ Instructions for [installing Nokogiri](http://nokogiri.org/tutorials/installing_nokogiri.html).
26
28
 
27
29
  Usage
28
30
  -----
29
31
 
30
- simple example:
32
+ Simple example:
31
33
 
32
34
  view=<<-HTML
33
35
  <h1>Simple Form</h1>
34
-
35
36
  <form action="/users" method="post">
36
37
  <p>
37
38
  <input type="email" name="user[email]" />
@@ -41,8 +42,9 @@ simple example:
41
42
  </p>
42
43
  </form>
43
44
  HTML
44
- view.should have_tag('form',:with => {:action => '/users', :method => 'post'}) do
45
- with_tag "input", :with => { :name => "user[email]", :type => 'email' }
45
+
46
+ view.should have_tag('form', :with => { :action => '/users', :method => 'post' }) do
47
+ with_tag "input", :with => { :name => "user[email]", :type => 'email' }
46
48
  with_tag "input#special_submit", :count => 1
47
49
  without_tag "h1", :text => 'unneeded tag'
48
50
  without_tag "p", :text => /content/i
@@ -59,6 +61,7 @@ Also included special matchers for form inputs:
59
61
  - [with\_option](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_option)
60
62
  - [with\_password_field](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_password_field)
61
63
  - [with\_radio\_button](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_radio_button)
64
+ - [with\_button](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_button)
62
65
  - [with\_select](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_select)
63
66
  - [with\_submit](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_submit)
64
67
  - [with\_text\_area](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_text_area)
@@ -68,22 +71,22 @@ Also included special matchers for form inputs:
68
71
  - [with\_range\_field](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_range_field)
69
72
  - [with\_date\_field](http://rdoc.info/github/kucaahbe/rspec2-rails-views-matchers/master/RSpec/Matchers:with_date_field)
70
73
 
71
- and of course you can use <strong>without_</strong>matchers(see documentation).
74
+ and of course you can use the `without_` matchers (see the documentation).
72
75
 
73
76
  More info
74
77
  ---------
75
78
 
76
- 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.
79
+ You can find more 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.
77
80
 
78
81
  Also, please read {file:CHANGELOG.md CHANGELOG}, it might be helpful.
79
82
 
80
83
  Contribution
81
84
  ============
82
85
 
83
- 1. fork
84
- 2. add tests for feature
85
- 3. write implementation
86
- 4. send pull request
86
+ 1. Fork the repository
87
+ 2. Add tests for your feature
88
+ 3. Write the code
89
+ 4. Send a pull request
87
90
 
88
91
  Contributors
89
92
  ============
@@ -92,7 +95,13 @@ Contributors
92
95
  - [Ryan Wilcox](http://github.com/rwilcox)
93
96
  - [Simon Schoeters](https://github.com/cimm)
94
97
 
95
- License
96
- =======
98
+ MIT Licensed
99
+ ============
100
+
101
+ Copyright (c) 2011 Dmitry Mjakotny
102
+
103
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
104
+
105
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
97
106
 
98
- This gem is released under the MIT license.
107
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -164,6 +164,8 @@ module RSpec
164
164
 
165
165
  @options[:minimum] ||= @options.delete(:min)
166
166
  @options[:maximum] ||= @options.delete(:max)
167
+
168
+ @options[:text] = @options[:text].to_s if @options.has_key?(:text) && !@options[:text].is_a?(Regexp)
167
169
  end
168
170
 
169
171
  end
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "rspec2-rails-views-matchers"
6
- s.version = '0.2.0'
6
+ s.version = '0.2.1'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["kucaahbe"]
9
9
  s.email = ["kucaahbe@ukr.net"]
@@ -209,6 +209,12 @@ describe 'have_tag' do
209
209
  rendered.should_not have_tag('strong', :text => /text does not present/)
210
210
  end
211
211
 
212
+ it "should invoke #to_s method for :text" do
213
+ expect {
214
+ rendered.should_not have_tag('p', :text => 100500 )
215
+ }.to_not raise_exception
216
+ end
217
+
212
218
  it "should not find tags and display appropriate message" do
213
219
  # TODO make diffable,maybe...
214
220
  expect { rendered.should have_tag('div', :text => 'SAMPLE text') }.should raise_spec_error(
metadata CHANGED
@@ -1,94 +1,71 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rspec2-rails-views-matchers
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - kucaahbe
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-09-29 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
12
+ date: 2011-10-20 00:00:00.000000000 +03:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ requirement: &79862560 !ruby/object:Gem::Requirement
22
18
  none: false
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- hash: 15
27
- segments:
28
- - 2
29
- - 0
30
- - 0
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
31
22
  version: 2.0.0
32
23
  type: :runtime
33
- requirement: *id001
34
- name: rspec
35
24
  prerelease: false
36
- - !ruby/object:Gem::Dependency
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *79862560
26
+ - !ruby/object:Gem::Dependency
27
+ name: nokogiri
28
+ requirement: &79861960 !ruby/object:Gem::Requirement
38
29
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 15
43
- segments:
44
- - 1
45
- - 4
46
- - 4
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
47
33
  version: 1.4.4
48
34
  type: :runtime
49
- requirement: *id002
50
- name: nokogiri
51
35
  prerelease: false
52
- - !ruby/object:Gem::Dependency
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: *79861960
37
+ - !ruby/object:Gem::Dependency
38
+ name: simplecov
39
+ requirement: &79861740 !ruby/object:Gem::Requirement
54
40
  none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- version: "0"
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
62
45
  type: :development
63
- requirement: *id003
64
- name: simplecov
65
46
  prerelease: false
66
- - !ruby/object:Gem::Dependency
67
- version_requirements: &id004 !ruby/object:Gem::Requirement
47
+ version_requirements: *79861740
48
+ - !ruby/object:Gem::Dependency
49
+ name: rake
50
+ requirement: &79861110 !ruby/object:Gem::Requirement
68
51
  none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- hash: 3
73
- segments:
74
- - 0
75
- version: "0"
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
76
56
  type: :development
77
- requirement: *id004
78
- name: rake
79
57
  prerelease: false
80
- description: |
81
- Nokogiri based 'have_tag' and 'with_tag' matchers for rspec 2.x.x. Does not depend on assert_select matcher, provides useful error messages.
58
+ version_requirements: *79861110
59
+ description: ! 'Nokogiri based ''have_tag'' and ''with_tag'' matchers for rspec 2.x.x.
60
+ Does not depend on assert_select matcher, provides useful error messages.
82
61
 
83
- email:
62
+ '
63
+ email:
84
64
  - kucaahbe@ukr.net
85
65
  executables: []
86
-
87
66
  extensions: []
88
-
89
67
  extra_rdoc_files: []
90
-
91
- files:
68
+ files:
92
69
  - .gitignore
93
70
  - .rspec
94
71
  - .travis.yml
@@ -110,38 +87,35 @@ files:
110
87
  - spec/matchers/have_tag_spec.rb
111
88
  - spec/spec_helper.rb
112
89
  - spec/support/spec_error.rb
90
+ has_rdoc: true
113
91
  homepage: http://github.com/kucaahbe/rspec2-rails-views-matchers
114
92
  licenses: []
115
-
116
93
  post_install_message:
117
94
  rdoc_options: []
118
-
119
- require_paths:
95
+ require_paths:
120
96
  - lib
121
- required_ruby_version: !ruby/object:Gem::Requirement
97
+ required_ruby_version: !ruby/object:Gem::Requirement
122
98
  none: false
123
- requirements:
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- hash: 3
127
- segments:
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ segments:
128
104
  - 0
129
- version: "0"
130
- required_rubygems_version: !ruby/object:Gem::Requirement
105
+ hash: -719416209
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
107
  none: false
132
- requirements:
133
- - - ">="
134
- - !ruby/object:Gem::Version
135
- hash: 3
136
- segments:
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ segments:
137
113
  - 0
138
- version: "0"
114
+ hash: -719416209
139
115
  requirements: []
140
-
141
116
  rubyforge_project: rspec2-rails-views-matchers
142
- rubygems_version: 1.8.10
117
+ rubygems_version: 1.6.2
143
118
  signing_key:
144
119
  specification_version: 3
145
120
  summary: Nokogiri based 'have_tag' and 'with_tag' matchers for rspec 2.x.x
146
121
  test_files: []
147
-