rspec 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +12 -0
- data/EXAMPLES.rd +1 -1
- data/Rakefile +1 -0
- data/examples/auto_spec_description_example.rb +1 -1
- data/examples/before_and_after_example.rb +1 -1
- data/examples/behave_as_example.rb +1 -1
- data/examples/dynamic_spec.rb +1 -1
- data/examples/file_accessor.rb +18 -18
- data/examples/file_accessor_spec.rb +38 -38
- data/examples/greeter_spec.rb +1 -1
- data/examples/helper_method_example.rb +1 -1
- data/examples/io_processor.rb +8 -8
- data/examples/io_processor_spec.rb +1 -1
- data/examples/legacy_spec.rb +1 -1
- data/examples/not_yet_implemented_spec.rb +1 -1
- data/examples/partial_mock_example.rb +1 -1
- data/examples/predicate_example.rb +1 -1
- data/examples/stack.rb +1 -1
- data/examples/stack_spec.rb +1 -1
- data/examples/stubbing_example.rb +1 -1
- data/examples/test_case_adapter_example.rb +1 -1
- data/lib/autotest/discover.rb +1 -1
- data/lib/autotest/rspec.rb +15 -16
- data/lib/spec.rb +1 -1
- data/lib/spec/dsl/behaviour.rb +1 -0
- data/lib/spec/dsl/configuration.rb +1 -1
- data/lib/spec/dsl/description.rb +1 -1
- data/lib/spec/expectations.rb +1 -1
- data/lib/spec/expectations/extensions/string_and_symbol.rb +1 -1
- data/lib/spec/extensions/object.rb +1 -1
- data/lib/spec/matchers.rb +1 -1
- data/lib/spec/matchers/be_close.rb +1 -1
- data/lib/spec/matchers/eql.rb +1 -1
- data/lib/spec/matchers/equal.rb +1 -1
- data/lib/spec/matchers/have.rb +7 -2
- data/lib/spec/mocks.rb +1 -1
- data/lib/spec/mocks/argument_constraint_matchers.rb +1 -1
- data/lib/spec/mocks/error_generator.rb +1 -1
- data/lib/spec/mocks/methods.rb +1 -1
- data/lib/spec/mocks/mock.rb +1 -1
- data/lib/spec/mocks/proxy.rb +1 -1
- data/lib/spec/mocks/space.rb +1 -1
- data/lib/spec/mocks/spec_methods.rb +1 -1
- data/lib/spec/rake/verify_rcov.rb +1 -1
- data/lib/spec/runner/backtrace_tweaker.rb +1 -1
- data/lib/spec/runner/behaviour_runner.rb +1 -1
- data/lib/spec/runner/command_line.rb +1 -1
- data/lib/spec/runner/drb_command_line.rb +1 -1
- data/lib/spec/runner/formatter/failing_behaviours_formatter.rb +1 -1
- data/lib/spec/runner/formatter/failing_examples_formatter.rb +1 -1
- data/lib/spec/runner/formatter/progress_bar_formatter.rb +1 -1
- data/lib/spec/runner/formatter/rdoc_formatter.rb +1 -1
- data/lib/spec/runner/formatter/snippet_extractor.rb +1 -1
- data/lib/spec/runner/heckle_runner_unsupported.rb +10 -10
- data/lib/spec/runner/spec_parser.rb +1 -1
- data/lib/spec/test_case_adapter.rb +1 -1
- data/lib/spec/translator.rb +106 -106
- data/lib/spec/version.rb +22 -22
- data/spec/spec/dsl/behaviour_factory_spec.rb +1 -1
- data/spec/spec/dsl/configuration_spec.rb +1 -1
- data/spec/spec/dsl/description_spec.rb +1 -1
- data/spec/spec/dsl/predicate_matcher_spec.rb +1 -1
- data/spec/spec/dsl/shared_behaviour_spec.rb +19 -6
- data/spec/spec/matchers/description_generation_spec.rb +1 -1
- data/spec/spec/matchers/exist_spec.rb +1 -1
- data/spec/spec/matchers/handler_spec.rb +1 -1
- data/spec/spec/matchers/have_spec.rb +14 -1
- data/spec/spec/matchers/mock_constraint_matchers_spec.rb +1 -1
- data/spec/spec/matchers/respond_to_spec.rb +1 -1
- data/spec/spec/mocks/any_number_of_times_spec.rb +1 -1
- data/spec/spec/mocks/at_least_spec.rb +1 -1
- data/spec/spec/mocks/at_most_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_7611_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_7805_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_8165_spec.rb +1 -1
- data/spec/spec/mocks/bug_report_8302_spec.rb +1 -1
- data/spec/spec/mocks/mock_ordering_spec.rb +1 -1
- data/spec/spec/mocks/once_counts_spec.rb +1 -1
- data/spec/spec/mocks/partial_mock_spec.rb +1 -1
- data/spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb +1 -1
- data/spec/spec/mocks/precise_counts_spec.rb +1 -1
- data/spec/spec/mocks/record_messages_spec.rb +1 -1
- data/spec/spec/mocks/stub_spec.rb +1 -1
- data/spec/spec/mocks/twice_counts_spec.rb +1 -1
- data/spec/spec/package/bin_spec_spec.rb +1 -1
- data/spec/spec/runner/context_matching_spec.rb +1 -1
- data/spec/spec/runner/example_matcher_spec.rb +1 -1
- data/spec/spec/runner/formatter/failing_behaviours_formatter_spec.rb +1 -1
- data/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +1 -1
- data/spec/spec/runner/formatter/html_formatter_spec.rb +0 -2
- data/spec/spec/runner/formatter/progress_bar_formatter_dry_run_spec.rb +1 -1
- data/spec/spec/runner/formatter/progress_bar_formatter_failure_dump_spec.rb +1 -1
- data/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +1 -1
- data/spec/spec/runner/formatter/rdoc_formatter_dry_run_spec.rb +1 -1
- data/spec/spec/runner/formatter/rdoc_formatter_spec.rb +1 -1
- data/spec/spec/runner/formatter/snippet_extractor_spec.rb +1 -1
- data/spec/spec/runner/formatter/specdoc_formatter_dry_run_spec.rb +1 -1
- data/spec/spec/runner/heckle_runner_spec.rb +1 -1
- data/spec/spec/runner/heckler_spec.rb +1 -1
- data/spec/spec/runner/noisy_backtrace_tweaker_spec.rb +1 -1
- data/spec/spec/runner/quiet_backtrace_tweaker_spec.rb +1 -1
- data/spec/spec/runner/reporter_spec.rb +1 -1
- data/spec/spec/runner/spec_parser_spec.rb +1 -1
- data/spec/spec/translator_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -29
- metadata +3 -4
- 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
|
|
data/EXAMPLES.rd
CHANGED
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"
|
data/examples/dynamic_spec.rb
CHANGED
data/examples/file_accessor.rb
CHANGED
@@ -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
|
data/examples/greeter_spec.rb
CHANGED
data/examples/io_processor.rb
CHANGED
@@ -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
|
data/examples/legacy_spec.rb
CHANGED
data/examples/stack.rb
CHANGED
data/examples/stack_spec.rb
CHANGED
data/lib/autotest/discover.rb
CHANGED
data/lib/autotest/rspec.rb
CHANGED
@@ -6,12 +6,15 @@ class Autotest::Rspec < Autotest
|
|
6
6
|
super
|
7
7
|
@spec_command = "spec"
|
8
8
|
@test_mappings = {
|
9
|
-
%r%^spec
|
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
|
-
|
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
|
data/lib/spec.rb
CHANGED
data/lib/spec/dsl/behaviour.rb
CHANGED
@@ -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
|
data/lib/spec/dsl/description.rb
CHANGED
data/lib/spec/expectations.rb
CHANGED
data/lib/spec/matchers.rb
CHANGED
data/lib/spec/matchers/eql.rb
CHANGED
data/lib/spec/matchers/equal.rb
CHANGED
data/lib/spec/matchers/have.rb
CHANGED
@@ -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
|
data/lib/spec/mocks.rb
CHANGED