rspec-cells 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.textile CHANGED
@@ -1,3 +1,7 @@
1
+ h2. 0.1.1
2
+
3
+ * Fixed indentation in generator. Thanks to Richard Huang [flyerhzm].
4
+
1
5
  h2. 0.1.0
2
6
 
3
7
  h3. Changes
@@ -16,7 +16,7 @@ describe <%= class_name %>Cell do
16
16
  context "cell instance" do
17
17
  subject { cell(:<%= file_name %>) }
18
18
  <% for state in actions %>
19
- it { should respond_to(:<%= state %>) }
19
+ it { should respond_to(:<%= state %>) }
20
20
  <% end %>
21
21
  end
22
22
  end
@@ -1,6 +1,6 @@
1
1
  module RSpec # :nodoc:
2
2
  module Cells # :nodoc:
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
6
6
 
@@ -6,6 +6,7 @@ module RSpec::Rails
6
6
 
7
7
  include RSpec::Rails::RailsExampleGroup
8
8
  include Cell::TestCase::TestMethods
9
+ include ActionController::UrlFor
9
10
 
10
11
  if defined?(Webrat)
11
12
  include Webrat::Matchers
@@ -40,6 +41,15 @@ module RSpec::Rails
40
41
 
41
42
  module InstanceMethods
42
43
  attr_reader :controller, :routes
44
+
45
+ def method_missing(method, *args, &block)
46
+ # Send the route helpers to the application router.
47
+ if @routes && @routes.named_routes.helpers.include?(method)
48
+ @controller.send(method, *args, &block)
49
+ else
50
+ super
51
+ end
52
+ end
43
53
  end
44
54
 
45
55
  included do
@@ -5,7 +5,7 @@ class DummyCell < Cell::Base
5
5
  def show
6
6
  "I'm Dummy."
7
7
  end
8
-
8
+
9
9
  def update(what)
10
10
  "Updating #{what}."
11
11
  end
@@ -24,19 +24,38 @@ module RSpec::Rails
24
24
  it "adds :type => :cell to the metadata" do
25
25
  group.metadata[:type].should eq(:cell)
26
26
  end
27
-
27
+
28
28
  describe "#render_cell" do
29
29
  it "renders a state" do
30
30
  group.new.render_cell(:dummy, :show).should == "I'm Dummy."
31
31
  end
32
-
32
+
33
33
  it "allows passing state args" do
34
34
  group.new.render_cell(:dummy, :update, "this").should == "Updating this."
35
35
  end
36
36
  end
37
-
37
+
38
38
  it "responds to #cell" do
39
39
  group.new.cell(:dummy).should be_kind_of(DummyCell)
40
40
  end
41
+
42
+ context "as a test writer" do
43
+ include CellExampleGroup
44
+
45
+ it "should support _path helpers from the controller" do
46
+ # We have to stub include so that things determine the route exists.
47
+ Rails.application.routes.named_routes.helpers.stub(:include?).and_return(:true)
48
+ @controller.should_receive(:test_path).at_least(:once)
49
+ test_path
50
+ end
51
+
52
+ it "should support polymorphic_path from the controller" do
53
+ # We have to stub include so that things determine the route exists.
54
+ Rails.application.routes.named_routes.helpers.stub(:include?).and_return(:true)
55
+ @controller.should_receive(:test_path).at_least(:once)
56
+ polymorphic_path(:test)
57
+ end
58
+
59
+ end
41
60
  end
42
61
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nick Sutterer
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-10-04 00:00:00 +02:00
17
+ date: 2011-12-19 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency