simple_resource 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/app/helpers/simple_resource/base_helper.rb +3 -13
- data/lib/simple_resource/version.rb +1 -1
- data/spec/helpers/base_helper_spec.rb +2 -22
- metadata +5 -5
data/CHANGELOG.md
CHANGED
@@ -108,21 +108,11 @@ module SimpleResource
|
|
108
108
|
table_classes.join(" ").strip
|
109
109
|
end
|
110
110
|
|
111
|
-
def controller_namespaces
|
112
|
-
namespaces = controller_path.split("/")
|
113
|
-
namespaces.pop
|
114
|
-
namespaces
|
115
|
-
end
|
116
|
-
|
117
111
|
def resource_form_path
|
118
|
-
if
|
119
|
-
|
120
|
-
resource_path
|
121
|
-
else
|
122
|
-
collection_path
|
123
|
-
end
|
112
|
+
if resource.new_record?
|
113
|
+
collection_path
|
124
114
|
else
|
125
|
-
|
115
|
+
resource_path
|
126
116
|
end
|
127
117
|
end
|
128
118
|
|
@@ -231,26 +231,6 @@ describe SimpleResource::BaseHelper do
|
|
231
231
|
end
|
232
232
|
end
|
233
233
|
|
234
|
-
describe "#controller_namespaces" do
|
235
|
-
context "when no namespaces exist" do
|
236
|
-
it "returns an empty array" do
|
237
|
-
helper.controller_namespaces.should be_empty
|
238
|
-
end
|
239
|
-
end
|
240
|
-
|
241
|
-
context "when namespace exists" do
|
242
|
-
before :each do
|
243
|
-
@controller = Backend::LanguagesController.new
|
244
|
-
@controller.request = ActionDispatch::TestRequest.new
|
245
|
-
@controller.instance_variable_set("@language", language)
|
246
|
-
end
|
247
|
-
|
248
|
-
it "returns namespace in array" do
|
249
|
-
helper.controller_namespaces.should == ["backend"]
|
250
|
-
end
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
234
|
describe "#resource_form_path" do
|
255
235
|
describe "new action" do
|
256
236
|
before :each do
|
@@ -276,7 +256,7 @@ describe SimpleResource::BaseHelper do
|
|
276
256
|
end
|
277
257
|
|
278
258
|
it "returns path with namespace" do
|
279
|
-
helper.resource_form_path.should
|
259
|
+
helper.resource_form_path.should eq("/backend/languages")
|
280
260
|
end
|
281
261
|
end
|
282
262
|
end
|
@@ -304,7 +284,7 @@ describe SimpleResource::BaseHelper do
|
|
304
284
|
end
|
305
285
|
|
306
286
|
it "returns path with namespace" do
|
307
|
-
helper.resource_form_path.should
|
287
|
+
helper.resource_form_path.should eq("/backend/languages/#{language.id}")
|
308
288
|
end
|
309
289
|
end
|
310
290
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -318,7 +318,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
318
318
|
version: '0'
|
319
319
|
segments:
|
320
320
|
- 0
|
321
|
-
hash:
|
321
|
+
hash: 1104561883811713693
|
322
322
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
323
323
|
none: false
|
324
324
|
requirements:
|
@@ -327,10 +327,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
327
327
|
version: '0'
|
328
328
|
segments:
|
329
329
|
- 0
|
330
|
-
hash:
|
330
|
+
hash: 1104561883811713693
|
331
331
|
requirements: []
|
332
332
|
rubyforge_project:
|
333
|
-
rubygems_version: 1.8.
|
333
|
+
rubygems_version: 1.8.25
|
334
334
|
signing_key:
|
335
335
|
specification_version: 3
|
336
336
|
summary: Simplified resource handling for Rails.
|