rspec-mocks 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 (50) hide show
  1. data/.travis.yml +7 -0
  2. data/Gemfile +13 -12
  3. data/Guardfile +3 -3
  4. data/README.md +2 -0
  5. data/features/.nav +4 -0
  6. data/features/Changelog.md +12 -0
  7. data/features/README.markdown +44 -4
  8. data/features/message_expectations/any_instance.feature +19 -0
  9. data/features/message_expectations/block_local_expectations.feature.pending +2 -2
  10. data/features/message_expectations/expect_message.feature +3 -3
  11. data/features/message_expectations/warn_when_expectation_is_set_on_nil.feature +3 -3
  12. data/features/method_stubs/README.md +32 -24
  13. data/features/method_stubs/any_instance.feature +23 -0
  14. data/features/method_stubs/as_null_object.feature +36 -0
  15. data/features/method_stubs/simple_return_value.feature +2 -2
  16. data/features/method_stubs/stub_chain.feature +13 -6
  17. data/features/method_stubs/stub_implementation.feature +1 -1
  18. data/features/method_stubs/to_ary.feature +45 -0
  19. data/features/outside_rspec/configuration.feature +3 -3
  20. data/features/outside_rspec/standalone.feature +2 -2
  21. data/features/step_definitions/additional_cli_steps.rb +4 -0
  22. data/features/support/env.rb +5 -1
  23. data/lib/rspec/mocks.rb +2 -1
  24. data/lib/rspec/mocks/any_instance.rb +246 -0
  25. data/lib/rspec/mocks/extensions/psych.rb +23 -0
  26. data/lib/rspec/mocks/framework.rb +1 -0
  27. data/lib/rspec/mocks/message_expectation.rb +7 -4
  28. data/lib/rspec/mocks/methods.rb +1 -1
  29. data/lib/rspec/mocks/mock.rb +2 -2
  30. data/lib/rspec/mocks/serialization.rb +5 -3
  31. data/lib/rspec/mocks/space.rb +1 -1
  32. data/lib/rspec/mocks/version.rb +1 -1
  33. data/spec/rspec/mocks/and_yield_spec.rb +3 -3
  34. data/spec/rspec/mocks/any_instance_spec.rb +578 -0
  35. data/spec/rspec/mocks/any_number_of_times_spec.rb +22 -28
  36. data/spec/rspec/mocks/at_least_spec.rb +6 -0
  37. data/spec/rspec/mocks/at_most_spec.rb +6 -0
  38. data/spec/rspec/mocks/bug_report_10263_spec.rb +12 -14
  39. data/spec/rspec/mocks/bug_report_7611_spec.rb +2 -4
  40. data/spec/rspec/mocks/failing_argument_matchers_spec.rb +45 -46
  41. data/spec/rspec/mocks/nil_expectation_warning_spec.rb +1 -2
  42. data/spec/rspec/mocks/passing_argument_matchers_spec.rb +119 -122
  43. data/spec/rspec/mocks/precise_counts_spec.rb +6 -0
  44. data/spec/rspec/mocks/serialization_spec.rb +21 -3
  45. data/spec/rspec/mocks/stub_chain_spec.rb +72 -37
  46. data/spec/rspec/mocks/stub_spec.rb +64 -61
  47. data/spec/rspec/mocks/to_ary_spec.rb +31 -0
  48. metadata +32 -15
  49. data/spec/rspec/mocks/bug_report_7805_spec.rb +0 -22
  50. data/spec/rspec/mocks/bug_report_8302_spec.rb +0 -26
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Bug7805
4
- #This is really a duplicate of 8302
5
-
6
- describe "Stubs should correctly restore module methods" do
7
- it "1 - stub the open method" do
8
- File.stub(:open).and_return("something")
9
- File.open.should == "something"
10
- end
11
- it "2 - use File.open to create example.txt" do
12
- filename = "#{File.dirname(__FILE__)}/example-#{Time.new.to_i}.txt"
13
- File.exist?(filename).should be_false
14
- file = File.open(filename,'w')
15
- file.close
16
- File.exist?(filename).should be_true
17
- File.delete(filename)
18
- File.exist?(filename).should be_false
19
- end
20
- end
21
-
22
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Bug8302
4
- describe "Bug report 8302:" do
5
- class Foo
6
- def Foo.class_method(arg)
7
- end
8
-
9
- def instance_bar(arg)
10
- end
11
- end
12
-
13
- it "class method is not restored correctly when proxied" do
14
- Foo.should_not_receive(:class_method).with(Array.new)
15
- Foo.rspec_verify
16
- Foo.class_method(Array.new)
17
- end
18
-
19
- it "instance method is not restored correctly when proxied" do
20
- foo = Foo.new
21
- foo.should_not_receive(:instance_bar).with(Array.new)
22
- foo.rspec_verify
23
- foo.instance_bar(Array.new)
24
- end
25
- end
26
- end