rspec-core 2.0.0.a1

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.
Files changed (143) hide show
  1. data/.document +5 -0
  2. data/.gitignore +7 -0
  3. data/.treasure_map.rb +23 -0
  4. data/License.txt +22 -0
  5. data/README.markdown +9 -0
  6. data/Rakefile +76 -0
  7. data/TODO.markdown +16 -0
  8. data/VERSION +1 -0
  9. data/VERSION.yml +5 -0
  10. data/bin/rspec +12 -0
  11. data/cucumber.yml +2 -0
  12. data/example_specs/failing/README.txt +7 -0
  13. data/example_specs/failing/diffing_spec.rb +36 -0
  14. data/example_specs/failing/failing_implicit_docstrings_example.rb +19 -0
  15. data/example_specs/failing/failure_in_after.rb +10 -0
  16. data/example_specs/failing/failure_in_before.rb +10 -0
  17. data/example_specs/failing/mocking_example.rb +40 -0
  18. data/example_specs/failing/mocking_with_flexmock.rb +26 -0
  19. data/example_specs/failing/mocking_with_mocha.rb +25 -0
  20. data/example_specs/failing/mocking_with_rr.rb +27 -0
  21. data/example_specs/failing/partial_mock_example.rb +20 -0
  22. data/example_specs/failing/pending_example.rb +9 -0
  23. data/example_specs/failing/predicate_example.rb +34 -0
  24. data/example_specs/failing/raising_example.rb +47 -0
  25. data/example_specs/failing/spec_helper.rb +3 -0
  26. data/example_specs/failing/syntax_error_example.rb +7 -0
  27. data/example_specs/failing/team_spec.rb +44 -0
  28. data/example_specs/failing/timeout_behaviour.rb +7 -0
  29. data/example_specs/passing/custom_formatter.rb +12 -0
  30. data/example_specs/passing/custom_matchers.rb +54 -0
  31. data/example_specs/passing/dynamic_spec.rb +9 -0
  32. data/example_specs/passing/file_accessor.rb +19 -0
  33. data/example_specs/passing/file_accessor_spec.rb +38 -0
  34. data/example_specs/passing/filtered_formatter.rb +18 -0
  35. data/example_specs/passing/filtered_formatter_example.rb +31 -0
  36. data/example_specs/passing/greeter_spec.rb +31 -0
  37. data/example_specs/passing/helper_method_example.rb +14 -0
  38. data/example_specs/passing/implicit_docstrings_example.rb +18 -0
  39. data/example_specs/passing/io_processor.rb +8 -0
  40. data/example_specs/passing/io_processor_spec.rb +21 -0
  41. data/example_specs/passing/mocking_example.rb +27 -0
  42. data/example_specs/passing/multi_threaded_example_group_runner.rb +26 -0
  43. data/example_specs/passing/nested_classes_example.rb +36 -0
  44. data/example_specs/passing/options_example.rb +31 -0
  45. data/example_specs/passing/options_formatter.rb +20 -0
  46. data/example_specs/passing/partial_mock_example.rb +29 -0
  47. data/example_specs/passing/pending_example.rb +20 -0
  48. data/example_specs/passing/predicate_example.rb +27 -0
  49. data/example_specs/passing/shared_example_group_example.rb +81 -0
  50. data/example_specs/passing/shared_stack_examples.rb +36 -0
  51. data/example_specs/passing/simple_matcher_example.rb +31 -0
  52. data/example_specs/passing/spec_helper.rb +14 -0
  53. data/example_specs/passing/stack.rb +36 -0
  54. data/example_specs/passing/stack_spec.rb +64 -0
  55. data/example_specs/passing/stack_spec_with_nested_example_groups.rb +67 -0
  56. data/example_specs/passing/stubbing_example.rb +69 -0
  57. data/example_specs/passing/yielding_example.rb +33 -0
  58. data/example_specs/ruby1.9.compatibility/access_to_constants_spec.rb +85 -0
  59. data/features-pending/command_line/line_number_option.feature +56 -0
  60. data/features-pending/command_line/line_number_option_with_example_with_no_name.feature +22 -0
  61. data/features-pending/example_groups/example_group_with_should_methods.feature +29 -0
  62. data/features-pending/example_groups/implicit_docstrings.feature +59 -0
  63. data/features-pending/example_groups/nested_groups.feature +32 -0
  64. data/features-pending/expectations/expect_change.feature +65 -0
  65. data/features-pending/expectations/expect_error.feature +44 -0
  66. data/features-pending/extensions/custom_example_group.feature +19 -0
  67. data/features-pending/formatters/custom_formatter.feature +30 -0
  68. data/features-pending/heckle/heckle.feature +56 -0
  69. data/features-pending/interop/examples_and_tests_together.feature +80 -0
  70. data/features-pending/interop/rspec_output.feature +25 -0
  71. data/features-pending/interop/test_but_not_test_unit.feature +26 -0
  72. data/features-pending/interop/test_case_with_should_methods.feature +46 -0
  73. data/features-pending/matchers/define_diffable_matcher.feature +26 -0
  74. data/features-pending/matchers/define_matcher.feature +179 -0
  75. data/features-pending/matchers/define_matcher_with_fluent_interface.feature +27 -0
  76. data/features-pending/mocks/mix_stubs_and_mocks.feature +22 -0
  77. data/features-pending/mocks/stub_implementation.feature +26 -0
  78. data/features-pending/pending/pending_examples.feature +81 -0
  79. data/features-pending/runner/specify_line_number.feature +32 -0
  80. data/features/before_and_after_blocks/before_and_after_blocks.feature +169 -0
  81. data/features/expectations/customized_message.feature +54 -0
  82. data/features/matchers/define_matcher_outside_rspec.feature +39 -0
  83. data/features/mock_framework_integration/use_flexmock.feature +23 -0
  84. data/features/mock_framework_integration/use_mocha.feature +23 -0
  85. data/features/mock_framework_integration/use_rr.feature +23 -0
  86. data/features/mock_framework_integration/use_rspec.feature +23 -0
  87. data/features/step_definitions/running_rspec_steps.rb +35 -0
  88. data/features/subject/explicit_subject.feature +31 -0
  89. data/features/subject/implicit_subject.feature +31 -0
  90. data/features/support/env.rb +82 -0
  91. data/features/support/matchers/smart_match.rb +14 -0
  92. data/lib/rspec/autorun.rb +2 -0
  93. data/lib/rspec/core.rb +38 -0
  94. data/lib/rspec/core/backward_compatibility.rb +9 -0
  95. data/lib/rspec/core/command_line_options.rb +60 -0
  96. data/lib/rspec/core/configuration.rb +222 -0
  97. data/lib/rspec/core/deprecation.rb +47 -0
  98. data/lib/rspec/core/example.rb +113 -0
  99. data/lib/rspec/core/example_group.rb +239 -0
  100. data/lib/rspec/core/example_group_subject.rb +77 -0
  101. data/lib/rspec/core/formatters.rb +16 -0
  102. data/lib/rspec/core/formatters/base_formatter.rb +123 -0
  103. data/lib/rspec/core/formatters/base_text_formatter.rb +139 -0
  104. data/lib/rspec/core/formatters/documentation_formatter.rb +84 -0
  105. data/lib/rspec/core/formatters/progress_formatter.rb +36 -0
  106. data/lib/rspec/core/kernel_extensions.rb +15 -0
  107. data/lib/rspec/core/mocking/with_absolutely_nothing.rb +13 -0
  108. data/lib/rspec/core/mocking/with_flexmock.rb +25 -0
  109. data/lib/rspec/core/mocking/with_mocha.rb +22 -0
  110. data/lib/rspec/core/mocking/with_rr.rb +26 -0
  111. data/lib/rspec/core/mocking/with_rspec.rb +21 -0
  112. data/lib/rspec/core/rake_task.rb +88 -0
  113. data/lib/rspec/core/runner.rb +66 -0
  114. data/lib/rspec/core/shared_behaviour.rb +41 -0
  115. data/lib/rspec/core/shared_behaviour_kernel_extensions.rb +31 -0
  116. data/lib/rspec/core/version.rb +16 -0
  117. data/lib/rspec/core/world.rb +105 -0
  118. data/rspec-core.gemspec +204 -0
  119. data/script/console +8 -0
  120. data/spec/resources/example_classes.rb +67 -0
  121. data/spec/rspec/core/command_line_options_spec.rb +63 -0
  122. data/spec/rspec/core/configuration_spec.rb +171 -0
  123. data/spec/rspec/core/example_group_spec.rb +351 -0
  124. data/spec/rspec/core/example_group_subject_spec.rb +67 -0
  125. data/spec/rspec/core/example_spec.rb +67 -0
  126. data/spec/rspec/core/formatters/base_formatter_spec.rb +105 -0
  127. data/spec/rspec/core/formatters/documentation_formatter_spec.rb +5 -0
  128. data/spec/rspec/core/formatters/progress_formatter_spec.rb +29 -0
  129. data/spec/rspec/core/kernel_extensions_spec.rb +13 -0
  130. data/spec/rspec/core/mocha_spec.rb +29 -0
  131. data/spec/rspec/core/resources/a_bar.rb +0 -0
  132. data/spec/rspec/core/resources/a_foo.rb +0 -0
  133. data/spec/rspec/core/resources/a_spec.rb +1 -0
  134. data/spec/rspec/core/resources/custom_example_group_runner.rb +14 -0
  135. data/spec/rspec/core/resources/example_classes.rb +67 -0
  136. data/spec/rspec/core/resources/utf8_encoded.rb +8 -0
  137. data/spec/rspec/core/runner_spec.rb +34 -0
  138. data/spec/rspec/core/shared_behaviour_spec.rb +185 -0
  139. data/spec/rspec/core/world_spec.rb +167 -0
  140. data/spec/rspec/core_spec.rb +35 -0
  141. data/spec/ruby_forker.rb +13 -0
  142. data/spec/spec_helper.rb +72 -0
  143. metadata +219 -0
