rspec 1.0.4 → 1.0.5

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 (107) hide show
  1. data/CHANGES +12 -0
  2. data/EXAMPLES.rd +1 -1
  3. data/Rakefile +1 -0
  4. data/examples/auto_spec_description_example.rb +1 -1
  5. data/examples/before_and_after_example.rb +1 -1
  6. data/examples/behave_as_example.rb +1 -1
  7. data/examples/dynamic_spec.rb +1 -1
  8. data/examples/file_accessor.rb +18 -18
  9. data/examples/file_accessor_spec.rb +38 -38
  10. data/examples/greeter_spec.rb +1 -1
  11. data/examples/helper_method_example.rb +1 -1
  12. data/examples/io_processor.rb +8 -8
  13. data/examples/io_processor_spec.rb +1 -1
  14. data/examples/legacy_spec.rb +1 -1
  15. data/examples/not_yet_implemented_spec.rb +1 -1
  16. data/examples/partial_mock_example.rb +1 -1
  17. data/examples/predicate_example.rb +1 -1
  18. data/examples/stack.rb +1 -1
  19. data/examples/stack_spec.rb +1 -1
  20. data/examples/stubbing_example.rb +1 -1
  21. data/examples/test_case_adapter_example.rb +1 -1
  22. data/lib/autotest/discover.rb +1 -1
  23. data/lib/autotest/rspec.rb +15 -16
  24. data/lib/spec.rb +1 -1
  25. data/lib/spec/dsl/behaviour.rb +1 -0
  26. data/lib/spec/dsl/configuration.rb +1 -1
  27. data/lib/spec/dsl/description.rb +1 -1
  28. data/lib/spec/expectations.rb +1 -1
  29. data/lib/spec/expectations/extensions/string_and_symbol.rb +1 -1
  30. data/lib/spec/extensions/object.rb +1 -1
  31. data/lib/spec/matchers.rb +1 -1
  32. data/lib/spec/matchers/be_close.rb +1 -1
  33. data/lib/spec/matchers/eql.rb +1 -1
  34. data/lib/spec/matchers/equal.rb +1 -1
  35. data/lib/spec/matchers/have.rb +7 -2
  36. data/lib/spec/mocks.rb +1 -1
  37. data/lib/spec/mocks/argument_constraint_matchers.rb +1 -1
  38. data/lib/spec/mocks/error_generator.rb +1 -1
  39. data/lib/spec/mocks/methods.rb +1 -1
  40. data/lib/spec/mocks/mock.rb +1 -1
  41. data/lib/spec/mocks/proxy.rb +1 -1
  42. data/lib/spec/mocks/space.rb +1 -1
  43. data/lib/spec/mocks/spec_methods.rb +1 -1
  44. data/lib/spec/rake/verify_rcov.rb +1 -1
  45. data/lib/spec/runner/backtrace_tweaker.rb +1 -1
  46. data/lib/spec/runner/behaviour_runner.rb +1 -1
  47. data/lib/spec/runner/command_line.rb +1 -1
  48. data/lib/spec/runner/drb_command_line.rb +1 -1
  49. data/lib/spec/runner/formatter/failing_behaviours_formatter.rb +1 -1
  50. data/lib/spec/runner/formatter/failing_examples_formatter.rb +1 -1
  51. data/lib/spec/runner/formatter/progress_bar_formatter.rb +1 -1
  52. data/lib/spec/runner/formatter/rdoc_formatter.rb +1 -1
  53. data/lib/spec/runner/formatter/snippet_extractor.rb +1 -1
  54. data/lib/spec/runner/heckle_runner_unsupported.rb +10 -10
  55. data/lib/spec/runner/spec_parser.rb +1 -1
  56. data/lib/spec/test_case_adapter.rb +1 -1
  57. data/lib/spec/translator.rb +106 -106
  58. data/lib/spec/version.rb +22 -22
  59. data/spec/spec/dsl/behaviour_factory_spec.rb +1 -1
  60. data/spec/spec/dsl/configuration_spec.rb +1 -1
  61. data/spec/spec/dsl/description_spec.rb +1 -1
  62. data/spec/spec/dsl/predicate_matcher_spec.rb +1 -1
  63. data/spec/spec/dsl/shared_behaviour_spec.rb +19 -6
  64. data/spec/spec/matchers/description_generation_spec.rb +1 -1
  65. data/spec/spec/matchers/exist_spec.rb +1 -1
  66. data/spec/spec/matchers/handler_spec.rb +1 -1
  67. data/spec/spec/matchers/have_spec.rb +14 -1
  68. data/spec/spec/matchers/mock_constraint_matchers_spec.rb +1 -1
  69. data/spec/spec/matchers/respond_to_spec.rb +1 -1
  70. data/spec/spec/mocks/any_number_of_times_spec.rb +1 -1
  71. data/spec/spec/mocks/at_least_spec.rb +1 -1
  72. data/spec/spec/mocks/at_most_spec.rb +1 -1
  73. data/spec/spec/mocks/bug_report_7611_spec.rb +1 -1
  74. data/spec/spec/mocks/bug_report_7805_spec.rb +1 -1
  75. data/spec/spec/mocks/bug_report_8165_spec.rb +1 -1
  76. data/spec/spec/mocks/bug_report_8302_spec.rb +1 -1
  77. data/spec/spec/mocks/mock_ordering_spec.rb +1 -1
  78. data/spec/spec/mocks/once_counts_spec.rb +1 -1
  79. data/spec/spec/mocks/partial_mock_spec.rb +1 -1
  80. data/spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb +1 -1
  81. data/spec/spec/mocks/precise_counts_spec.rb +1 -1
  82. data/spec/spec/mocks/record_messages_spec.rb +1 -1
  83. data/spec/spec/mocks/stub_spec.rb +1 -1
  84. data/spec/spec/mocks/twice_counts_spec.rb +1 -1
  85. data/spec/spec/package/bin_spec_spec.rb +1 -1
  86. data/spec/spec/runner/context_matching_spec.rb +1 -1
  87. data/spec/spec/runner/example_matcher_spec.rb +1 -1
  88. data/spec/spec/runner/formatter/failing_behaviours_formatter_spec.rb +1 -1
  89. data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +1 -1
  90. data/spec/spec/runner/formatter/html_formatter_spec.rb +0 -2
  91. data/spec/spec/runner/formatter/progress_bar_formatter_dry_run_spec.rb +1 -1
  92. data/spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb +1 -1
  93. data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +1 -1
  94. data/spec/spec/runner/formatter/rdoc_formatter_dry_run_spec.rb +1 -1
  95. data/spec/spec/runner/formatter/rdoc_formatter_spec.rb +1 -1
  96. data/spec/spec/runner/formatter/snippet_extractor_spec.rb +1 -1
  97. data/spec/spec/runner/formatter/specdoc_formatter_dry_run_spec.rb +1 -1
  98. data/spec/spec/runner/heckle_runner_spec.rb +1 -1
  99. data/spec/spec/runner/heckler_spec.rb +1 -1
  100. data/spec/spec/runner/noisy_backtrace_tweaker_spec.rb +1 -1
  101. data/spec/spec/runner/quiet_backtrace_tweaker_spec.rb +1 -1
  102. data/spec/spec/runner/reporter_spec.rb +1 -1
  103. data/spec/spec/runner/spec_parser_spec.rb +1 -1
  104. data/spec/spec/translator_spec.rb +1 -1
  105. data/spec/spec_helper.rb +0 -29
  106. metadata +3 -4
  107. data/lib/autotest.rb +0 -1
