flowmor_router 0.0.4 → 0.1.1
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/README.md +21 -18
- data/config/routes.rb +9 -0
- data/lib/flowmor_router/acts_as_flowmor_routable.rb +122 -0
- data/lib/flowmor_router/engine.rb +1 -0
- data/lib/flowmor_router/version.rb +1 -1
- data/lib/flowmor_router.rb +1 -0
- data/test/dummy/app/models/article.rb +2 -2
- data/test/dummy/app/models/news_article.rb +4 -3
- data/test/dummy/app/models/post.rb +3 -2
- data/test/dummy/app/models/post_category.rb +4 -6
- data/test/dummy/config/environments/production.rb +1 -1
- data/test/dummy/config/environments/test.rb +2 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +44393 -0
- data/test/dummy/test/integration/routable_records_test.rb +1 -1
- data/test/dummy/test/models/article_test.rb +12 -1
- data/test/dummy/test/models/news_article_test.rb +2 -2
- data/test/dummy/test/models/post_category_test.rb +1 -1
- data/test/dummy/test/models/post_test.rb +4 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2cdcb1089fe8a96b07fa1beb4356a3f2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2ef169e1ab9b9980404c3f7bd7b16cd1 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/66a7ff918272131011428741d7073461 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/66e7b4d1264df0176332685032844ce5 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9bd4a825d7cf65dfa37efb43fe6b5aa7 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a3ecd3c2fe5e4b3c4dd1365b4c108d06 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/c1a3b329f54c41592a0854a40f8425e0 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/efbfd84424b5a4f22bd23b73db9591a2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- metadata +5 -3
@@ -7,7 +7,7 @@ class RoutableRecordsTest < ActionDispatch::IntegrationTest
|
|
7
7
|
assert_equal "/general/lets-test-this", post.path
|
8
8
|
get post.path
|
9
9
|
assert_response :success
|
10
|
-
assert_select "h1", "Let
|
10
|
+
assert_select "h1", "Let's Test This"
|
11
11
|
end
|
12
12
|
|
13
13
|
test "only routable routes built" do
|
@@ -12,10 +12,21 @@ class ArticleTest < ActiveSupport::TestCase
|
|
12
12
|
test "article#route_name_prefix" do
|
13
13
|
assert Article.new(title: "Dummy Article").route_name_prefix, 'article'
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
test "article#derived_name_field_value" do
|
17
17
|
assert Article.new(title: "Dummy Article").derived_name_field_value, 'dummy-article'
|
18
18
|
end
|
19
|
+
|
20
|
+
test "unpublished articles not routed" do
|
21
|
+
published = Article.create(title: "Published", published: true)
|
22
|
+
unpublished = Article.create(title: "Unpublished", published: false)
|
23
|
+
assert_equal published.published, true
|
24
|
+
assert_equal unpublished.published, false
|
25
|
+
assert_equal published.path, '/articles/published'
|
26
|
+
assert_raise FlowmorRouter::UnroutedRecord do
|
27
|
+
unpublished.path
|
28
|
+
end
|
29
|
+
end
|
19
30
|
|
20
31
|
test "article#path" do
|
21
32
|
assert_raise FlowmorRouter::UnroutableRecord do
|
@@ -12,7 +12,7 @@ class NewsArticleTest < ActiveSupport::TestCase
|
|
12
12
|
test "news_article#route_name_prefix" do
|
13
13
|
assert_equal 'news_articles', NewsArticle.new(caption: "Dummy News Article").route_name_prefix
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
test "news_article#derived_name_field_value" do
|
17
17
|
assert_equal 'Dummy News Article', NewsArticle.new(caption: "Dummy News Article").derived_name_field_value
|
18
18
|
end
|
@@ -20,7 +20,7 @@ class NewsArticleTest < ActiveSupport::TestCase
|
|
20
20
|
test "news_article#new_name_value" do
|
21
21
|
assert_equal 'dummy-news-article', NewsArticle.new(caption: "Dummy News Article").new_name_value
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
test "news_article#slug" do
|
25
25
|
assert_equal 'dummy-news-article', NewsArticle.create(caption: "Dummy News Article").slug
|
26
26
|
end
|
@@ -29,6 +29,10 @@ class PostTest < ActiveSupport::TestCase
|
|
29
29
|
assert_equal 'post', Post.route_model
|
30
30
|
end
|
31
31
|
|
32
|
+
test "post#route" do
|
33
|
+
assert_equal Post.new(title: "Dummy Post", name: "dummy-post").route, '/general/dummy-post'
|
34
|
+
end
|
35
|
+
|
32
36
|
test "post#path" do
|
33
37
|
assert_raise FlowmorRouter::UnroutableRecord do
|
34
38
|
Post.new(title: nil).path
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flowmor_router
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Lang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- bin/rails
|
57
57
|
- config/routes.rb
|
58
58
|
- lib/flowmor_router.rb
|
59
|
+
- lib/flowmor_router/acts_as_flowmor_routable.rb
|
59
60
|
- lib/flowmor_router/engine.rb
|
60
61
|
- lib/flowmor_router/exceptions.rb
|
61
62
|
- lib/flowmor_router/version.rb
|
@@ -169,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
170
|
version: '0'
|
170
171
|
requirements: []
|
171
172
|
rubyforge_project:
|
172
|
-
rubygems_version: 2.4.
|
173
|
+
rubygems_version: 2.4.6
|
173
174
|
signing_key:
|
174
175
|
specification_version: 4
|
175
176
|
summary: FlowmorRouter makes it easy to build routes out of ActiveRecord objects.
|
@@ -263,3 +264,4 @@ test_files:
|
|
263
264
|
- test/flowmor_router_test.rb
|
264
265
|
- test/integration/navigation_test.rb
|
265
266
|
- test/test_helper.rb
|
267
|
+
has_rdoc:
|