render_with_view 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/lib/render_with_view.rb +13 -16
- data/lib/render_with_view/version.rb +1 -1
- data/render_with_view.gemspec +3 -0
- data/spec/render_with_view_spec.rb +2 -2
- metadata +32 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4ce39e99f14378e09ecf2d05a778d02b1184260e19dd9b03faa6495cd19852f9
|
4
|
+
data.tar.gz: 357ae6071ce03ac319d32e7ee380f8582539c0d2734c382d6a8f81ba102b6d72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9768fc7965cfa1fd6fbcca1f71b6cfd9241af8bacd5b67a15f0a122311d1a1339fbd7ce61efdefe3df9ac1774172074d175f285affba840303e6657efecc84ee
|
7
|
+
data.tar.gz: 43d43d3d3c2b751b0d82dd2ef6c198a332a1ddad97c04ed85560611ff497a11e7d049f828c9727e268fde9d8c5e66a9e9bc15581e3095700c7fc4bb4a5201231
|
data/.gitignore
CHANGED
data/lib/render_with_view.rb
CHANGED
@@ -2,25 +2,22 @@ require 'render_with_view/version'
|
|
2
2
|
require 'render_with_view/half_open_struct'
|
3
3
|
|
4
4
|
module RenderWithView
|
5
|
-
class View < HalfOpenStruct
|
5
|
+
class View < HalfOpenStruct
|
6
|
+
end
|
6
7
|
|
7
|
-
def
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
locals = args.shift
|
16
|
-
opts = args.shift || {}
|
8
|
+
def render_with_view *args
|
9
|
+
if !args.first.is_a?(Hash)
|
10
|
+
tmpl = args.shift
|
11
|
+
else
|
12
|
+
tmpl = action_name
|
13
|
+
end
|
14
|
+
locals = args.shift
|
15
|
+
opts = args.shift || {}
|
17
16
|
|
18
|
-
|
19
|
-
|
17
|
+
# save to ivar for testing purposes
|
18
|
+
@__view__ = View.new(locals)
|
20
19
|
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
20
|
+
render tmpl, opts.merge(locals: { view: @__view__ })
|
24
21
|
end
|
25
22
|
end
|
26
23
|
|
data/render_with_view.gemspec
CHANGED
@@ -11,6 +11,9 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.homepage = 'https://github.com/mikker/render_with_view'
|
12
12
|
s.license = 'MIT'
|
13
13
|
|
14
|
+
s.add_dependency 'rails'
|
15
|
+
s.add_development_dependency 'rspec'
|
16
|
+
|
14
17
|
s.files = `git ls-files`.split("\n")
|
15
18
|
s.require_path = "lib"
|
16
19
|
end
|
@@ -37,13 +37,13 @@ RSpec.describe RenderWithView do
|
|
37
37
|
|
38
38
|
it "includes options" do
|
39
39
|
user = { id: 1 }
|
40
|
-
opts = {
|
40
|
+
opts = { status: 401 }
|
41
41
|
ctrl = FakeController.new
|
42
42
|
|
43
43
|
ctrl.render_with_view(:edit, {user: user}, opts)
|
44
44
|
tmpl, opts = ctrl.calls.last
|
45
45
|
expect(tmpl).to eq :edit
|
46
|
-
expect(opts[:
|
46
|
+
expect(opts[:status]).to eq(401)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: render_with_view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikkel Malmberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2019-10-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
description:
|
14
42
|
email:
|
15
43
|
- mikkel@brnbw.com
|
@@ -50,8 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
78
|
- !ruby/object:Gem::Version
|
51
79
|
version: '0'
|
52
80
|
requirements: []
|
53
|
-
|
54
|
-
rubygems_version: 2.5.1
|
81
|
+
rubygems_version: 3.0.3
|
55
82
|
signing_key:
|
56
83
|
specification_version: 4
|
57
84
|
summary: Be explicit about what you send to your Rails views
|