rspec 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,15 @@
1
1
  = RSpec Changelog
2
2
 
3
+ == Version 0.6.3
4
+
5
+ This release fixes some minor bugs related to RSpec on Rails
6
+ Note that if you upgrade a rails app with this version of the rspec_on_rails plugin
7
+ you should remove your lib/tasks/rspec.rake if it exists.
8
+
9
+ * Backtraces from drb (and other standard ruby libraries) are now stripped from backtraces.
10
+ * Applied [#5557] Put rspec.rake into the task directory of the RSpec on Rails plugin (Patch from Daniel Siemssen)
11
+ * Applied [#5556] rails_spec_runner loads environment.rb twice (Patch from Daniel Siemssen)
12
+
3
13
  == Version 0.6.2
4
14
  This release fixes a couple of regressions with the rake task that were introduced in the previous version (0.6.1)
5
15
 
@@ -16,28 +16,29 @@
16
16
  # * should raise an exception when the file length is less than 32 bytes
17
17
  # A consumer of a mock
18
18
  # * should be able to send messages to the mock
19
+ # A stack (in general)
20
+ # * should add to the top when sent 'push'
21
+ # * should return the top item when sent 'peek'
22
+ # * should NOT remove the top item when sent 'peek'
23
+ # * should return the top item when sent 'pop'
24
+ # * should remove the top item when sent 'pop'
19
25
  # An empty stack
20
- # * should accept an item when sent push
21
- # * should complain when sent top
22
- # * should complain when sent pop
23
- # A stack with one item
24
- # * should accept an item when sent push
25
- # * should return top when sent top
26
- # * should not remove top when sent top
27
- # * should return top when sent pop
28
- # * should remove top when sent pop
26
+ # * should be empty
27
+ # * should no longer be empty after 'push'
28
+ # * should complain when sent 'peek'
29
+ # * should complain when sent 'pop'
30
+ # An almost empty stack (with one item)
31
+ # * should not be empty
32
+ # * should remain not empty after 'peek'
33
+ # * should become empty after 'pop'
29
34
  # An almost full stack (with one item less than capacity)
30
- # * should accept an item when sent push
31
- # * should return top when sent top
32
- # * should not remove top when sent top
33
- # * should return top when sent pop
34
- # * should remove top when sent pop
35
+ # * should not be full
36
+ # * should become full when sent 'push'
35
37
  # A full stack
36
- # * should complain on push
37
- # * should return top when sent top
38
- # * should not remove top when sent top
39
- # * should return top when sent pop
40
- # * should remove top when sent pop
38
+ # * should be full
39
+ # * should remain full after 'peek'
40
+ # * should no longer be full after 'pop'
41
+ # * should complain on 'push'
41
42
  # Underscore sugar
42
43
  # * should be available for regular objects
43
44
  # * should be available for mocks
@@ -20,7 +20,7 @@ class Stack
20
20
  @items.delete @items.last
21
21
  end
22
22
 
23
- def top
23
+ def peek
24
24
  raise StackUnderflowError if @items.empty?
25
25
  @items.last
26
26
  end
@@ -28,9 +28,9 @@ class Stack
28
28
  def empty?
29
29
  @items.empty?
30
30
  end
31
-
32
- def size
33
- @items.length
31
+
32
+ def full?
33
+ @items.length == 10
34
34
  end
35
35
 
36
36
  end
@@ -1,115 +1,117 @@
1
1
  require File.dirname(__FILE__) + '/../lib/spec'
2
2
  require File.dirname(__FILE__) + "/stack"
3
3
 
4
- context "An empty stack" do
5
-
4
+ context "A stack (in general)" do
6
5
  setup do
7
6
  @stack = Stack.new
7
+ ["a","b","c"].each { |x| @stack.push x }
8
8
  end
9
9
 
10
- specify "should accept an item when sent push" do
11
- lambda { @stack.push Object.new }.should_not_raise
10
+ specify "should add to the top when sent 'push'" do
11
+ @stack.push "d"
12
+ @stack.peek.should_equal "d"
12
13
  end
13
14
 
14
- specify "should complain when sent top" do
15
- lambda { @stack.top }.should_raise StackUnderflowError
15
+ specify "should return the top item when sent 'peek'" do
16
+ @stack.peek.should_equal "c"
16
17
  end
17
18
 
18
- specify "should complain when sent pop" do
19
- lambda { @stack.pop }.should_raise StackUnderflowError
19
+ specify "should NOT remove the top item when sent 'peek'" do
20
+ @stack.peek.should_equal "c"
21
+ @stack.peek.should_equal "c"
22
+ end
23
+
24
+ specify "should return the top item when sent 'pop'" do
25
+ @stack.pop.should_equal "c"
20
26
  end
21
27
 
28
+ specify "should remove the top item when sent 'pop'" do
29
+ @stack.pop.should_equal "c"
30
+ @stack.pop.should_equal "b"
31
+ end
22
32
  end
23
33
 
24
- context "A stack with one item" do
25
-
34
+ context "An empty stack" do
26
35
  setup do
27
36
  @stack = Stack.new
28
- @stack.push 3
29
- end
30
-
31
- specify "should accept an item when sent push" do
32
- lambda { @stack.push Object.new }.should_not_raise
33
37
  end
34
38
 
35
- specify "should return top when sent top" do
36
- @stack.top.should_be 3
39
+ specify "should be empty" do
40
+ @stack.should_be_empty
37
41
  end
38
42
 
39
- specify "should not remove top when sent top" do
40
- @stack.top.should_be 3
41
- @stack.top.should_be 3
43
+ specify "should no longer be empty after 'push'" do
44
+ @stack.push "anything"
45
+ @stack.should_not_be_empty
42
46
  end
43
47
 
44
- specify "should return top when sent pop" do
45
- @stack.pop.should_be 3
48
+ specify "should complain when sent 'peek'" do
49
+ lambda { @stack.peek }.should_raise StackUnderflowError
46
50
  end
47
51
 
48
- specify "should remove top when sent pop" do
49
- @stack.pop.should_be 3
52
+ specify "should complain when sent 'pop'" do
50
53
  lambda { @stack.pop }.should_raise StackUnderflowError
51
54
  end
52
-
53
55
  end
54
56
 
55
- context "An almost full stack (with one item less than capacity)" do
56
-
57
+ context "An almost empty stack (with one item)" do
57
58
  setup do
58
59
  @stack = Stack.new
59
- (1..9).each { |i| @stack.push i }
60
- end
61
-
62
- specify "should accept an item when sent push" do
63
- @stack.push Object.new
60
+ @stack.push 3
64
61
  end
65
62
 
66
- specify "should return top when sent top" do
67
- @stack.top.should_be 9
63
+ specify "should not be empty" do
64
+ @stack.should_not_be_empty
68
65
  end
69
66
 
70
- specify "should not remove top when sent top" do
71
- @stack.top.should_be 9
72
- @stack.top.should_be 9
67
+ specify "should remain not empty after 'peek'" do
68
+ @stack.peek
69
+ @stack.should_not_be_empty
73
70
  end
74
71
 
75
- specify "should return top when sent pop" do
76
- @stack.pop.should_be 9
72
+ specify "should become empty after 'pop'" do
73
+ @stack.pop
74
+ @stack.should_be_empty
75
+ end
76
+ end
77
+
78
+ context "An almost full stack (with one item less than capacity)" do
79
+ setup do
80
+ @stack = Stack.new
81
+ (1..9).each { |i| @stack.push i }
77
82
  end
78
83
 
79
- specify "should remove top when sent pop" do
80
- @stack.pop.should_be 9
81
- @stack.pop.should_be 8
84
+ specify "should not be full" do
85
+ @stack.should_not_be_full
82
86
  end
83
87
 
88
+ specify "should become full when sent 'push'" do
89
+ @stack.push Object.new
90
+ @stack.should_be_full
91
+ end
84
92
  end
85
93
 
86
94
  context "A full stack" do
87
-
88
95
  setup do
89
96
  @stack = Stack.new
90
97
  (1..10).each { |i| @stack.push i }
91
98
  end
92
-
93
- specify "should complain on push" do
94
- lambda { @stack.push Object.new }.should_raise StackOverflowError
95
- end
96
99
 
97
- specify "should return top when sent top" do
98
- @stack.top.should_be 10
100
+ specify "should be full" do
101
+ @stack.should_be_full
99
102
  end
100
103
 
101
- specify "should not remove top when sent top" do
102
- @stack.top.should_be 10
103
- @stack.top.should_be 10
104
+ specify "should remain full after 'peek'" do
105
+ @stack.peek
106
+ @stack.should_be_full
104
107
  end
105
108
 
106
- specify "should return top when sent pop" do
107
- @stack.pop.should_be 10
109
+ specify "should no longer be full after 'pop'" do
110
+ @stack.pop
111
+ @stack.should_not_be_full
108
112
  end
109
-
110
- specify "should remove top when sent pop" do
111
- @stack.pop.should_be 10
112
- @stack.pop.should_be 9
113
+
114
+ specify "should complain on 'push'" do
115
+ lambda { @stack.push Object.new }.should_raise StackOverflowError
113
116
  end
114
-
115
117
  end
@@ -4,6 +4,7 @@ module Spec
4
4
 
5
5
  def initialize(target)
6
6
  @target = target
7
+ @be_seen = false
7
8
  end
8
9
 
9
10
  def not
@@ -4,6 +4,7 @@ module Spec
4
4
 
5
5
  def initialize(target)
6
6
  @target = target
7
+ @be_seen = false
7
8
  end
8
9
 
9
10
  def satisfy
@@ -62,7 +62,7 @@ module Spec
62
62
 
63
63
  def handle_order_constraint
64
64
  return unless @ordered
65
- return @ordering.consume(@self) if @ordering.ready_for?(self)
65
+ return @ordering.consume(self) if @ordering.ready_for?(self)
66
66
  message = "Mock '#{@mock_name}' received '#{@sym}' out of order"
67
67
  Kernel::raise(Spec::Api::MockExpectationError, message)
68
68
  end
@@ -24,13 +24,14 @@ module Spec
24
24
  return if error.backtrace.nil?
25
25
  error.backtrace.collect! do |line|
26
26
  line = tweak_instance_exec_line line, spec_name
27
+ line = nil if line =~ /\/lib\/ruby\//
27
28
  line = nil if line =~ /\/lib\/spec\/api\//
28
29
  line = nil if line =~ /\/lib\/spec\/runner\//
29
30
  line = nil if line =~ /bin\/spec:/
31
+ line = nil if line =~ /lib\/rspec_on_rails/
32
+ line = nil if line =~ /script\/rails_spec/
30
33
  # TextMate's Ruby plugin
31
34
  line = nil if line =~ /Ruby\.tmbundle\/Support\/tmruby.rb:/
32
- # RSpec on Rails
33
- line = nil if line =~ /gems\/rspec_generator/
34
35
  line
35
36
  end
36
37
  error.backtrace.compact!
@@ -8,6 +8,8 @@ module Spec
8
8
  @failures = []
9
9
  @spec_names = []
10
10
  @backtrace_tweaker = backtrace_tweaker
11
+ @start_time = nil
12
+ @end_time = nil
11
13
  end
12
14
 
13
15
  def add_context(name)
@@ -3,7 +3,7 @@ module Spec
3
3
  unless defined? MAJOR
4
4
  MAJOR = 0
5
5
  MINOR = 6
6
- TINY = 2
6
+ TINY = 3
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
9
9
  TAG = "REL_" + [MAJOR, MINOR, TINY].join('_')
metadata CHANGED
@@ -3,9 +3,9 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: rspec
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.6.2
7
- date: 2006-08-26 00:00:00 +02:00
8
- summary: RSpec-0.6.2 - BDD for Ruby http://rspec.rubyforge.org/
6
+ version: 0.6.3
7
+ date: 2006-08-29 00:00:00 +02:00
8
+ summary: RSpec-0.6.3 - BDD for Ruby http://rspec.rubyforge.org/
9
9
  require_paths:
10
10
  - lib
11
11
  email: rspec-devel@rubyforge.org