rspec-html-matchers 0.4.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  require 'rspec/core'
2
+ require 'rspec/expectations'
2
3
 
3
4
  if defined?(SimpleCov)
4
5
  SimpleCov.start do
@@ -25,15 +26,63 @@ module AssetHelpers
25
26
 
26
27
  end
27
28
 
28
- module CustomHelpers
29
+ RSpec::Matchers.define :raise_spec_error do |expected_exception_msg|
30
+ define_method :actual_msg do
31
+ @actual_msg
32
+ end
33
+
34
+ define_method :catched_exception do
35
+ @catched_exception
36
+ end
29
37
 
30
- def raise_spec_error msg
31
- raise_error RSpec::Expectations::ExpectationNotMetError, msg
38
+ match do |block|
39
+ begin
40
+ block.call
41
+ false
42
+ rescue RSpec::Expectations::ExpectationNotMetError => rspec_error
43
+ @actual_msg = rspec_error.message
44
+
45
+ case expected_exception_msg
46
+ when String
47
+ actual_msg == expected_exception_msg
48
+ when Regexp
49
+ actual_msg =~ expected_exception_msg
50
+ end
51
+ rescue StandardError => e
52
+ @catched_exception = e
53
+ false
54
+ end
32
55
  end
33
56
 
57
+ failure_message_for_should do |block|
58
+ if actual_msg
59
+ <<MSG
60
+ expected RSpec::Expectations::ExpectationNotMetError with message:
61
+ #{expected_exception_msg}
62
+
63
+ got:
64
+ #{actual_msg}
65
+
66
+ Diff:
67
+ #{RSpec::Expectations::Differ.new.diff_as_string(actual_msg,expected_exception_msg.to_s)}
68
+ MSG
69
+ elsif catched_exception
70
+ "expected RSpec::Expectations::ExpectationNotMetError, but was #{catched_exception.inspect}"
71
+ else
72
+ "expected RSpec::Expectations::ExpectationNotMetError, but was no exception"
73
+ end
74
+ end
34
75
  end
35
76
 
36
77
  RSpec.configure do |config|
78
+
79
+ config.expect_with :rspec do |c|
80
+ c.syntax = :expect
81
+ end
82
+
83
+ config.treat_symbols_as_metadata_keys_with_true_values = true
84
+
85
+ config.filter_run_excluding wip: true
86
+
37
87
  config.extend AssetHelpers
38
- config.include CustomHelpers
39
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-html-matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kucaahbe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-10 00:00:00.000000000 Z
11
+ date: 2014-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -48,122 +48,130 @@ dependencies:
48
48
  name: simplecov
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: cucumber
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0'
67
+ version: '1'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '0'
74
+ version: '1'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: capybara
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0'
81
+ version: '2'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ">="
86
+ - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '0'
88
+ version: '2'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: selenium-webdriver
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ">="
93
+ - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '0'
95
+ version: '2'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ">="
100
+ - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '0'
102
+ version: '2'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: sinatra
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ">="
107
+ - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '0'
109
+ version: '1'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - ">="
114
+ - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '0'
116
+ version: '1'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: rake
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - ">="
121
+ - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '0'
123
+ version: '10'
124
124
  type: :development
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - ">="
128
+ - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '0'
130
+ version: '10'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: travis-lint
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - ">="
135
+ - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '0'
137
+ version: '1'
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - ">="
142
+ - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '0'
144
+ version: '1'
145
+ - !ruby/object:Gem::Dependency
146
+ name: debugger
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '1'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '1'
145
159
  description: |
146
160
  Nokogiri based 'have_tag' and 'with_tag' matchers for rspec 2.x.x. Does not depend on assert_select matcher, provides useful error messages.
147
161
  email:
148
162
  - kucaahbe@ukr.net
149
163
  executables: []
150
164
  extensions: []
151
- extra_rdoc_files: []
165
+ extra_rdoc_files:
166
+ - README.md
167
+ - CHANGELOG.md
152
168
  files:
153
- - ".gitignore"
154
- - ".rspec"
155
- - ".travis.yml"
156
- - ".yardopts"
157
169
  - CHANGELOG.md
158
- - Gemfile
159
170
  - README.md
160
- - Rakefile
161
- - cucumber.yml
162
171
  - features/js_generated_content.feature
163
172
  - features/step_definitions/steps.rb
164
173
  - features/support/env.rb
165
174
  - lib/rspec-html-matchers.rb
166
- - rspec-html-matchers.gemspec
167
175
  - spec/fixtures/form.html
168
176
  - spec/fixtures/ordered_list.html
169
177
  - spec/fixtures/paragraphs.html
@@ -171,14 +179,18 @@ files:
171
179
  - spec/fixtures/search_and_submit.html
172
180
  - spec/fixtures/single_element.html
173
181
  - spec/fixtures/special.html
174
- - spec/matchers/form_matchers_spec.rb
175
- - spec/matchers/have_tag_spec.rb
182
+ - spec/form_matchers_spec.rb
183
+ - spec/have_tag_spec.rb
176
184
  - spec/spec_helper.rb
177
185
  homepage: http://github.com/kucaahbe/rspec-html-matchers
