rspec-cells 0.1.0 → 0.1.1
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.
data/CHANGES.textile
CHANGED
data/lib/rspec/cells/version.rb
CHANGED
@@ -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
|
-
-
|
9
|
-
version: 0.1.
|
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-
|
17
|
+
date: 2011-12-19 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|