@@ -0,0 +1,69 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "A consumer of a stub" do
4
+ it "should be able to stub methods on any Object" do
5
+ obj = Object.new
6
+ obj.stub!(:foobar).and_return {:return_value}
7
+ obj.foobar.should equal(:return_value)
8
+ end
9
+ end
10
+
11
+ class StubbableClass
12
+ def self.find id
13
+ return :original_return
14
+ end
15
+ end
16
+
17
+ describe "A stubbed method on a class" do
18
+ it "should return the stubbed value" do
19
+ StubbableClass.stub!(:find).and_return(:stub_return)
20
+ StubbableClass.find(1).should equal(:stub_return)
21
+ end
22
+
23
+ it "should revert to the original method after each spec" do
24
+ StubbableClass.find(1).should equal(:original_return)
25
+ end
26
+
27
+ it "can stub! and mock the same message" do
28
+ StubbableClass.stub!(:msg).and_return(:stub_value)
29
+ StubbableClass.should_receive(:msg).with(:arg).and_return(:mock_value)
30
+
31
+ StubbableClass.msg.should equal(:stub_value)
32
+ StubbableClass.msg(:other_arg).should equal(:stub_value)
33
+ StubbableClass.msg(:arg).should equal(:mock_value)
34
+ StubbableClass.msg(:another_arg).should equal(:stub_value)
35
+ StubbableClass.msg(:yet_another_arg).should equal(:stub_value)
36
+ StubbableClass.msg.should equal(:stub_value)
37
+ end
38
+ end
39
+
40
+ describe "A mock" do
41
+ it "can stub!" do
42
+ mock = mock("stubbing mock")
43
+ mock.stub!(:msg).and_return(:value)
44
+ (1..10).each {mock.msg.should equal(:value)}
45
+ end
46
+
47
+ it "can stub! and mock" do
48
+ mock = mock("stubbing mock")
49
+ mock.stub!(:stub_message).and_return(:stub_value)
50
+ mock.should_receive(:mock_message).once.and_return(:mock_value)
51
+ (1..10).each {mock.stub_message.should equal(:stub_value)}
52
+ mock.mock_message.should equal(:mock_value)
53
+ (1..10).each {mock.stub_message.should equal(:stub_value)}
54
+ end
55
+
56
+ it "can stub! and mock the same message" do
57
+ mock = mock("stubbing mock")
58
+ mock.stub!(:msg).and_return(:stub_value)
59
+ mock.should_receive(:msg).with(:arg).and_return(:mock_value)
60
+ mock.msg.should equal(:stub_value)
61
+ mock.msg(:other_arg).should equal(:stub_value)
62
+ mock.msg(:arg).should equal(:mock_value)
63
+ mock.msg(:another_arg).should equal(:stub_value)
64
+ mock.msg(:yet_another_arg).should equal(:stub_value)
65
+ mock.msg.should equal(:stub_value)
66
+ end
67
+ end
68
+
69
+
@@ -0,0 +1,33 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ class MessageAppender
4
+
5
+ def initialize(appendage)
6
+ @appendage = appendage
7
+ end
8
+
9
+ def append_to(message)
10
+ if_told_to_yield do
11
+ message << @appendage
12
+ end
13
+ end
14
+
15
+ end
16
+
17
+ describe "a message expectation yielding to a block" do
18
+ it "should yield if told to" do
19
+ appender = MessageAppender.new("appended to")
20
+ appender.should_receive(:if_told_to_yield).and_yield
21
+ message = ""
22
+ appender.append_to(message)
23
+ message.should == "appended to"
24
+ end
25
+
26
+ it "should not yield if not told to" do
27
+ appender = MessageAppender.new("appended to")
28
+ appender.should_receive(:if_told_to_yield)
29
+ message = ""
30
+ appender.append_to(message)
31
+ message.should == ""
32
+ end
33
+ end
@@ -0,0 +1,85 @@
1
+ # courtesy of Matthias Hennemeyer
2
+ #
3
+ # The following should pass against ruby 1.8 and 1.9. It currently only passes
4
+ # 1.8 (as of 1/2/2009)
5
+ #
6
+ # Once cucumber supports ruby 1.9, this should be moved to cucumber scenarios instead.
7
+ module Foo
8
+ module Bar
9
+
10
+ module ModuleInEnclosingModule;end
11
+ class ClassInEnclosingModule;end
12
+ def method_in_enclosing_module;end
13
+ CONSTANT_IN_ENCLOSING_MODULE = 0
14
+
15
+ describe "Examples trying to access constants defined in an enclosing module" do
16
+
17
+ it "can access Modules" do
18
+ ModuleInEnclosingModule
19
+ end
20
+ it "can access Classes" do
21
+ ClassInEnclosingModule.new
22
+ end
23
+ it "can access CONSTANTS" do
24
+ CONSTANT_IN_ENCLOSING_MODULE
25
+ end
26
+ it "can NOT access methods" do
27
+ lambda {method_in_enclosing_module}.should raise_error(/undefined/)
28
+ end
29
+
30
+ describe "from a nested example group" do
31
+
32
+ it "can access Modules" do
33
+ ModuleInEnclosingModule
34
+ end
35
+ it "can access Classes" do
36
+ ClassInEnclosingModule.new
37
+ end
38
+ it "can access CONSTANTS" do
39
+ CONSTANT_IN_ENCLOSING_MODULE
40
+ end
41
+ it "can NOT access methods" do
42
+ lambda {method_in_enclosing_module}.should raise_error(/undefined/)
43
+ end
44
+
45
+ end
46
+
47
+ end
48
+
49
+ describe "Examples trying to access constants defined in the example group" do
50
+
51
+ module ModuleDefinedInGroup;end
52
+ class ClassDefinedInGroup; end
53
+ def method_defined_in_group; end
54
+ CONSTANT_DEFINED_IN_GROUP = 0
55
+
56
+ it "can access Modules" do
57
+ ModuleDefinedInGroup
58
+ end
59
+ it "can access Classes" do
60
+ ClassDefinedInGroup.new
61
+ end
62
+ it "can access CONSTANTS" do
63
+ CONSTANT_DEFINED_IN_GROUP
64
+ end
65
+ it "can access methods" do
66
+ method_defined_in_group
67
+ end
68
+
69
+ describe "that live inside a nested group" do
70
+ it "can access Modules" do
71
+ ModuleDefinedInGroup
72
+ end
73
+ it "can access Classes" do
74
+ ClassDefinedInGroup.new
75
+ end
76
+ it "can access CONSTANTS" do
77
+ CONSTANT_DEFINED_IN_GROUP
78
+ end
79
+ it "can access methods" do
80
+ method_defined_in_group
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,56 @@
1
+ Feature: Spec and test together
2
+
3
+ As an RSpec user
4
+ I want to run one example identified by the line number
5
+
6
+ Background:
7
+ Given a file named "example.rb" with:
8
+ """
9
+ describe "a group" do
10
+
11
+ it "has a first example" do
12
+
13
+ end
14
+
15
+ it "has a second example" do
16
+
17
+ end
18
+
19
+ end
20
+ """
21
+
22
+ Scenario: two examples - first example on declaration line
23
+ When I run "spec example.rb:3 --format nested"
24
+ Then the stdout should match "1 example, 0 failures"
25
+ And the stdout should match "has a first example"
26
+ But the stdout should not match "has a second example"
27
+
28
+ Scenario: two examples - first example from line inside declaration
29
+ When I run "spec example.rb:4 --format nested"
30
+ Then the stdout should match "1 example, 0 failures"
31
+ And the stdout should match "has a first example"
32
+ But the stdout should not match "has a second example"
33
+
34
+ Scenario: two examples - first example from line below declaration
35
+ When I run "spec example.rb:6 --format nested"
36
+ Then the stdout should match "1 example, 0 failures"
37
+ And the stdout should match "has a first example"
38
+ But the stdout should not match "has a second example"
39
+
40
+ Scenario: two examples - second example from line below declaration
41
+ When I run "spec example.rb:7 --format nested"
42
+ Then the stdout should match "1 example, 0 failures"
43
+ And the stdout should match "has a second example"
44
+ But the stdout should not match "has a first example"
45
+
46
+ Scenario: two examples - both examples from the group declaration
47
+ When I run "spec example.rb:1 --format nested"
48
+ Then the stdout should match "2 examples, 0 failures"
49
+ And the stdout should match "has a second example"
50
+ And the stdout should match "has a first example"
51
+
52
+ Scenario: two examples - both examples from above the first example declaration
53
+ When I run "spec example.rb:2 --format nested"
54
+ Then the stdout should match "2 examples, 0 failures"
55
+ And the stdout should match "has a second example"
56
+ And the stdout should match "has a first example"
@@ -0,0 +1,22 @@
1
+ Feature: Spec and test together
2
+
3
+ As an RSpec user
4
+ I want to run one example identified by the line number
5
+
6
+ Background:
7
+ Given a file named "example.rb" with:
8
+ """
9
+ describe 9 do
10
+
11
+ it { should be > 8 }
12
+
13
+ it { should be < 10 }
14
+
15
+ end
16
+ """
17
+
18
+ Scenario: two examples - first example on declaration line
19
+ When I run "spec example.rb:3 --format nested"
20
+ Then the stdout should match "1 example, 0 failures"
21
+ Then the stdout should match "should be > 8"
22
+ But the stdout should not match "should be < 10"
@@ -0,0 +1,29 @@
1
+ Feature: Spec::ExampleGroup with should methods
2
+
3
+ As an RSpec adopter accustomed to classes and methods
4
+ I want to use should_* methods in an ExampleGroup
5
+ So that I use RSpec with classes and methods that look more like RSpec examples
6
+
7
+ Scenario Outline: Example Group class with should methods
8
+ Given a file named "example_group_with_should_methods.rb" with:
9
+ """
10
+ require 'rspec/autorun'
11
+
12
+ class MySpec < Spec::ExampleGroup
13
+ def should_pass_with_should
14
+ 1.should == 1
15
+ end
16
+
17
+ def should_fail_with_should
18
+ 1.should == 2
19
+ end
20
+ end
21
+ """
22
+ When I run "<Command> example_group_with_should_methods.rb"
23
+ Then the exit code should be 256
24
+ And the stdout should match "2 examples, 1 failure"
25
+
26
+ Scenarios: Run with ruby and spec
27
+ | Command |
28
+ | ruby |
29
+ | spec |
@@ -0,0 +1,59 @@
1
+ Feature: implicit docstrings
2
+
3
+ As an RSpec user
4
+ I want examples to generate their own names
5
+ So that I can reduce duplication between example names and example code
6
+
7
+ Scenario Outline: run passing examples
8
+ Given a file named "implicit_docstrings_example.rb" with:
9
+ """
10
+ require 'rspec/autorun'
11
+ describe "Examples with no docstrings generate their own:" do
12
+
13
+ specify { 3.should be < 5 }
14
+
15
+ specify { ["a"].should include("a") }
16
+
17
+ specify { [1,2,3].should respond_to(:size) }
18
+
19
+ end
20
+ """
21
+
22
+ When I run "<Command> implicit_docstrings_example.rb -fs"
23
+
24
+ Then the stdout should match /should be < 5/
25
+ And the stdout should match /should include "a"/
26
+ And the stdout should match /should respond to #size/
27
+
28
+ Scenarios: Run with ruby and spec
29
+ | Command |
30
+ | ruby |
31
+ | spec |
32
+
33
+ Scenario Outline: run failing examples
34
+ Given a file named "failing_implicit_docstrings_example.rb" with:
35
+ """
36
+ require 'rspec/autorun'
37
+ describe "Failing examples with no descriptions" do
38
+
39
+ # description is auto-generated as "should equal(5)" based on the last #should
40
+ it do
41
+ 3.should equal(2)
42
+ 5.should equal(5)
43
+ end
44
+
45
+ it { 3.should be > 5 }
46
+
47
+ it { ["a"].should include("b") }
48
+
49
+ it { [1,2,3].should_not respond_to(:size) }
50
+
51
+ end
52
+ """
53
+
54
+ When I run "<Command> failing_implicit_docstrings_example.rb -fs"
55
+
56
+ Then the stdout should match /should equal 2/
57
+ And the stdout should match /should be > 5/
58
+ And the stdout should match /should include "b"/
59
+ And the stdout should match /should not respond to #size/
@@ -0,0 +1,32 @@
1
+ Feature: Nested example groups
2
+
3
+ As an RSpec user
4
+ I want to nest examples groups
5
+ So that I can better organize my examples
6
+
7
+ Scenario Outline: Nested example groups
8
+ Given a file named "nested_example_groups.rb" with:
9
+ """
10
+ require 'rspec/autorun'
11
+
12
+ describe "Some Object" do
13
+ describe "with some more context" do
14
+ it "should do this" do
15
+ true.should be_true
16
+ end
17
+ end
18
+ describe "with some other context" do
19
+ it "should do that" do
20
+ false.should be_false
21
+ end
22
+ end
23
+ end
24
+ """
25
+ When I run "<Command> nested_example_groups.rb -fs"
26
+ Then the stdout should match /Some Object with some more context/
27
+ And the stdout should match /Some Object with some other context/
28
+
29
+ Scenarios: Run with ruby and spec
30
+ | Command |
31
+ | ruby |
32
+ | spec |
@@ -0,0 +1,65 @@
1
+ Feature: expect change
2
+
3
+ Expect some code (wrapped in a proc) to change the state of some object.
4
+
5
+ Scenario: expecting change
6
+ Given a file named "expect_change.rb" with:
7
+ """
8
+ class Counter
9
+ class << self
10
+ def increment
11
+ @count ||= 0
12
+ @count += 1
13
+ end
14
+
15
+ def count
16
+ @count ||= 0
17
+ end
18
+ end
19
+ end
20
+
21
+ describe Counter, "#increment" do
22
+ it "should increment the count" do
23
+ expect{Counter.increment}.to change{Counter.count}.from(0).to(1)
24
+ end
25
+
26
+ # deliberate failure
27
+ it "should increment the count by 2" do
28
+ expect{Counter.increment}.to change{Counter.count}.by(2)
29
+ end
30
+ end
31
+ """
32
+ When I run "spec expect_change.rb"
33
+ Then the stdout should match "2 examples, 1 failure"
34
+ Then the stdout should match "should have been changed by 2, but was changed by 1"
35
+
36
+ Scenario: expecting no change
37
+ Given a file named "expect_no_change.rb" with:
38
+ """
39
+ class Counter
40
+ class << self
41
+ def increment
42
+ @count ||= 0
43
+ @count += 1
44
+ end
45
+
46
+ def count
47
+ @count ||= 0
48
+ end
49
+ end
50
+ end
51
+
52
+ describe Counter, "#increment" do
53
+ it "should not increment the count by 2" do
54
+ expect{Counter.increment}.to_not change{Counter.count}.from(0).to(2)
55
+ end
56
+
57
+ # deliberate failure
58
+ it "should not increment the count by 1" do
59
+ expect{Counter.increment}.to_not change{Counter.count}.by(1)
60
+ end
61
+ end
62
+ """
63
+ When I run "spec expect_no_change.rb"
64
+ Then the stdout should match "2 examples, 1 failure"
65
+ Then the stdout should match "should not have changed, but did change from 1 to 2"