basic_assumption 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/rails/init.rb +5 -0
- data/spec/lib/basic_assumption_spec.rb +18 -4
- metadata +30 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.2
|
data/rails/init.rb
CHANGED
@@ -121,13 +121,15 @@ describe BasicAssumption do
|
|
121
121
|
end
|
122
122
|
|
123
123
|
context "classes derived from ActionController::Base" do
|
124
|
-
|
125
|
-
|
124
|
+
let(:application_controller) { Class.new(controller_class) }
|
125
|
+
let(:derived_class) { Class.new(application_controller) }
|
126
|
+
let(:derived_instance) { derived_class.new }
|
127
|
+
|
128
|
+
before(:all) do
|
129
|
+
application_controller.class_eval do
|
126
130
|
default_assumption { |name| "#{name}#{name}" }
|
127
131
|
end
|
128
132
|
end
|
129
|
-
let(:derived_class) { Class.new(controller_class) }
|
130
|
-
let(:derived_instance) { derived_class.new }
|
131
133
|
|
132
134
|
it "inherit the default assumption" do
|
133
135
|
derived_class.class_eval do
|
@@ -136,5 +138,17 @@ describe BasicAssumption do
|
|
136
138
|
derived_instance.twice.should eql('twicetwice')
|
137
139
|
end
|
138
140
|
end
|
141
|
+
|
142
|
+
context "the default assumption" do
|
143
|
+
class ::Model; end
|
144
|
+
it "attempts to find an instance of a model class inferred from the name" do
|
145
|
+
controller_class.class_eval do
|
146
|
+
assume(:model)
|
147
|
+
end
|
148
|
+
controller_instance.stub(:params => {'id' => 123})
|
149
|
+
::Model.should_receive(:find).with(123)
|
150
|
+
controller_instance.model.should be_a_kind_of(Object)
|
151
|
+
end
|
152
|
+
end
|
139
153
|
end
|
140
154
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matt Yoho
|
@@ -31,6 +31,34 @@ dependencies:
|
|
31
31
|
version: 1.3.0
|
32
32
|
type: :development
|
33
33
|
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: actionpack
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 2
|
43
|
+
- 3
|
44
|
+
- 5
|
45
|
+
version: 2.3.5
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: activesupport
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
segments:
|
56
|
+
- 2
|
57
|
+
- 3
|
58
|
+
- 5
|
59
|
+
version: 2.3.5
|
60
|
+
type: :development
|
61
|
+
version_requirements: *id003
|
34
62
|
description: "\n Allows a simple declarative idiom for accessing resources in controllers and views\n "
|
35
63
|
email: mby@mattyoho.com
|
36
64
|
executables: []
|