buoys 0.3.0 → 0.4.0
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.
- checksums.yaml +4 -4
- data/lib/buoys/buoy.rb +1 -1
- data/lib/buoys/version.rb +1 -1
- data/test/buoys_helper_test.rb +27 -1
- data/test/dummy/app/controllers/items_controller.rb +6 -0
- data/test/dummy/app/models/item.rb +2 -0
- data/test/dummy/app/models/user.rb +2 -0
- data/test/dummy/config/application.rb +3 -1
- data/test/dummy/config/buoys/buoys.rb +10 -1
- data/test/dummy/config/locales/en.yml +2 -0
- data/test/dummy/config/routes.rb +6 -2
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20160602144150_create_items.rb +9 -0
- data/test/dummy/db/migrate/20160602144324_create_users.rb +9 -0
- data/test/dummy/db/schema.rb +13 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +10 -0
- data/test/dummy/log/test.log +7064 -0
- metadata +54 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97ccbfd2f85553dc5bda98c988308808b62c822b
|
4
|
+
data.tar.gz: 23c895177daf452393d88e549d25c1c3cdf67d92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a677c4c0d1ca840b5893674efa83f4b66af0ccd8f178e353c9a017f91a82e3a523a4296282477f7dc1cefdd20267ba8c5d72e5521873fc6d106f2e04b6fe9b12
|
7
|
+
data.tar.gz: f6682ff57a57fce2d8b716185c3889003477e82718446419f8d7083cb6347f23dd3fedfc16cd221c978749644498d1dc67795d58d55b2ead86b9082edf558a2d
|
data/lib/buoys/buoy.rb
CHANGED
data/lib/buoys/version.rb
CHANGED
data/test/buoys_helper_test.rb
CHANGED
@@ -71,7 +71,7 @@ class BuoysHelerTest < ActionView::TestCase
|
|
71
71
|
<span>></span>
|
72
72
|
</li>
|
73
73
|
<li>
|
74
|
-
<a class="active" href="http://example.com/books/1/authors/2">
|
74
|
+
<a class="active" href="http://example.com/books/1/authors/2/edit">
|
75
75
|
<span>edit-1-2</span>
|
76
76
|
</a>
|
77
77
|
</li>
|
@@ -81,6 +81,32 @@ class BuoysHelerTest < ActionView::TestCase
|
|
81
81
|
assert_dom_equal expected_html, html
|
82
82
|
end
|
83
83
|
|
84
|
+
test '.buoy (use polymorphic routes)' do
|
85
|
+
user = User.create(name: 'test user')
|
86
|
+
item = Item.create(name: 'test item')
|
87
|
+
|
88
|
+
breadcrumb :edit_user_item, [user, item]
|
89
|
+
html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '')
|
90
|
+
expected_html =
|
91
|
+
%(
|
92
|
+
<ul>
|
93
|
+
<li>
|
94
|
+
<a class="hover" href="/users/#{user.id}/items/#{item.id}">
|
95
|
+
<span>show user item</span>
|
96
|
+
</a>
|
97
|
+
<span>></span>
|
98
|
+
</li>
|
99
|
+
<li>
|
100
|
+
<a class="active" href="/users/#{user.id}/items/#{item.id}/edit">
|
101
|
+
<span>edit user item</span>
|
102
|
+
</a>
|
103
|
+
</li>
|
104
|
+
</ul>
|
105
|
+
).gsub(/[[:space:]]{2,}|\n/, '')
|
106
|
+
|
107
|
+
assert_dom_equal expected_html, html
|
108
|
+
end
|
109
|
+
|
84
110
|
test ".buoy (has configuration options in link's arguments)" do
|
85
111
|
breadcrumb :show_books, 1
|
86
112
|
html = render('breadcrumbs/buoys').gsub(/[[:space:]]{2,}|\n/, '')
|
@@ -21,6 +21,8 @@ module Dummy
|
|
21
21
|
config.i18n.default_locale = :en
|
22
22
|
|
23
23
|
# Do not swallow errors in after_commit/after_rollback callbacks.
|
24
|
-
|
24
|
+
if Gem::Version.new(Rails.version) >= Gem::Version.new("4.2.0")
|
25
|
+
config.active_record.raise_in_transactional_callbacks = true
|
26
|
+
end
|
25
27
|
end
|
26
28
|
end
|
@@ -13,5 +13,14 @@ end
|
|
13
13
|
|
14
14
|
buoy :edit_book_author do |book_id, author_id|
|
15
15
|
parent :books
|
16
|
-
link "edit-#{book_id}-#{author_id}", "http://example.com/books/#{book_id}/authors/#{author_id}", link_current: true
|
16
|
+
link "edit-#{book_id}-#{author_id}", "http://example.com/books/#{book_id}/authors/#{author_id}/edit", link_current: true
|
17
|
+
end
|
18
|
+
|
19
|
+
buoy :show_user_item do |user, item|
|
20
|
+
link :show_user_item, [user, item]
|
21
|
+
end
|
22
|
+
|
23
|
+
buoy :edit_user_item do |user, item|
|
24
|
+
pre_buoy :show_user_item, [user, item]
|
25
|
+
link :edit_user_item, [:edit, user, item], link_current: true
|
17
26
|
end
|
data/test/dummy/config/routes.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
get 'about' => 'dummy
|
3
|
-
get 'about/history' => 'dummy
|
2
|
+
get 'about' => 'dummy#dummy', as: :about
|
3
|
+
get 'about/history' => 'dummy#dummy', as: :history
|
4
|
+
|
5
|
+
resources :users, only: [] do
|
6
|
+
resources :items, only: %i(show edit)
|
7
|
+
end
|
4
8
|
end
|
Binary file
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,6 +11,18 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20160602144324) do
|
15
|
+
|
16
|
+
create_table "items", force: :cascade do |t|
|
17
|
+
t.string "name"
|
18
|
+
t.datetime "created_at", null: false
|
19
|
+
t.datetime "updated_at", null: false
|
20
|
+
end
|
21
|
+
|
22
|
+
create_table "users", force: :cascade do |t|
|
23
|
+
t.string "name"
|
24
|
+
t.datetime "created_at", null: false
|
25
|
+
t.datetime "updated_at", null: false
|
26
|
+
end
|
15
27
|
|
16
28
|
end
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -0,0 +1,10 @@
|
|
1
|
+
[1m[36m (4.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
2
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3
|
+
[1m[36m (4.8ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
4
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
5
|
+
[1m[36m (5.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
6
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
7
|
+
[1m[36m (4.9ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
8
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
9
|
+
[1m[36m (3.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('0')[0m
|
10
|
+
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1[0m
|