rspec-expectations 2.6.0 → 2.7.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/README.md +2 -2
  2. data/features/built_in_matchers/README.md +7 -5
  3. data/features/built_in_matchers/be.feature +1 -1
  4. data/features/built_in_matchers/cover.feature +1 -1
  5. data/features/built_in_matchers/expect_error.feature +59 -26
  6. data/features/built_in_matchers/have.feature +2 -2
  7. data/features/built_in_matchers/predicates.feature +1 -1
  8. data/features/step_definitions/additional_cli_steps.rb +1 -1
  9. data/features/support/env.rb +1 -1
  10. data/lib/rspec/expectations.rb +0 -2
  11. data/lib/rspec/expectations/deprecation.rb +6 -4
  12. data/lib/rspec/expectations/errors.rb +4 -7
  13. data/lib/rspec/expectations/extensions.rb +1 -0
  14. data/lib/rspec/expectations/extensions/array.rb +2 -0
  15. data/lib/rspec/expectations/extensions/kernel.rb +18 -44
  16. data/lib/rspec/expectations/{backward_compatibility.rb → extensions/object.rb} +5 -3
  17. data/lib/rspec/expectations/fail_with.rb +8 -5
  18. data/lib/rspec/expectations/version.rb +5 -4
  19. data/lib/rspec/matchers.rb +77 -73
  20. data/lib/rspec/matchers/be.rb +42 -51
  21. data/lib/rspec/matchers/be_within.rb +1 -1
  22. data/lib/rspec/matchers/change.rb +5 -13
  23. data/lib/rspec/matchers/dsl.rb +2 -1
  24. data/lib/rspec/matchers/eq.rb +3 -3
  25. data/lib/rspec/matchers/extensions/{instance_exec.rb → instance_eval_with_args.rb} +15 -7
  26. data/lib/rspec/matchers/has.rb +11 -6
  27. data/lib/rspec/matchers/have.rb +36 -19
  28. data/lib/rspec/matchers/match_array.rb +1 -1
  29. data/lib/rspec/matchers/matcher.rb +5 -5
  30. data/spec/rspec/matchers/change_spec.rb +38 -0
  31. data/spec/rspec/matchers/description_generation_spec.rb +32 -32
  32. data/spec/rspec/matchers/eq_spec.rb +2 -2
  33. data/spec/rspec/matchers/has_spec.rb +33 -1
  34. data/spec/rspec/matchers/have_spec.rb +64 -7
  35. data/spec/rspec/matchers/match_array_spec.rb +0 -3
  36. data/spec/rspec/matchers/operator_matcher_spec.rb +10 -4
  37. data/spec/rspec/matchers/raise_error_spec.rb +6 -6
  38. data/spec/support/classes.rb +21 -10
  39. metadata +51 -62
  40. data/.document +0 -5
  41. data/.gitignore +0 -10
  42. data/.travis.yml +0 -7
  43. data/Gemfile +0 -40
  44. data/Guardfile +0 -5
  45. data/License.txt +0 -22
  46. data/Rakefile +0 -81
  47. data/cucumber.yml +0 -10
  48. data/features/.nav +0 -29
  49. data/features/Changelog.md +0 -101
  50. data/rspec-expectations.gemspec +0 -27
  51. data/specs.watchr +0 -57
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.markdown
2
- Upgrade.markdown
3
- lib/**/*.rb
4
- features/**/*.feature
5
- License.txt
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- *.sw?
2
- .DS_Store
3
- coverage*
4
- rdoc
5
- pkg
6
- doc
7
- tmp
8
- rerun.txt
9
- Gemfile.lock
10
- .bundle
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- script: "rake"
2
- rvm:
3
- - 1.8.6
4
- - 1.8.7
5
- - 1.9.1
6
- - 1.9.2
7
- - ree
data/Gemfile DELETED
@@ -1,40 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- ### rspec libs
4
- %w[rspec rspec-core rspec-expectations rspec-mocks].each do |lib|
5
- library_path = File.expand_path("../../#{lib}", __FILE__)
6
- if File.exist?(library_path)
7
- gem lib, :path => library_path
8
- else
9
- gem lib, :git => "git://github.com/rspec/#{lib}.git"
10
- end
11
- end
12
-
13
- ### dev dependencies
14
- gem "rake", "0.8.7"
15
- gem "cucumber", "~> 0.10.2"
16
- gem "aruba", "~> 0.3.6"
17
- gem "rcov", "0.9.9", :platforms => :mri
18
- gem "relish", "0.2.0"
19
- gem "guard-rspec", "0.1.9"
20
- gem "growl", "1.0.3"
21
- gem "nokogiri", "1.4.4"
22
-
23
- platforms :mri_18 do
24
- gem 'ruby-debug'
25
- end
26
-
27
- platforms :mri_19 do
28
- gem 'linecache19', '0.5.11' # 0.5.12 cannot install on 1.9.1, and 0.5.11 appears to work with both 1.9.1 & 1.9.2
29
- gem 'ruby-debug19'
30
- gem 'ruby-debug-base19', RUBY_VERSION == '1.9.1' ? '0.11.23' : '~> 0.11.24'
31
- end
32
-
33
- platforms :mri_18, :mri_19 do
34
- gem "rb-fsevent", "~> 0.3.9"
35
- gem "ruby-prof", "~> 0.9.2"
36
- end
37
-
38
- platforms :jruby do
39
- gem "jruby-openssl"
40
- end
data/Guardfile DELETED
@@ -1,5 +0,0 @@
1
- guard 'rspec', :version => 2 do
2
- watch(/^spec\/(.*)_spec.rb/)
3
- watch(/^lib\/(.*)\.rb/) { |m| "spec/#{m[1]}_spec.rb" }
4
- watch(/^spec\/spec_helper.rb/) { "spec" }
5
- end
data/License.txt DELETED
@@ -1,22 +0,0 @@
1
- (The MIT License)
2
-
3
- Copyright (c) 2005 The RSpec Development Team
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,81 +0,0 @@
1
- require 'bundler'
2
- Bundler.setup
3
- Bundler::GemHelper.install_tasks
4
-
5
- require 'rake'
6
- require 'rake/rdoctask'
7
- require 'rspec/core/rake_task'
8
- require 'rspec/expectations/version'
9
-
10
- begin
11
- require 'cucumber/rake/task'
12
-
13
- class Cucumber::Rake::Task::ForkedCucumberRunner
14
- # When cucumber shells out, we still need it to run in the context of our
15
- # bundle.
16
- def run
17
- sh "bundle exec #{RUBY} " + args.join(" ")
18
- end
19
- end
20
-
21
- Cucumber::Rake::Task.new(:cucumber)
22
-
23
- namespace :cucumber do
24
- desc "Run cucumber features using rcov"
25
- Cucumber::Rake::Task.new :rcov => :cleanup_rcov_files do |t|
26
- t.cucumber_opts = %w{--format progress}
27
- t.rcov = true
28
- t.rcov_opts = %[-Ilib -Ispec --exclude "gems/*,features"]
29
- t.rcov_opts << %[--text-report --sort coverage --aggregate coverage.data]
30
- end
31
- end
32
-
33
- rescue LoadError => e
34
- puts "unable to load cucumber, some tasks unavailable"
35
- task :cucumber do
36
- #no-op
37
- end
38
- end
39
-
40
-
41
- task :cleanup_rcov_files do
42
- rm_rf 'coverage.data'
43
- end
44
-
45
- desc "Run all examples"
46
- RSpec::Core::RakeTask.new(:spec) do |t|
47
- t.rspec_opts = %w[--color]
48
- end
49
-
50
-
51
- namespace :spec do
52
- desc "Run all examples using rcov"
53
- RSpec::Core::RakeTask.new :rcov => :cleanup_rcov_files do |t|
54
- t.rcov = true
55
- t.rcov_opts = %[-Ilib -Ispec --exclude "gems/*,features"]
56
- t.rcov_opts << %[--text-report --sort coverage --no-html --aggregate coverage.data]
57
- end
58
- end
59
-
60
- task :default => [:spec, :cucumber]
61
-
62
- Rake::RDocTask.new do |rdoc|
63
- rdoc.rdoc_dir = 'rdoc'
64
- rdoc.title = "rspec-expectations #{RSpec::Expectations::Version::STRING}"
65
- rdoc.rdoc_files.include('README*')
66
- rdoc.rdoc_files.include('lib/**/*.rb')
67
- end
68
-
69
- desc "Push docs/cukes to relishapp using the relish-client-gem"
70
- task :relish, :version do |t, args|
71
- raise "rake relish[VERSION]" unless args[:version]
72
- sh "relish push rspec/rspec-expectations:#{args[:version]}"
73
- end
74
-
75
- task :clobber do
76
- rm_rf 'doc'
77
- rm_rf 'pkg'
78
- rm_rf 'tmp'
79
- rm_rf 'coverage'
80
- end
81
-
data/cucumber.yml DELETED
@@ -1,10 +0,0 @@
1
- <%
2
- def tags(tag)
3
- tags = [tag]
4
- tags << "~@ruby-1.9" if RUBY_VERSION.to_f < 1.9
5
- tags.join(" --tags ")
6
- end
7
- %>
8
-
9
- default: --require features --tags <%= tags("~@wip") %> --format progress
10
- wip: --require features --tags <%= tags("@wip:3") --wip features
data/features/.nav DELETED
@@ -1,29 +0,0 @@
1
- - Upgrade.md
2
- - Changelog.md
3
- - customized_message.feature
4
- - diffing.feature
5
- - implicit_docstrings.feature
6
- - built_in_matchers:
7
- - be.feature
8
- - be_within.feature
9
- - equality.feature
10
- - exist.feature
11
- - expect_change.feature
12
- - expect_error.feature
13
- - have.feature
14
- - include.feature
15
- - match.feature
16
- - operators.feature
17
- - predicates.feature
18
- - respond_to.feature
19
- - satisfy.feature
20
- - throw_symbol.feature
21
- - types.feature
22
- - custom_matchers:
23
- - define_matcher.feature
24
- - define_diffable_matcher.feature
25
- - define_matcher_with_fluent_interface.feature
26
- - access_running_example.feature
27
- - define_matcher_outside_rspec.feature
28
- - test_frameworks:
29
- - test_unit.feature
@@ -1,101 +0,0 @@
1
- ### 2.6.0 / 2011-05-12
2
-
3
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.5.0...v2.6.0)
4
-
5
- * Enhancments
6
- * `change` matcher accepts Regexps (Robert Davis)
7
- * better descriptions for have_xxx matchers (Magnus Bergmark)
8
- * range.should cover(*values) (Anders Furseth)
9
-
10
- * Bug fixes
11
- * Removed non-ascii characters that were choking rcov (Geoffrey Byers)
12
- * change matcher dups arrays and hashes so their before/after states can be
13
- compared correctly.
14
- * Fix the order of inclusion of RSpec::Matchers in
15
- Test::Unit::TestCase and MiniTest::Unit::TestCase to prevent a
16
- SystemStackError (Myron Marston)
17
-
18
- ### 2.5.0 / 2011-02-05
19
-
20
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.4.0...v2.5.0)
21
-
22
- * Enhancements
23
- * `should exist` works with `exist?` or `exists?` (Myron Marston)
24
- * `expect { ... }.not_to do_something` (in addition to `to_not`)
25
-
26
- * Documentation
27
- * improved docs for raise_error matcher (James Almond)
28
-
29
- ### 2.4.0 / 2011-01-02
30
-
31
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.3.0...v2.4.0)
32
-
33
- No functional changes in this release, which was made to align with the
34
- rspec-core-2.4.0 release.
35
-
36
- * Enhancements
37
- * improved RDoc for change matcher (Jo Liss)
38
-
39
- ### 2.3.0 / 2010-12-12
40
-
41
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.2.1...v2.3.0)
42
-
43
- * Enhancements
44
- * diff strings when include matcher fails (Mike Sassak)
45
-
46
- ### 2.2.0 / 2010-11-28
47
-
48
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.1.0...v2.2.0)
49
-
50
- ### 2.1.0 / 2010-11-07
51
-
52
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.1...v2.1.0)
53
-
54
- * Enhancements
55
- * be_within(delta).of(expected) matcher (Myron Marston)
56
- * Lots of new Cucumber features (Myron Marston)
57
- * Raise error if you try "should != expected" on Ruby-1.9 (Myron Marston)
58
- * Improved failure messages from throw_symbol (Myron Marston)
59
-
60
- * Bug fixes
61
- * Eliminate hard dependency on RSpec::Core (Myron Marston)
62
- * have_matcher - use pluralize only when ActiveSupport inflections are indeed
63
- defined (Josep M Bach)
64
- * throw_symbol matcher no longer swallows exceptions (Myron Marston)
65
- * fix matcher chaining to avoid name collisions (Myron Marston)
66
-
67
- ### 2.0.0 / 2010-10-10
68
-
69
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.rc...v2.0.0)
70
-
71
- * Enhancements
72
- * Add match_for_should_not method to matcher DSL (Myron Marston)
73
-
74
- * Bug fixes
75
- * respond_to matcher works correctly with should_not with multiple methods (Myron Marston)
76
- * include matcher works correctly with should_not with multiple values (Myron Marston)
77
-
78
- ### 2.0.0.rc / 2010-10-05
79
-
80
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.22...v2.0.0.rc)
81
-
82
- * Enhancements
83
- * require 'rspec/expectations' in a T::U or MiniUnit suite (Josep M. Bach)
84
-
85
- * Bug fixes
86
- * change by 0 passes/fails correctly (Len Smith)
87
- * Add description to satisfy matcher
88
-
89
- ### 2.0.0.beta.22 / 2010-09-12
90
-
91
- [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.20...v2.0.0.beta.22)
92
-
93
- * Enhancements
94
- * diffing improvements
95
- * diff multiline strings
96
- * don't diff single line strings
97
- * don't diff numbers (silly)
98
- * diff regexp + multiline string
99
-
100
- * Bug fixes
101
- * should[_not] change now handles boolean values correctly
@@ -1,27 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
- require "rspec/expectations/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "rspec-expectations"
7
- s.version = RSpec::Expectations::Version::STRING
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["David Chelimsky", "Chad Humphries"]
10
- s.email = "dchelimsky@gmail.com;chad.humphries@gmail.com"
11
- s.homepage = "http://github.com/rspec/rspec-expectations"
12
- s.summary = "rspec-expectations-#{RSpec::Expectations::Version::STRING}"
13
- s.description = "rspec expectations (should[_not] and matchers)"
14
-
15
- s.rubygems_version = "1.3.7"
16
- s.rubyforge_project = "rspec"
17
-
18
- s.files = `git ls-files`.split("\n")
19
- s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
20
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
- s.extra_rdoc_files = [ "README.md" ]
22
- s.rdoc_options = ["--charset=UTF-8"]
23
- s.require_path = "lib"
24
-
25
- s.add_runtime_dependency 'diff-lcs', '~> 1.1.2'
26
- end
27
-
data/specs.watchr DELETED
@@ -1,57 +0,0 @@
1
- # Run me with:
2
- #
3
- # $ watchr specs.watchr
4
-
5
- # --------------------------------------------------
6
- # Convenience Methods
7
- # --------------------------------------------------
8
- def all_test_files
9
- Dir['spec/**/*_spec.rb']
10
- end
11
-
12
- def run_test_matching(thing_to_match)
13
- matches = all_test_files.grep(/#{thing_to_match}/i)
14
- if matches.empty?
15
- puts "Sorry, thanks for playing, but there were no matches for #{thing_to_match}"
16
- else
17
- run matches.join(' ')
18
- end
19
- end
20
-
21
- def run(files_to_run)
22
- puts("Running: #{files_to_run}")
23
- system("clear;rspec -cfs #{files_to_run}")
24
- no_int_for_you
25
- end
26
-
27
- def run_all_tests
28
- run(all_test_files.join(' '))
29
- end
30
-
31
- # --------------------------------------------------
32
- # Watchr Rules
33
- # --------------------------------------------------
34
- watch('^spec/(.*)_spec\.rb' ) { |m| run_test_matching(m[1]) }
35
- watch('^lib/(.*)\.rb' ) { |m| run_test_matching(m[1]) }
36
- watch('^spec/spec_helper\.rb') { run_all_tests }
37
- # --------------------------------------------------
38
- # Signal Handling
39
- # --------------------------------------------------
40
-
41
- def no_int_for_you
42
- @sent_an_int = nil
43
- end
44
-
45
- Signal.trap 'INT' do
46
- if @sent_an_int then
47
- puts " A second INT? Ok, I get the message. Shutting down now."
48
- exit
49
- else
50
- puts " Did you just send me an INT? Ugh. I'll quit for real if you do it again."
51
- @sent_an_int = true
52
- Kernel.sleep 1.5
53
- run_all_tests
54
- end
55
- end
56
-
57
- # vim:ft=ruby