rspec-expectations 2.5.0 → 2.6.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/.travis.yml +7 -0
  2. data/Gemfile +13 -11
  3. data/README.md +2 -0
  4. data/Rakefile +28 -17
  5. data/features/Changelog.md +16 -0
  6. data/features/built_in_matchers/be.feature +4 -4
  7. data/features/built_in_matchers/be_within.feature +1 -1
  8. data/features/built_in_matchers/equality.feature +5 -5
  9. data/features/built_in_matchers/exist.feature +1 -1
  10. data/features/built_in_matchers/expect_change.feature +2 -2
  11. data/features/built_in_matchers/expect_error.feature +7 -7
  12. data/features/built_in_matchers/have.feature +2 -2
  13. data/features/built_in_matchers/include.feature +3 -3
  14. data/features/built_in_matchers/match.feature +2 -2
  15. data/features/built_in_matchers/operators.feature +3 -3
  16. data/features/built_in_matchers/predicates.feature +5 -5
  17. data/features/built_in_matchers/respond_to.feature +2 -2
  18. data/features/built_in_matchers/satisfy.feature +1 -1
  19. data/features/built_in_matchers/throw_symbol.feature +3 -3
  20. data/features/built_in_matchers/types.feature +2 -2
  21. data/features/custom_matchers/access_running_example.feature +2 -2
  22. data/features/custom_matchers/define_diffable_matcher.feature +1 -1
  23. data/features/custom_matchers/define_matcher.feature +40 -11
  24. data/features/custom_matchers/define_matcher_outside_rspec.feature +1 -1
  25. data/features/custom_matchers/define_matcher_with_fluent_interface.feature +1 -1
  26. data/features/customized_message.feature +1 -1
  27. data/features/diffing.feature +4 -4
  28. data/features/implicit_docstrings.feature +2 -2
  29. data/features/step_definitions/additional_cli_steps.rb +2 -2
  30. data/features/support/env.rb +5 -1
  31. data/features/test_frameworks/test_unit.feature +1 -1
  32. data/lib/rspec/expectations/backward_compatibility.rb +22 -1
  33. data/lib/rspec/expectations/version.rb +1 -1
  34. data/lib/rspec/matchers.rb +10 -5
  35. data/lib/rspec/matchers/change.rb +47 -32
  36. data/lib/rspec/matchers/has.rb +15 -11
  37. data/lib/rspec/matchers/matcher.rb +4 -0
  38. data/spec/rspec/matchers/be_spec.rb +0 -4
  39. data/spec/rspec/matchers/change_spec.rb +84 -9
  40. data/spec/rspec/matchers/description_generation_spec.rb +41 -25
  41. data/spec/rspec/matchers/has_spec.rb +2 -2
  42. data/spec/rspec/matchers/have_spec.rb +21 -21
  43. data/spec/rspec/matchers/matcher_spec.rb +46 -0
  44. data/spec/rspec/matchers/matchers_spec.rb +3 -23
  45. data/spec/rspec/matchers/method_missing_spec.rb +23 -0
  46. data/spec/spec_helper.rb +2 -0
  47. metadata +23 -18
  48. data/spec/suite.rb +0 -1
@@ -0,0 +1,7 @@
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 CHANGED
@@ -6,29 +6,31 @@ source "http://rubygems.org"
6
6
  if File.exist?(library_path)
7
7
  gem lib, :path => library_path
8
8
  else
9
- gem lib
9
+ gem lib, :git => "git://github.com/rspec/#{lib}.git"
10
10
  end
11
11
  end
12
12
 
13
13
  ### dev dependencies
14
14
  gem "rake", "0.8.7"
15
- gem "cucumber", "0.9.4"
16
- gem "aruba", "0.2.2"
17
- gem "rcov", "0.9.9"
15
+ # gem "cucumber", "~> 0.10.2"
16
+ # gem "aruba", :git => "git://github.com/aslakhellesoy/aruba"
17
+ gem "rcov", "0.9.9", :platforms => :mri
18
18
  gem "relish", "0.2.0"
19
19
  gem "guard-rspec", "0.1.9"
20
20
  gem "growl", "1.0.3"
21
- gem "ZenTest", "~> 4.4.2"
21
+ gem "nokogiri", "1.4.4"
22
22
 
