rspec-html-matchers 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,7 +2,10 @@ pkg/*
2
2
  *.gem
3
3
  .bundle
4
4
  .rvmrc
5
+ .rbenv-*
5
6
  Gemfile.lock
7
+ # logs
8
+ chromedriver.log
6
9
  # documentation:
7
10
  html
8
11
  doc
@@ -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
  ============
@@ -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
 
@@ -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('#{text}')",Class.new {
125
- def regexp node_set, text
126
- node_set.find_all { |node| node.content =~ Regexp.new(text) }
124
+ new_scope = @current_scope.css(":regexp()",Class.new {
125
+ def initialize(regex)
126
+ @regex = regex
127
127
  end
128
- }.new)
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]
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "rspec-html-matchers"
6
- s.version = '0.3.4'
6
+ s.version = '0.3.5'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["kucaahbe"]
9
9
  s.email = ["kucaahbe@ukr.net"]
@@ -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
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-02 00:00:00.000000000 Z
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/ajax_generated_content.feature
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.18
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
@@ -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
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'bundler/setup'
5
- require 'nokogiri'
6
- require File.join(File.dirname(__FILE__),'assets.rb')
7
- require 'irb'
8
-
9
- IRB.start