burgundy 0.6.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/burgundy/item.rb +0 -5
- data/lib/burgundy/version.rb +1 -1
- data/test/dummy/app/controllers/users_controller.rb +16 -0
- data/test/dummy/app/views/layouts/application.html.erb +1 -1
- data/test/dummy/app/views/users/_profile.html.erb +1 -0
- data/test/dummy/app/views/users/index.html.erb +1 -0
- data/test/dummy/config/application.rb +1 -0
- data/test/dummy/config/routes.rb +2 -1
- data/test/integration/burgundy_test.rb +33 -0
- data/test/unit/burgundy_test.rb +0 -11
- metadata +10 -4
- data/test/dummy/app/views/site/contact.html.erb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7991ba9de32d726889e787fd2bfcd365983b6ab346d091cb1ee9c606f4eff75d
|
4
|
+
data.tar.gz: 798a170bff1bd32c6e6e7e6658c445b51b67bda9bdaa9329f077847e03fdd42b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcdcec01f1328b57ec4a86a2a703fbb28acea653b8c4a3f8e77b92a8d2b0a988d823906e7201128c97b99c85e0b3b22d071739a2c329c50db2904c9cd47eecfa
|
7
|
+
data.tar.gz: cfb6f54d2c96acb6c1fdf7a490835327581c1b3cb7d77d75d677f7b4293693931f64c08df887b1a01448175a7df98ab94488d133c9095d4fed47e46f1a96f1a6
|
data/lib/burgundy/item.rb
CHANGED
@@ -12,11 +12,6 @@ module Burgundy
|
|
12
12
|
Collection.new(collection, self, *args)
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.map(collection)
|
16
|
-
warn "Burgundy::Item.map is deprecated; use Burgundy::Item.wrap instead."
|
17
|
-
wrap(collection)
|
18
|
-
end
|
19
|
-
|
20
15
|
def self.attributes(*args)
|
21
16
|
@attributes ||= {}
|
22
17
|
|
data/lib/burgundy/version.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class UsersController < ApplicationController
|
4
|
+
def index
|
5
|
+
presenter = Class.new(Burgundy::Item) do
|
6
|
+
def to_partial_path
|
7
|
+
"users/profile"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
@users = presenter.wrap([
|
12
|
+
OpenStruct.new(name: "John"),
|
13
|
+
OpenStruct.new(name: "Mary")
|
14
|
+
])
|
15
|
+
end
|
16
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<title
|
4
|
+
<title>Burgundy</title>
|
5
5
|
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
6
|
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
7
|
<%= csrf_meta_tags %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1><%= profile.name %></h1>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render @users, as: :profile %>
|
data/test/dummy/config/routes.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "test_helper"
|
4
|
+
|
5
|
+
class BurgundyTest < Minitest::Test
|
6
|
+
include Rack::Test::Methods
|
7
|
+
|
8
|
+
def app
|
9
|
+
Rails.application
|
10
|
+
end
|
11
|
+
|
12
|
+
test "renders collection with custom partial path" do
|
13
|
+
get "/users"
|
14
|
+
html = Nokogiri(last_response.body)
|
15
|
+
h1s = html.css("h1")
|
16
|
+
|
17
|
+
assert_equal 2, h1s.size
|
18
|
+
assert_equal "John", h1s[0].text
|
19
|
+
assert_equal "Mary", h1s[1].text
|
20
|
+
end
|
21
|
+
|
22
|
+
test "wrapped object is the same as the unwrapped object" do
|
23
|
+
model = Class.new do
|
24
|
+
include ActiveModel::Model
|
25
|
+
attr_accessor :name
|
26
|
+
end
|
27
|
+
|
28
|
+
presenter = Class.new(Burgundy::Item)
|
29
|
+
instance = model.new(name: "John")
|
30
|
+
|
31
|
+
assert presenter.new(instance).eql?(instance)
|
32
|
+
end
|
33
|
+
end
|
data/test/unit/burgundy_test.rb
CHANGED
@@ -59,17 +59,6 @@ class BurgundyTest < Minitest::Test
|
|
59
59
|
assert_equal [2, 3], items.first.args
|
60
60
|
end
|
61
61
|
|
62
|
-
test "deprecates Burgundy::Item.map" do
|
63
|
-
message =
|
64
|
-
"Burgundy::Item.map is deprecated; use Burgundy::Item.wrap instead."
|
65
|
-
|
66
|
-
_, err = capture_io do
|
67
|
-
wrapper.map([1, 2, 3])
|
68
|
-
end
|
69
|
-
|
70
|
-
assert err.include?(message)
|
71
|
-
end
|
72
|
-
|
73
62
|
test "wraps items in collection" do
|
74
63
|
collection = Burgundy::Collection.new([1, 2, 3], wrapper)
|
75
64
|
assert_equal 1, collection.first
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: burgundy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -152,12 +152,14 @@ files:
|
|
152
152
|
- test/dummy/app/assets/stylesheets/application.css
|
153
153
|
- test/dummy/app/controllers/application_controller.rb
|
154
154
|
- test/dummy/app/controllers/concerns/.keep
|
155
|
+
- test/dummy/app/controllers/users_controller.rb
|
155
156
|
- test/dummy/app/helpers/application_helper.rb
|
156
157
|
- test/dummy/app/mailers/.keep
|
157
158
|
- test/dummy/app/models/.keep
|
158
159
|
- test/dummy/app/models/concerns/.keep
|
159
160
|
- test/dummy/app/views/layouts/application.html.erb
|
160
|
-
- test/dummy/app/views/
|
161
|
+
- test/dummy/app/views/users/_profile.html.erb
|
162
|
+
- test/dummy/app/views/users/index.html.erb
|
161
163
|
- test/dummy/bin/bundle
|
162
164
|
- test/dummy/bin/rails
|
163
165
|
- test/dummy/bin/rake
|
@@ -184,6 +186,7 @@ files:
|
|
184
186
|
- test/dummy/public/422.html
|
185
187
|
- test/dummy/public/500.html
|
186
188
|
- test/dummy/public/favicon.ico
|
189
|
+
- test/integration/burgundy_test.rb
|
187
190
|
- test/test_helper.rb
|
188
191
|
- test/unit/burgundy_test.rb
|
189
192
|
homepage: http://github.com/fnando/burgundy
|
@@ -217,12 +220,14 @@ test_files:
|
|
217
220
|
- test/dummy/app/assets/stylesheets/application.css
|
218
221
|
- test/dummy/app/controllers/application_controller.rb
|
219
222
|
- test/dummy/app/controllers/concerns/.keep
|
223
|
+
- test/dummy/app/controllers/users_controller.rb
|
220
224
|
- test/dummy/app/helpers/application_helper.rb
|
221
225
|
- test/dummy/app/mailers/.keep
|
222
226
|
- test/dummy/app/models/.keep
|
223
227
|
- test/dummy/app/models/concerns/.keep
|
224
228
|
- test/dummy/app/views/layouts/application.html.erb
|
225
|
-
- test/dummy/app/views/
|
229
|
+
- test/dummy/app/views/users/_profile.html.erb
|
230
|
+
- test/dummy/app/views/users/index.html.erb
|
226
231
|
- test/dummy/bin/bundle
|
227
232
|
- test/dummy/bin/rails
|
228
233
|
- test/dummy/bin/rake
|
@@ -249,5 +254,6 @@ test_files:
|
|
249
254
|
- test/dummy/public/422.html
|
250
255
|
- test/dummy/public/500.html
|
251
256
|
- test/dummy/public/favicon.ico
|
257
|
+
- test/integration/burgundy_test.rb
|
252
258
|
- test/test_helper.rb
|
253
259
|
- test/unit/burgundy_test.rb
|
File without changes
|