rspec-html-matchers 0.3.4 → 0.3.5
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 +3 -0
- data/CHANGELOG.md +5 -0
- data/README.md +1 -0
- data/features/{ajax_generated_content.feature → js_generated_content.feature} +0 -0
- data/features/support/env.rb +5 -0
- data/lib/rspec-html-matchers.rb +8 -4
- data/rspec-html-matchers.gemspec +1 -1
- data/spec/matchers/have_tag_spec.rb +1 -1
- metadata +12 -7
- data/script/assets.rb +0 -38
- data/script/console +0 -9
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,11 @@ unreleased(TODO)
|
|
7
7
|
* improve documentation(look at changelog and code!)
|
8
8
|
* add :without to have\_tag? like have_tag('div', :without => { :class => 'test' })
|
9
9
|
|
10
|
+
0.3.5
|
11
|
+
-----
|
12
|
+
|
13
|
+
* Fix for content matching regexps with single and double quotes (#14 thanks to watsonbox)
|
14
|
+
|
10
15
|
0.3.4
|
11
16
|
-----
|
12
17
|
|
data/README.md
CHANGED
@@ -141,6 +141,7 @@ Contributors
|
|
141
141
|
- [Simon Schoeters](https://github.com/cimm)
|
142
142
|
- [Felix Tjandrawibawa](https://github.com/cemenghttps://github.com/cemeng)
|
143
143
|
- [Szymon Przybył](https://github.com/apocalyptiq)
|
144
|
+
- [Howard Wilson][https://github.com/watsonbox]
|
144
145
|
|
145
146
|
MIT Licensed
|
146
147
|
============
|
File without changes
|
data/features/support/env.rb
CHANGED
@@ -9,6 +9,11 @@ class SimpleApp < Sinatra::Base
|
|
9
9
|
set :public_folder, $ASSETS_DIR
|
10
10
|
end
|
11
11
|
|
12
|
+
unless ENV.has_key? 'TRAVIS'
|
13
|
+
Capybara.register_driver :selenium do |app|
|
14
|
+
Capybara::Selenium::Driver.new(app, :browser => (ENV['BROWSER'] || :chrome))
|
15
|
+
end
|
16
|
+
end
|
12
17
|
Capybara.default_driver = :selenium
|
13
18
|
Capybara.app = SimpleApp
|
14
19
|
|
data/lib/rspec-html-matchers.rb
CHANGED
@@ -121,11 +121,15 @@ module RSpec
|
|
121
121
|
|
122
122
|
case text=@options[:text]
|
123
123
|
when Regexp
|
124
|
-
new_scope = @current_scope.css(":regexp(
|
125
|
-
def
|
126
|
-
|
124
|
+
new_scope = @current_scope.css(":regexp()",Class.new {
|
125
|
+
def initialize(regex)
|
126
|
+
@regex = regex
|
127
127
|
end
|
128
|
-
|
128
|
+
|
129
|
+
def regexp node_set
|
130
|
+
node_set.find_all { |node| node.content =~ @regex }
|
131
|
+
end
|
132
|
+
}.new(text))
|
129
133
|
unless new_scope.empty?
|
130
134
|
@count = new_scope.count
|
131
135
|
@negative_failure_message = REGEXP_FOUND_MSG % [text.inspect,@tag,@document]
|
data/rspec-html-matchers.gemspec
CHANGED
@@ -211,6 +211,7 @@ describe 'have_tag' do
|
|
211
211
|
rendered.should have_tag('div', :text => /SAMPLE/i)
|
212
212
|
rendered.should have_tag('span', :text => "sample with 'single' quotes")
|
213
213
|
rendered.should have_tag('span', :text => %Q{sample with 'single' and "double" quotes})
|
214
|
+
rendered.should have_tag('span', :text => /sample with 'single' and "double" quotes/)
|
214
215
|
|
215
216
|
rendered.should have_tag('p', :text => 'content with ignored spaces around')
|
216
217
|
rendered.should have_tag('p', :text => 'content with ignored spaces in')
|
@@ -267,7 +268,6 @@ describe 'have_tag' do
|
|
267
268
|
%Q{/SAMPLE text/i regexp unexpected within "div" in following template:\n#{rendered}\nbut was found.}
|
268
269
|
)
|
269
270
|
end
|
270
|
-
|
271
271
|
end
|
272
272
|
|
273
273
|
context "mixed matching" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-html-matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04
|
12
|
+
date: 2012-05-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -148,14 +148,12 @@ files:
|
|
148
148
|
- assets/search_and_submit.html
|
149
149
|
- assets/special.html
|
150
150
|
- cucumber.yml
|
151
|
-
- features/
|
151
|
+
- features/js_generated_content.feature
|
152
152
|
- features/step_definitions/steps.rb
|
153
153
|
- features/support/env.rb
|
154
154
|
- lib/rspec-html-matchers.rb
|
155
155
|
- mikhalok.jpg
|
156
156
|
- rspec-html-matchers.gemspec
|
157
|
-
- script/assets.rb
|
158
|
-
- script/console
|
159
157
|
- spec/matchers/form_matchers_spec.rb
|
160
158
|
- spec/matchers/have_tag_spec.rb
|
161
159
|
- spec/spec_helper.rb
|
@@ -180,8 +178,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
178
|
version: '0'
|
181
179
|
requirements: []
|
182
180
|
rubyforge_project: rspec-html-matchers
|
183
|
-
rubygems_version: 1.8.
|
181
|
+
rubygems_version: 1.8.23
|
184
182
|
signing_key:
|
185
183
|
specification_version: 3
|
186
184
|
summary: Nokogiri based 'have_tag' and 'with_tag' matchers for rspec 2.x.x
|
187
|
-
test_files:
|
185
|
+
test_files:
|
186
|
+
- features/js_generated_content.feature
|
187
|
+
- features/step_definitions/steps.rb
|
188
|
+
- features/support/env.rb
|
189
|
+
- spec/matchers/form_matchers_spec.rb
|
190
|
+
- spec/matchers/have_tag_spec.rb
|
191
|
+
- spec/spec_helper.rb
|
192
|
+
- spec/support/helpers.rb
|
data/script/assets.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
class Asset
|
2
|
-
@@assets = {}
|
3
|
-
|
4
|
-
PATH = File.expand_path(File.join(File.dirname(__FILE__),'..','assets','*.html'))
|
5
|
-
|
6
|
-
def self.[] name
|
7
|
-
@@assets[name.to_s]
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.<< asset
|
11
|
-
@@assets.merge! asset.name => asset
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.list
|
15
|
-
@@assets.keys
|
16
|
-
end
|
17
|
-
|
18
|
-
attr_reader :name
|
19
|
-
|
20
|
-
def initialize name, path
|
21
|
-
@name = name
|
22
|
-
@path = path
|
23
|
-
end
|
24
|
-
|
25
|
-
def content
|
26
|
-
@content ||= IO.read(@path)
|
27
|
-
puts @content
|
28
|
-
return @content
|
29
|
-
end
|
30
|
-
alias_method :c, :content
|
31
|
-
end
|
32
|
-
|
33
|
-
puts 'assets list:'
|
34
|
-
Dir[Asset::PATH].each do |asset_path|
|
35
|
-
asset_name = File.basename(asset_path,'.html')
|
36
|
-
puts asset_name
|
37
|
-
Asset << Asset.new(asset_name,asset_path)
|
38
|
-
end
|