rspec-rails 1.1.7 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,14 @@
1
+ === Version 1.1.8 / 2008-10-03
2
+
3
+ * 2 bug fixes
4
+
5
+ * correctly handle assigns that are false. Fixes #552.
6
+ * ensure that NotYetImplemented examples report as pending (fixed in rspec, not rspec-rails). Fixes #553.
7
+
1
8
  === Version 1.1.7 / 2008-10-02
2
9
 
3
10
  * 1 bug fix
11
+
4
12
  * depend on the correct version of rspec
5
13
 
6
14
  === Version 1.1.6 / 2008-10-02
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ Hoe.new('rspec-rails', Spec::Rails::VERSION::STRING) do |p|
15
15
  p.description = "Behaviour Driven Development for Ruby on Rails."
16
16
  p.rubyforge_name = 'rspec'
17
17
  p.developer('RSpec Development Team', 'rspec-devel@rubyforge.org')
18
- p.extra_deps = [["rspec","1.1.7"]]
18
+ p.extra_deps = [["rspec","1.1.8"]]
19
19
  end
20
20
 
21
21
  ['audit','test','test_deps','default','publish_docs','post_blog', 'release'].each do |task|
@@ -8,6 +8,8 @@ module Spec
8
8
  end
9
9
 
10
10
  def [](key)
11
+ return false if assigns[key] == false
12
+ return false if assigns[key.to_s] == false
11
13
  assigns[key] || assigns[key.to_s] || @target.instance_variable_get("@#{key}")
12
14
  end
13
15
 
@@ -17,6 +19,7 @@ module Spec
17
19
 
18
20
  def delete(key)
19
21
  assigns.delete(key.to_s)
22
+ @target.instance_variable_set("@#{key}", nil)
20
23
  end
21
24
 
22
25
  def each(&block)
@@ -4,7 +4,7 @@ module Spec
4
4
  unless defined? MAJOR
5
5
  MAJOR = 1
6
6
  MINOR = 1
7
- TINY = 7
7
+ TINY = 8
8
8
 
9
9
  STRING = [MAJOR, MINOR, TINY].join('.')
10
10
 
@@ -27,7 +27,7 @@ describe "AssignsHashProxy" do
27
27
 
28
28
  it "should access object's assigns with a string" do
29
29
  @object.assigns['foo'] = 'bar'
30
- @proxy[:foo].should == 'bar'
30
+ @proxy['foo'].should == 'bar'
31
31
  end
32
32
 
33
33
  it "should access object's assigns with a symbol" do
@@ -35,7 +35,17 @@ describe "AssignsHashProxy" do
35
35
  @proxy[:foo].should == 'bar'
36
36
  end
37
37
 
38
- it "iterates through each element like a Hash" do
38
+ it "should access object's ivars with a string" do
39
+ @object.instance_variable_set('@foo', 'bar')
40
+ @proxy['foo'].should == 'bar'
41
+ end
42
+
43
+ it "should access object's ivars with a symbol" do
44
+ @object.instance_variable_set('@foo', 'bar')
45
+ @proxy[:foo].should == 'bar'
46
+ end
47
+
48
+ it "should iterate through each element like a Hash" do
39
49
  values = {
40
50
  'foo' => 1,
41
51
  'bar' => 2,
@@ -51,20 +61,36 @@ describe "AssignsHashProxy" do
51
61
  end
52
62
  end
53
63
 
54
- it "deletes the element of passed in key" do
64
+ it "should delete the ivar of passed in key" do
65
+ @object.instance_variable_set('@foo', 'bar')
66
+ @proxy.delete('foo')
67
+ @proxy['foo'].should be_nil
68
+ end
69
+
70
+ it "should delete the assigned element of passed in key" do
55
71
  @object.assigns['foo'] = 'bar'
56
- @proxy.delete('foo').should == 'bar'
72
+ @proxy.delete('foo')
57
73
  @proxy['foo'].should be_nil
58
74
  end
59
75
 
60
- it "detects the presence of a key" do
76
+ it "should detect the presence of a key in assigns" do
61
77
  @object.assigns['foo'] = 'bar'
62
78
  @proxy.has_key?('foo').should == true
63
79
  @proxy.has_key?('bar').should == false
64
80
  end
65
81
 
66
- it "should expose values set in example" do
82
+ it "should expose values set in example back to the example" do
67
83
  @proxy[:foo] = 'bar'
68
84
  @proxy[:foo].should == 'bar'
69
85
  end
86
+
87
+ it "should allow assignment of false via proxy" do
88
+ @proxy['foo'] = false
89
+ @proxy['foo'].should be_false
90
+ end
91
+
92
+ it "should allow assignment of false" do
93
+ @object.instance_variable_set('@foo',false)
94
+ @proxy['foo'].should be_false
95
+ end
70
96
  end
@@ -6,6 +6,8 @@ require 'controller_spec_controller'
6
6
  controller_name :controller_spec
7
7
  integrate_views if mode == 'integration'
8
8
 
9
+ specify "this example should be pending, not an error"
10
+
9
11
  it "should provide controller.session as session" do
10
12
  get 'action_with_template'
11
13
  session.should equal(controller.session)
@@ -173,6 +175,11 @@ require 'controller_spec_controller'
173
175
  assigns[:indirect_assigns_key].should == :indirect_assigns_key_value
174
176
  end
175
177
 
178
+ it "should expose instance vars through the assigns hash that are set to false" do
179
+ get 'action_that_assigns_false_to_a_variable'
180
+ assigns[:a_variable].should be_false
181
+ end
182
+
176
183
  it "should NOT complain when calling should_receive with arguments other than :render" do
177
184
  controller.should_receive(:anything_besides_render)
178
185
  lambda {
@@ -85,6 +85,11 @@ class ControllerSpecController < ActionController::Base
85
85
  def action_with_skipped_before_filter
86
86
  render :text => ""
87
87
  end
88
+
89
+ def action_that_assigns_false_to_a_variable
90
+ @a_variable = false
91
+ render :text => ""
92
+ end
88
93
  end
89
94
 
90
95
  class ControllerInheritingFromApplicationControllerController < ApplicationController
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - RSpec Development Team
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-02 00:00:00 -05:00
12
+ date: 2008-10-03 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.1.7
23
+ version: 1.1.8
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: hoe
@@ -229,6 +229,6 @@ rubyforge_project: rspec
229
229
  rubygems_version: 1.3.0
230
230
  signing_key:
231
231
  specification_version: 2
232
- summary: rspec-rails 1.1.7
232
+ summary: rspec-rails 1.1.8
233
233
  test_files: []
234
234