data/CHANGES CHANGED
@@ -1,3 +1,15 @@
1
+ == Version 1.0.5
2
+ Bug fixes. Autotest plugin tweaks.
3
+
4
+ * Fixed [#11378] fix to 10814 broke drb
5
+ * Fixed [#11223] Unable to access flash from rails helper specs
6
+ * Fixed [#11337] autotest runs specs redundantly
7
+ * Fixed [#11258] windows: autotest won't run
8
+ * Applied [#11253] Tweaks to autotest file mappings (Patch from Wincent Colaiuta)
9
+ * Applied [#11252] Should be able to re-load file containing shared behaviours without raising an exception (Patch from Wincent Colaiuta)
10
+ * Fixed [#11247] standalone autotest doesn't work because of unneeded autotest.rb
11
+ * Applied [#11221] Autotest support does not work w/o Rails Gem installed (Patch from Josh Knowles)
12
+
1
13
  == Version 1.0.4
2
14
  The getting ready for JRuby release.
3
15
 
@@ -103,6 +103,6 @@
103
103
  # * RSpec should be able to access TestCase methods
104
104
  # * RSpec should be able to accept included modules
105
105
 
106
- Finished in 0.026702 seconds
106
+ Finished in 0.024612 seconds
107
107
 
108
108
  77 examples, 0 failures, 2 not implemented
data/Rakefile CHANGED
@@ -245,6 +245,7 @@ task :publish_packages => [:verify_user, :package] do
245
245
  release_files = FileList[
246
246
  "pkg/#{PKG_FILE_NAME}.gem",
247
247
  "pkg/#{PKG_FILE_NAME}.tgz",
248
+ "pkg/rspec_on_rails-#{PKG_VERSION}.tgz",
248
249
  "pkg/#{PKG_FILE_NAME}.zip",
249
250
  "pkg/RSpec-#{PKG_VERSION}.tmbundle.tgz",
250
251
  "../spec_ui/pkg/spec_ui-#{Spec::Ui::VERSION::STRING}.gem"
@@ -16,4 +16,4 @@ describe "Examples with no descriptions" do
16
16
 
17
17
  it { [1,2,3].should respond_to(:size) }
18
18
 
19
- end
19
+ end
@@ -36,4 +36,4 @@ describe "State created in before(:all)" do
36
36
  $global.should == 3
37
37
  $global = 0
38
38
  end
39
- end
39
+ end
@@ -42,4 +42,4 @@ module BehaveAsExample
42
42
  end
43
43
  end
44
44
 
45
- end
45
+ end
@@ -6,4 +6,4 @@ describe "Some integers" do
6
6
  Math.sqrt(n*n).should == n
7
7
  end
8
8
  end
9
- end
9
+ end
@@ -1,18 +1,18 @@
1
- class FileAccessor
2
- def open_and_handle_with(pathname, processor)
3
- pathname.open do |io|
4
- processor.process(io)
5
- end
6
- end
7
- end
8
-
9
- if __FILE__ == $0
10
- require File.dirname(__FILE__) + '/io_processor'
11
- require 'pathname'
12
-
13
- accessor = FileAccessor.new
14
- io_processor = IoProcessor.new
15
- file = Pathname.new ARGV[0]
16
-
17
- accessor.open_and_handle_with(file, io_processor)
18
- end
1
+ class FileAccessor
2
+ def open_and_handle_with(pathname, processor)
3
+ pathname.open do |io|
4
+ processor.process(io)
5
+ end
6
+ end
7
+ end
8
+
9
+ if __FILE__ == $0
10
+ require File.dirname(__FILE__) + '/io_processor'
11
+ require 'pathname'
12
+
13
+ accessor = FileAccessor.new
14
+ io_processor = IoProcessor.new
15
+ file = Pathname.new ARGV[0]
16
+
17
+ accessor.open_and_handle_with(file, io_processor)
18
+ end
@@ -1,38 +1,38 @@
1
- require File.dirname(__FILE__) + '/spec_helper'
2
- require File.dirname(__FILE__) + '/file_accessor'
3
- require 'stringio'
4
-
5
- describe "A FileAccessor" do
6
- # This sequence diagram illustrates what this spec specifies.
7
- #
8
- # +--------------+ +----------+ +-------------+
9
- # | FileAccessor | | Pathname | | IoProcessor |
10
- # +--------------+ +----------+ +-------------+
11
- # | | |
12
- # open_and_handle_with | | |
13
- # -------------------->| | open | |
14
- # | |--------------->| | |
15
- # | | io | | |
16
- # | |<...............| | |
17
- # | | | process(io) |
18
- # | |---------------------------------->| |
19
- # | | | | |
20
- # | |<..................................| |
21
- # | | |
22
- #
23
- it "should open a file and pass it to the processor's process method" do
24
- # This is the primary actor
25
- accessor = FileAccessor.new
26
-
27
- # These are the primary actor's neighbours, which we mock.
28
- file = mock "Pathname"
29
- io_processor = mock "IoProcessor"
30
-
31
- io = StringIO.new "whatever"
32
- file.should_receive(:open).and_yield io
33
- io_processor.should_receive(:process).with(io)
34
-
35
- accessor.open_and_handle_with(file, io_processor)
36
- end
37
-
38
- end
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+ require File.dirname(__FILE__) + '/file_accessor'
3
+ require 'stringio'
4
+
5
+ describe "A FileAccessor" do
6
+ # This sequence diagram illustrates what this spec specifies.
7
+ #
8
+ # +--------------+ +----------+ +-------------+
9
+ # | FileAccessor | | Pathname | | IoProcessor |
10
+ # +--------------+ +----------+ +-------------+
11
+ # | | |
12
+ # open_and_handle_with | | |
13
+ # -------------------->| | open | |
14
+ # | |--------------->| | |
15
+ # | | io | | |
16
+ # | |<...............| | |
17
+ # | | | process(io) |
18
+ # | |---------------------------------->| |
19
+ # | | | | |
20
+ # | |<..................................| |
21
+ # | | |
22
+ #
23
+ it "should open a file and pass it to the processor's process method" do
24
+ # This is the primary actor
25
+ accessor = FileAccessor.new
26
+
27
+ # These are the primary actor's neighbours, which we mock.
28
+ file = mock "Pathname"
29
+ io_processor = mock "IoProcessor"
30
+
31
+ io = StringIO.new "whatever"
32
+ file.should_receive(:open).and_yield io
33
+ io_processor.should_receive(:process).with(io)
34
+
35
+ accessor.open_and_handle_with(file, io_processor)
36
+ end
37
+
38
+ end
@@ -27,4 +27,4 @@ describe "Greeter" do
27
27
  # Uncomment the next line to make Heckle happy
28
28
  #greeter.greet.should == "Hi there!"
29
29
  end
30
- end
30
+ end
@@ -8,4 +8,4 @@ describe "a context with helper a method" do
8
8
  it "should make that method available to specs" do
9
9
  helper_method.should == "received call"
10
10
  end
11
- end
11
+ end
@@ -1,8 +1,8 @@
1
- class DataTooShort < StandardError; end
2
-
3
- class IoProcessor
4
- # Does some fancy stuff unless the length of +io+ is shorter than 32
5
- def process(io)
6
- raise DataTooShort if io.read.length < 32
7
- end
8
- end
1
+ class DataTooShort < StandardError; end
2
+
3
+ class IoProcessor
4
+ # Does some fancy stuff unless the length of +io+ is shorter than 32
5
+ def process(io)
6
+ raise DataTooShort if io.read.length < 32
7
+ end
8
+ end
@@ -18,4 +18,4 @@ describe "An IoProcessor" do
18
18
  @processor.process(StringIO.new("z"*31))
19
19
  }.should raise_error(DataTooShort)
20
20
  end
21
- end
21
+ end
@@ -7,4 +7,4 @@ context "A legacy spec" do
7
7
 
8
8
  teardown do
9
9
  end
10
- end
10
+ end
@@ -9,4 +9,4 @@ describe Stack, ' (not implemented features)' do
9
9
  it "should transform to xml using #to_xml"
10
10
 
11
11
  it "should convert from xml using #from_xml"
12
- end
12
+ end
@@ -25,4 +25,4 @@ describe "A partial mock" do
25
25
  MockableClass.msg_2
26
26
  MockableClass.msg_3
27
27
  end
28
- end
28
+ end
@@ -24,4 +24,4 @@ describe "BDD framework" do
24
24
  @bdd_framework.should be_intuitive
25
25
  end
26
26
 
27
- end
27
+ end
@@ -33,4 +33,4 @@ class Stack
33
33
  @items.length == 10
34
34
  end
35
35
 
36
- end
36
+ end
@@ -94,4 +94,4 @@ describe Stack, " (full)" do
94
94
  lambda { @stack.push Object.new }.should raise_error(StackOverflowError)
95
95
  end
96
96
 
97
- end
97
+ end
@@ -66,4 +66,4 @@ describe "A mock" do
66
66
  end
67
67
  end
68
68
 
69
-
69
+
@@ -23,4 +23,4 @@ class IntegratingRSpecExpectationsIntoTestCaseTest < Test::Unit::TestCase
23
23
  def test_should_support_rspecs_collection_expectations
24
24
  Band.new.should have(4).players
25
25
  end
26
- end
26
+ end
@@ -1,3 +1,3 @@
1
1
  Autotest.add_discovery do
2
2
  "rspec" if File.exist?('spec')
3
- end
3
+ end
@@ -6,12 +6,15 @@ class Autotest::Rspec < Autotest
6
6
  super
7
7
  @spec_command = "spec"
8
8
  @test_mappings = {
9
- %r%^spec/.*rb$% => proc { |filename, _|
9
+ %r%^spec/.*\.rb$% => proc { |filename, _|
10
10
  filename
11
11
  },
12
12
  %r%^lib/(.*)\.rb$% => proc { |_, m|
13
13
  ["spec/#{m[1]}_spec.rb"]
14
14
  },
15
+ %r%^spec/(spec_helper|shared/.*)\.rb$% => proc {
16
+ files_matching %r%^spec/.*_spec\.rb$%
17
+ },
15
18
  }
16
19
  end
17
20
 
@@ -44,25 +47,21 @@ class Autotest::Rspec < Autotest
44
47
  end
45
48
 
46
49
  def make_test_cmd(files_to_test)
47
- cmds = []
48
- full, partial = files_to_test.partition { |k,v| v.empty? }
49
-
50
- unless full.empty? then
51
- files = full.map {|k,v| k}.flatten.join(' ')
52
- cmds << "#{@spec_command} #{add_options_if_present}#{files}"
53
- end
54
-
55
- partial.each do |f, methods|
56
- cmds.push(*methods.map { |meth|
57
- "#{@spec_command} #{add_options_if_present} #{f}"
58
- })
59
- end
60
-
61
- return cmds.join('; ')
50
+ return "#{ruby} -S #{@spec_command} #{add_options_if_present} #{files_to_test.keys.flatten.join(' ')}"
62
51
  end
63
52
 
64
53
  def add_options_if_present
65
54
  File.exist?("spec/spec.opts") ? "-O spec/spec.opts " : ""
66
55
  end
67
56
 
57
+ def spec_command
58
+ spec = File.join(Config::CONFIG['bindir'], 'spec')
59
+
60
+ unless File::ALT_SEPARATOR.nil? then
61
+ spec.gsub! File::SEPARATOR, File::ALT_SEPARATOR
62
+ end
63
+
64
+ return spec
65
+ end
66
+
68
67
  end
@@ -10,4 +10,4 @@ class Object
10
10
  def metaclass
11
11
  class << self; self; end
12
12
  end
13
- end
13
+ end
@@ -7,6 +7,7 @@ module Spec
7
7
  class << self
8
8
  def add_shared_behaviour(behaviour)
9
9
  return if behaviour.equal?(found_behaviour = find_shared_behaviour(behaviour.description))
10
+ return if found_behaviour and behaviour.description[:spec_path] == found_behaviour.description[:spec_path]
10
11
  raise ArgumentError.new("Shared Behaviour '#{behaviour.description}' already exists") if found_behaviour
11
12
  shared_behaviours << behaviour
12
13
  end
@@ -116,4 +116,4 @@ module Spec
116
116
 
117
117
  end
118
118
  end
119
- end
119
+ end
@@ -66,4 +66,4 @@ module Spec
66
66
 
67
67
  end
68
68
  end
69
- end
69
+ end
@@ -53,4 +53,4 @@ module Spec
53
53
  end
54
54
  end
55
55
  end
56
- end
56
+ end
@@ -14,4 +14,4 @@ end
14
14
 
15
15
  class Symbol
16
16
  include Spec::Expectations::StringHelpers
17
- end
17
+ end
@@ -3,4 +3,4 @@ class Object
3
3
  options = Hash === args.last ? args.pop : {}
4
4
  return args, options
5
5
  end
6
- end
6
+ end
@@ -163,4 +163,4 @@ module Spec
163
163
  end
164
164
 
165
165
  end
166
- end
166
+ end
@@ -34,4 +34,4 @@ module Spec
34
34
  Matchers::BeClose.new(expected, delta)
35
35
  end
36
36
  end
37
- end
37
+ end
@@ -40,4 +40,4 @@ module Spec
40
40
  Matchers::Eql.new(expected)
41
41
  end
42
42
  end
43
- end
43
+ end
@@ -40,4 +40,4 @@ module Spec
40
40
  Matchers::Equal.new(expected)
41
41
  end
42
42
  end
43
- end
43
+ end
@@ -30,12 +30,17 @@ module Spec
30
30
  else
31
31
  collection_owner.send(collection_name, *@args, &@block)
32
32
  end
33
- @actual = collection.length if collection.respond_to?(:length)
34
33
  @actual = collection.size if collection.respond_to?(:size)
34
+ @actual = collection.length if collection.respond_to?(:length)
35
+ raise not_a_collection if @actual.nil?
35
36
  return @actual >= @expected if @relativity == :at_least
36
37
  return @actual <= @expected if @relativity == :at_most
37
38
  return @actual == @expected
38
39
  end
40
+
41
+ def not_a_collection
42
+ "expected #{@collection_name} to be a collection but it does not respond to #length or #size"
43
+ end
39
44
 
40
45
  def failure_message
41
46
  "expected #{relative_expectation} #{collection_name}, got #{@actual}"
@@ -137,4 +142,4 @@ EOF
137
142
  Matchers::Have.new(n, :at_most)
138
143
  end
139
144
  end
140
- end
145
+ end
@@ -205,4 +205,4 @@ module Spec
205
205
  # my_mock.should_receive(:<<).with("illegal value").once.and_raise(ArgumentError)
206
206
  module Mocks
207
207
  end
208
- end
208
+ end
@@ -24,4 +24,4 @@ module Spec
24
24
  end
25
25
  end
26
26
  end
27
- end
27
+ end