178
186
  licenses:
179
187
  - MIT
180
188
  metadata: {}
181
- post_install_message:
189
+ post_install_message: |
190
+ Support for rspec "should" syntax removed,
191
+ please use new "expect" syntax instead (see README on github for examples).
192
+
193
+ More info on "expect" syntax: https://github.com/rspec/rspec-expectations#rspec-expectations--
182
194
  rdoc_options: []
183
195
  require_paths:
184
196
  - lib
@@ -198,4 +210,17 @@ rubygems_version: 2.2.0
198
210
  signing_key:
199
211
  specification_version: 4
200
212
  summary: Nokogiri based 'have_tag' and 'with_tag' matchers for rspec 2.x.x
201
- test_files: []
213
+ test_files:
214
+ - spec/spec_helper.rb
215
+ - spec/fixtures/paragraphs.html
216
+ - spec/fixtures/ordered_list.html
217
+ - spec/fixtures/search_and_submit.html
218
+ - spec/fixtures/single_element.html
219
+ - spec/fixtures/quotes.html
220
+ - spec/fixtures/form.html
221
+ - spec/fixtures/special.html
222
+ - spec/have_tag_spec.rb
223
+ - spec/form_matchers_spec.rb
224
+ - features/step_definitions/steps.rb
225
+ - features/js_generated_content.feature
226
+ - features/support/env.rb
data/.gitignore DELETED
@@ -1,18 +0,0 @@
1
- # gem packaging
2
- pkg/*
3
- *.gem
4
- # ruby version management
5
- .rvmrc
6
- .rbenv-*
7
- .ruby-version
8
- # common stuff
9
- bin/
10
- .bundle/
11
- Gemfile.lock
12
- # logs
13
- chromedriver.log
14
- # documentation and other trash
15
- html
16
- doc
17
- .yardoc
18
- coverage
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
@@ -1,13 +0,0 @@
1
- language: ruby
2
- before_script:
3
- - "export DISPLAY=:99.0"
4
- - "sh -e /etc/init.d/xvfb start"
5
- rvm:
6
- - 1.9.3
7
- - 2.0.0
8
- - 2.1.0
9
- #- jruby-19mode
10
- #- rbx-2.2.2
11
- branches:
12
- only:
13
- - master
data/.yardopts DELETED
@@ -1,4 +0,0 @@
1
- --no-private
2
- --readme README.md
3
- --files CHANGELOG.md
4
- --markup rdoc
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source "http://rubygems.org"
2
- gemspec
data/Rakefile DELETED
@@ -1,32 +0,0 @@
1
- require 'bundler'
2
- require 'rspec/core/rake_task'
3
- require 'cucumber/rake/task'
4
- Bundler::GemHelper.install_tasks
5
-
6
- task :default => [:spec, :cucumber]
7
-
8
- desc "Validate the gemspec"
9
- task :gemspec do
10
- gemspec = eval(File.read(Dir["*.gemspec"].first))
11
- gemspec.validate && puts('gemspec valid')
12
- end
13
-
14
- RSpec::Core::RakeTask.new(:spec) do |t|
15
- t.rspec_opts='--tag ~wip'
16
- end
17
-
18
- namespace :spec do
19
- RSpec::Core::RakeTask.new(:wip) do |t|
20
- t.rspec_opts='--tag wip'
21
- t.fail_on_error = false
22
- end
23
-
24
- RSpec::Core::RakeTask.new(:rcov) do |t|
25
- t.rspec_opts=['-r simplecov']
26
- end
27
- end
28
-
29
- Cucumber::Rake::Task.new(:cucumber) do |t|
30
- t.fork = true
31
- t.profile = 'default'
32
- end
@@ -1 +0,0 @@
1
- default: --strict features
@@ -1,34 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
-
4
- Gem::Specification.new do |s|
5
- s.name = 'rspec-html-matchers'
6
- s.version = '0.4.4'
7
- s.platform = Gem::Platform::RUBY
8
- s.authors = ['kucaahbe']
9
- s.email = ['kucaahbe@ukr.net']
10
- s.license = 'MIT'
11
- s.homepage = 'http://github.com/kucaahbe/rspec-html-matchers'
12
- s.summary = %q{Nokogiri based 'have_tag' and 'with_tag' matchers for rspec 2.x.x}
13
- s.description = <<DESC
14
- #{s.summary}. Does not depend on assert_select matcher, provides useful error messages.
15
- DESC
16
-
17
- s.rubyforge_project = 'rspec-html-matchers'
18
-
19
- s.files = `git ls-files`.split("\n")
20
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
- s.require_paths = ["lib"]
23
-
24
- s.add_runtime_dependency 'rspec', '~> 2', '>= 2.11.0'
25
- s.add_runtime_dependency 'nokogiri', '~> 1'
26
-
27
- s.add_development_dependency 'simplecov'
28
- s.add_development_dependency 'cucumber'
29
- s.add_development_dependency 'capybara'
30
- s.add_development_dependency 'selenium-webdriver'
31
- s.add_development_dependency 'sinatra'
32
- s.add_development_dependency 'rake'
33
- s.add_development_dependency 'travis-lint'
34
- end