23
- if RUBY_PLATFORM =~ /darwin/
24
- gem "autotest-fsevent", "~> 0.2.4"
25
- gem "autotest-growl", "~> 0.2.9"
23
+ platforms :mri_18 do
24
+ gem 'ruby-debug'
26
25
  end
27
26
 
28
- gem "ruby-debug", :platforms => :ruby_18
29
- gem "ruby-debug19", "~> 0.11.6", :platforms => :ruby_19
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
30
32
 
31
- platforms :ruby_18, :ruby_19 do
33
+ platforms :mri_18, :mri_19 do
32
34
  gem "rb-fsevent", "~> 0.3.9"
33
35
  gem "ruby-prof", "~> 0.9.2"
34
36
  end
data/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  rspec-expectations adds `should` and `should_not` to every object and includes
4
4
  RSpec::Matchers, a library of standard matchers.
5
5
 
6
+ [![build status](http://travis-ci.org/rspec/rspec-expectations.png)](http://travis-ci.org/rspec/rspec-expectations)
7
+
6
8
  ## Documentation
7
9
 
8
10
  The [Cucumber features](http://relishapp.com/rspec/rspec-expectations)
data/Rakefile CHANGED
@@ -6,16 +6,38 @@ require 'rake'
6
6
  require 'rake/rdoctask'
7
7
  require 'rspec/core/rake_task'
8
8
  require 'rspec/expectations/version'
9
- require 'cucumber/rake/task'
10
9
 
11
- class Cucumber::Rake::Task::ForkedCucumberRunner
12
- # When cucumber shells out, we still need it to run in the context of our
13
- # bundle.
14
- def run
15
- sh "bundle exec #{RUBY} " + args.join(" ")
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
16
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
17
38
  end
18
39
 
40
+
19
41
  task :cleanup_rcov_files do
20
42
  rm_rf 'coverage.data'
21
43
  end
@@ -25,7 +47,6 @@ RSpec::Core::RakeTask.new(:spec) do |t|
25
47
  t.rspec_opts = %w[--color]
26
48
  end
27
49
 
28
- Cucumber::Rake::Task.new(:cucumber)
29
50
 
30
51
  namespace :spec do
31
52
  desc "Run all examples using rcov"
@@ -36,16 +57,6 @@ namespace :spec do
36
57
  end
37
58
  end
38
59
 
39
- namespace :cucumber do
40
- desc "Run cucumber features using rcov"
41
- Cucumber::Rake::Task.new :rcov => :cleanup_rcov_files do |t|
42
- t.cucumber_opts = %w{--format progress}
43
- t.rcov = true
44
- t.rcov_opts = %[-Ilib -Ispec --exclude "gems/*,features"]
45
- t.rcov_opts << %[--text-report --sort coverage --aggregate coverage.data]
46
- end
47
- end
48
-
49
60
  task :default => [:spec, :cucumber]
50
61
 
51
62
  Rake::RDocTask.new do |rdoc|
@@ -1,3 +1,19 @@
1
+ ### 2.6.0.rc2 / 2011-04-18
2
+
3
+ [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.5.0...v2.6.1.rc2)
4
+
5
+ * Enhancments
6
+ * `change` matcher accepts Regexps (Robert Davis)
7
+ * better descriptions for have_xxx matchers (Magnus Bergmark)
8
+
9
+ * Bug fixes
10
+ * Removed non-ascii characters that were choking rcov (Geoffrey Byers)
11
+ * change matcher dups arrays and hashes so their before/after states can be
12
+ compared correctly.
13
+ * Fix the order of inclusion of RSpec::Matchers in
14
+ Test::Unit::TestCase and MiniTest::Unit::TestCase to prevent a
15
+ SystemStackError (Myron Marston)
16
+
1
17
  ### 2.5.0 / 2011-02-05
2
18
 
3
19
  [full changelog](http://github.com/rspec/rspec-expectations/compare/v2.4.0...v2.5.0)
@@ -25,7 +25,7 @@ Feature: "be" matchers
25
25
  specify { false.should be_true }
26
26
  end
27
27
  """
28
- When I run "rspec be_true_spec.rb"
28
+ When I run `rspec be_true_spec.rb`
29
29
  Then the output should contain all of these:
30
30
  | 10 examples, 5 failures |
31
31
  | expected true not to be true |
@@ -52,7 +52,7 @@ Feature: "be" matchers
52
52
  specify { "foo".should be_false }
53
53
  end
54
54
  """
55
- When I run "rspec be_false_spec.rb"
55
+ When I run `rspec be_false_spec.rb`
56
56
  Then the output should contain all of these:
57
57
  | 10 examples, 5 failures |
58
58
  | expected nil not to be false |
@@ -79,7 +79,7 @@ Feature: "be" matchers
79
79
  specify { "foo".should be_nil }
80
80
  end
81
81
  """
82
- When I run "rspec be_nil_spec.rb"
82
+ When I run `rspec be_nil_spec.rb`
83
83
  Then the output should contain "10 examples, 5 failures"
84
84
  And the output should contain:
85
85
  """
@@ -125,7 +125,7 @@ Feature: "be" matchers
125
125
  specify { false.should be }
126
126
  end
127
127
  """
128
- When I run "rspec be_spec.rb"
128
+ When I run `rspec be_spec.rb`
129
129
  Then the output should contain all of these:
130
130
  | 10 examples, 5 failures |
131
131
  | expected true to evaluate to false |
@@ -34,7 +34,7 @@ Feature: be_within matcher
34
34
  it { should be_within(0.5).of(27) }
35
35
  end
36
36
  """
37
- When I run "rspec be_within_matcher_spec.rb"
37
+ When I run `rspec be_within_matcher_spec.rb`
38
38
  Then the output should contain all of these:
39
39
  | 8 examples, 4 failures |
40
40
  | expected 27.5 not to be within 0.5 of 27.9 |
@@ -42,7 +42,7 @@ Feature: equality matchers
42
42
  end
43
43
  end
44
44
  """
45
- When I run "rspec compare_using_eq.rb"
45
+ When I run `rspec compare_using_eq.rb`
46
46
  Then the output should contain "3 examples, 0 failures"
47
47
 
48
48
  Scenario: compare using ==
@@ -66,7 +66,7 @@ Feature: equality matchers
66
66
  end
67
67
  end
68
68
  """
69
- When I run "rspec compare_using_==.rb"
69
+ When I run `rspec compare_using_==.rb`
70
70
  Then the output should contain "3 examples, 0 failures"
71
71
 
72
72
  Scenario: compare using eql (eql?)
@@ -89,7 +89,7 @@ Feature: equality matchers
89
89
 
90
90
  end
91
91
  """
92
- When I run "rspec compare_using_eql.rb"
92
+ When I run `rspec compare_using_eql.rb`
93
93
  Then the output should contain "3 examples, 0 failures"
94
94
 
95
95
  Scenario: compare using equal (equal?)
@@ -113,7 +113,7 @@ Feature: equality matchers
113
113
 
114
114
  end
115
115
  """
116
- When I run "rspec compare_using_equal.rb"
116
+ When I run `rspec compare_using_equal.rb`
117
117
  Then the output should contain "3 examples, 0 failures"
118
118
 
119
119
  Scenario: compare using be (equal?)
@@ -137,6 +137,6 @@ Feature: equality matchers
137
137
 
138
138
  end
139
139
  """
140
- When I run "rspec compare_using_be.rb"
140
+ When I run `rspec compare_using_be.rb`
141
141
  Then the output should contain "3 examples, 0 failures"
142
142
 
@@ -36,7 +36,7 @@ Feature: exist matcher
36
36
  it { should exist } # deliberate failure
37
37
  end
38
38
  """
39
- When I run "rspec exist_matcher_spec.rb"
39
+ When I run `rspec exist_matcher_spec.rb`
40
40
  Then the output should contain all of these:
41
41
  | 4 examples, 2 failures |
42
42
  | expected <Planet: Earth> not to exist |
@@ -35,7 +35,7 @@ Feature: expect change
35
35
  end
36
36
  end
37
37
  """
38
- When I run "rspec spec/example_spec.rb"
38
+ When I run `rspec spec/example_spec.rb`
39
39
  Then the output should contain "1 failure"
40
40
  Then the output should contain "should have been changed by 2, but was changed by 1"
41
41
 
@@ -54,6 +54,6 @@ Feature: expect change
54
54
  end
55
55
  end
56
56
  """
57
- When I run "rspec spec/example_spec.rb"
57
+ When I run `rspec spec/example_spec.rb`
58
58
  Then the output should contain "2 failures"
59
59
  Then the output should contain "should not have changed, but did change from 1 to 2"
@@ -24,7 +24,7 @@ Feature: raise_error matcher
24
24
  end
25
25
  end
26
26
  """
27
- When I run "rspec expect_error_spec.rb"
27
+ When I run `rspec expect_error_spec.rb`
28
28
  Then the example should pass
29
29
 
30
30
  Scenario: expect specific error
@@ -36,7 +36,7 @@ Feature: raise_error matcher
36
36
  end
37
37
  end
38
38
  """
39
- When I run "rspec expect_error_spec.rb"
39
+ When I run `rspec expect_error_spec.rb`
40
40
  Then the example should pass
41
41
 
42
42
  Scenario: expect specific error message using a string
@@ -49,7 +49,7 @@ Feature: raise_error matcher
49
49
  end
50
50
  end
51
51
  """
52
- When I run "rspec expect_error_with_message.rb"
52
+ When I run `rspec expect_error_with_message.rb`
53
53
  Then the example should pass
54
54
 
55
55
  Scenario: expect specific error message using a regular expression
@@ -62,7 +62,7 @@ Feature: raise_error matcher
62
62
  end
63
63
  end
64
64
  """
65
- When I run "rspec expect_error_with_regex.rb"
65
+ When I run `rspec expect_error_with_regex.rb`
66
66
  Then the example should pass
67
67
 
68
68
  Scenario: set expectations on error object passed to block
@@ -76,7 +76,7 @@ Feature: raise_error matcher
76
76
  end
77
77
  end
78
78
  """
79
- When I run "rspec expect_error_with_block_spec.rb"
79
+ When I run `rspec expect_error_with_block_spec.rb`
80
80
  Then the example should pass
81
81
 
82
82
  Scenario: expect no error at all
@@ -88,7 +88,7 @@ Feature: raise_error matcher
88
88
  end
89
89
  end
90
90
  """
91
- When I run "rspec expect_no_error_spec.rb"
91
+ When I run `rspec expect_no_error_spec.rb`
92
92
  Then the example should pass
93
93
 
94
94
  Scenario: expect no occurence of a specific error
@@ -101,5 +101,5 @@ Feature: raise_error matcher
101
101
  end
102
102
  end
103
103
  """
104
- When I run "rspec expect_no_error_spec.rb"
104
+ When I run `rspec expect_no_error_spec.rb`
105
105
  Then the example should pass
@@ -51,7 +51,7 @@ Feature: have(n).items matcher
51
51
  it { should have_at_most(2).items }
52
52
  end
53
53
  """
54
- When I run "rspec have_items_spec.rb"
54
+ When I run `rspec have_items_spec.rb`
55
55
  Then the output should contain "16 examples, 8 failures"
56
56
  And the output should contain "expected target not to have 3 items, got 3"
57
57
  And the output should contain "expected 2 items, got 3"
@@ -93,7 +93,7 @@ Feature: have(n).items matcher
93
93
  it { should have_at_most(4).words }
94
94
  end
95
95
  """
96
- When I run "rspec have_words_spec.rb"
96
+ When I run `rspec have_words_spec.rb`
97
97
  Then the output should contain "16 examples, 8 failures"
98
98
  And the output should contain "expected target not to have 5 words, got 5"
99
99
  And the output should contain "expected 4 words, got 5"
@@ -47,7 +47,7 @@ Feature: include matcher
47
47
  it { should_not include(1, 9) }
48
48
  end
49
49
  """
50
- When I run "rspec array_include_matcher_spec.rb"
50
+ When I run `rspec array_include_matcher_spec.rb`
51
51
  Then the output should contain all of these:
52
52
  | 14 examples, 7 failures |
53
53
  | expected [1, 3, 7] to include 4 |
@@ -74,7 +74,7 @@ Feature: include matcher
74
74
  it { should_not include("str", "foo") }
75
75
  end
76
76
  """
77
- When I run "rspec string_include_matcher_spec.rb"
77
+ When I run `rspec string_include_matcher_spec.rb`
78
78
  Then the output should contain all of these:
79
79
  | 8 examples, 4 failures |
80
80
  | expected "a string" to include "foo" |
@@ -117,5 +117,5 @@ Feature: include matcher
117
117
  it { should_not include(:a => 7, :d => 3) }
118
118
  end
119
119
  """
120
- When I run "rspec hash_include_matcher_spec.rb"
120
+ When I run `rspec hash_include_matcher_spec.rb`
121
121
  Then the output should contain "13 failure"
@@ -24,7 +24,7 @@ Feature: match matcher
24
24
  it { should match(/foo/) }
25
25
  end
26
26
  """
27
- When I run "rspec string_match_spec.rb"
27
+ When I run `rspec string_match_spec.rb`
28
28
  Then the output should contain all of these:
29
29
  | 4 examples, 2 failures |
30
30
  | expected "a string" not to match /str/ |
@@ -42,7 +42,7 @@ Feature: match matcher
42
42
  it { should match("drinks") }
43
43
  end
44
44
  """
45
- When I run "rspec regexp_match_spec.rb"
45
+ When I run `rspec regexp_match_spec.rb`
46
46
  Then the output should contain all of these:
47
47
  | 4 examples, 2 failures |
48
48
  | expected /foo/ not to match "food" |
@@ -46,7 +46,7 @@ Feature: operator matchers
46
46
  it { should_not == 18 }
47
47
  end
48
48
  """
49
- When I run "rspec numeric_operator_matchers_spec.rb"
49
+ When I run `rspec numeric_operator_matchers_spec.rb`
50
50
  Then the output should contain "12 examples, 6 failures"
51
51
  And the output should contain:
52
52
  """
@@ -119,7 +119,7 @@ Feature: operator matchers
119
119
  end
120
120
  end
121
121
  """
122
- When I run "rspec string_operator_matchers_spec.rb"
122
+ When I run `rspec string_operator_matchers_spec.rb`
123
123
  Then the output should contain "18 examples, 9 failures"
124
124
  And the output should contain:
125
125
  """
@@ -196,7 +196,7 @@ Feature: operator matchers
196
196
  it { should =~ [1, 2, 1] }
197
197
  end
198
198
  """
199
- When I run "rspec array_operator_matchers_spec.rb"
199
+ When I run `rspec array_operator_matchers_spec.rb`
200
200
  Then the output should contain "11 examples, 3 failures"
201
201
  And the output should contain:
202
202
  """
@@ -46,7 +46,7 @@ Feature: predicate matchers
46
46
  it { should be_zero } # deliberate failure
47
47
  end
48
48
  """
49
- When I run "rspec should_be_zero_spec.rb"
49
+ When I run `rspec should_be_zero_spec.rb`
50
50
  Then the output should contain "2 examples, 1 failure"
51
51
  And the output should contain "expected zero? to return true, got false"
52
52
 
@@ -61,7 +61,7 @@ Feature: predicate matchers
61
61
  it { should_not be_empty } # deliberate failure
62
62
  end
63
63
  """
64
- When I run "rspec should_not_be_empty_spec.rb"
64
+ When I run `rspec should_not_be_empty_spec.rb`
65
65
  Then the output should contain "2 examples, 1 failure"
66
66
  And the output should contain "expected empty? to return false, got true"
67
67
 
@@ -74,7 +74,7 @@ Feature: predicate matchers
74
74
  it { should have_key(:bar) } # deliberate failure
75
75
  end
76
76
  """
77
- When I run "rspec should_have_key_spec.rb"
77
+ When I run `rspec should_have_key_spec.rb`
78
78
  Then the output should contain "2 examples, 1 failure"
79
79
  And the output should contain "expected #has_key?(:bar) to return true, got false"
80
80
 
@@ -99,7 +99,7 @@ Feature: predicate matchers
99
99
  end
100
100
  end
101
101
  """
102
- When I run "rspec should_not_have_all_string_keys_spec.rb"
102
+ When I run `rspec should_not_have_all_string_keys_spec.rb`
103
103
  Then the output should contain "2 examples, 1 failure"
104
104
  And the output should contain "expected #has_all_string_keys?(nil) to return false, got true"
105
105
 
@@ -121,7 +121,7 @@ Feature: predicate matchers
121
121
  it { should be_multiple_of(5) }
122
122
  end
123
123
  """
124
- When I run "rspec predicate_matcher_argument_spec.rb"
124
+ When I run `rspec predicate_matcher_argument_spec.rb`
125
125
  Then the output should contain "4 examples, 2 failures"
126
126
  And the output should contain "expected multiple_of?(4) to return false, got true"
127
127
  And the output should contain "expected multiple_of?(5) to return true, got false"