heks 0.0.3 → 0.0.4
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/generators/heks/controller/controller_generator.rb +12 -0
- data/lib/generators/heks/model/model_generator.rb +2 -2
- data/lib/generators/heks/resource/resource_generator.rb +1 -0
- data/lib/generators/heks/templates/active_record_model.rb.erb +1 -1
- data/lib/generators/heks/templates/controller.rb.erb +39 -0
- data/lib/generators/heks/use_case/use_case_generator.rb +2 -2
- data/lib/heks/version.rb +1 -1
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/blog_post_controller.rb +40 -0
- data/test/dummy/app/controllers/blog_posts_controller.rb +39 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/hexagon/blog_post.rb +13 -0
- data/test/dummy/app/hexagon/repository/adapters/ar/blog_post.rb +36 -0
- data/test/dummy/app/hexagon/repository/adapters/ar/data/blog_post.rb +4 -0
- data/test/dummy/app/hexagon/repository/database/blog_post.rb +54 -0
- data/test/dummy/app/hexagon/repository/memory/blog_post.rb +40 -0
- data/test/dummy/app/hexagon/use_case/create_blog_post.rb +22 -0
- data/test/dummy/app/hexagon/use_case/delete_blog_post.rb +22 -0
- data/test/dummy/app/hexagon/use_case/list_blog_posts.rb +22 -0
- data/test/dummy/app/hexagon/use_case/read_blog_post.rb +22 -0
- data/test/dummy/app/hexagon/use_case/update_blog_post.rb +22 -0
- data/test/dummy/app/views/blog_posts/_form.html.erb +14 -0
- data/test/dummy/app/views/blog_posts/edit.html.erb +3 -0
- data/test/dummy/app/views/blog_posts/index.html.erb +9 -0
- data/test/dummy/app/views/blog_posts/new.html.erb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20150914062943_create_blog_posts.rb +8 -0
- data/test/dummy/db/schema.rb +21 -0
- data/test/dummy/log/development.log +146 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/spec/heks/use_case/create_blog_post_spec.rb +20 -0
- data/test/dummy/spec/heks/use_case/delete_blog_post_spec.rb +20 -0
- data/test/dummy/spec/heks/use_case/list_blog_posts_spec.rb +20 -0
- data/test/dummy/spec/heks/use_case/read_blog_post_spec.rb +20 -0
- data/test/dummy/spec/heks/use_case/update_blog_post_spec.rb +20 -0
- data/test/dummy/spec/hexagon/blog_post_spec.rb +6 -0
- data/test/dummy/spec/hexagon/repository/adapters/ar/blog_post_spec.rb +0 -0
- data/test/dummy/spec/hexagon/repository/adapters/ar/data/blog_post_spec.rb +0 -0
- data/test/dummy/spec/hexagon/repository/database/blog_post_spec.rb +54 -0
- data/test/dummy/spec/hexagon/repository/memory/blog_post_spec.rb +40 -0
- data/test/dummy/spec/hexagon/use_case/create_blog_post_spec.rb +20 -0
- data/test/dummy/spec/hexagon/use_case/delete_blog_post_spec.rb +20 -0
- data/test/dummy/spec/hexagon/use_case/list_blog_posts_spec.rb +20 -0
- data/test/dummy/spec/hexagon/use_case/read_blog_post_spec.rb +20 -0
- data/test/dummy/spec/hexagon/use_case/update_blog_post_spec.rb +20 -0
- data/test/dummy/spec/models/blog_post_spec.rb +6 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/-vafv4A0l3iJF0-IyX9Uk_oQ-RIKXhPFXitPc3k4mk8.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/0ieeKnMtadPClPcf7n4_-7f9dFAa5EKPn-nhh8g4E_I.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/2zkbjbsMYCykYlg-NDKk6Qxz037f7daU6GUhcNJeqcE.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/3GBybT8PfVOH8O33sovCj_2Ii8pPb5azRg64Ly9KztU.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/3fB7XY5WyPu8FySUeyC372vbXJ2Ix4iB1QaNHXbk_BY.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/EHcymtlGKlOMMf7gOs-X2_jpvcBTW92Qeaxu2B5-Wbg.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/KtmL5zAwlZVRtKs152rC0myo3x_yBGUZYPZPMWDKtKE.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +3 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/Pd_F3-yekB-1qnk2jHvfJ4YrXTO8oMkLujPn4EDTuUk.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/SGxtd6iKmB2TMwH-VOx-jVYXh5m_09UjNEOkifPHLL0.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/W0Q4-_MN8lFPhBVNNbwOPZB_gohXJmNGQpZF9vOfIg4.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +3 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/lnkATOjCZCHuHKbyGUJWM7kjxXcoUuETmbmeNSlVj1g.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/tmdN7iRiXSHZsXbratCQqisw3N3js4ua1vCaizt_qpg.cache +1 -0
- data/test/heks_test.rb +7 -0
- data/test/test_helper.rb +20 -0
- metadata +209 -3
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body>
|
|
58
|
+
<!-- This file lives in public/404.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
|
63
|
+
</div>
|
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
65
|
+
</div>
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body>
|
|
58
|
+
<!-- This file lives in public/422.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
63
|
+
</div>
|
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
65
|
+
</div>
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body>
|
|
58
|
+
<!-- This file lives in public/500.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
|
62
|
+
</div>
|
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
64
|
+
</div>
|
|
65
|
+
</body>
|
|
66
|
+
</html>
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe UseCase::CreateBlogPost do
|
|
4
|
+
describe 'create' do
|
|
5
|
+
subject { described_class.new(listener, Repository::Memory::Create Blog Post.new) }
|
|
6
|
+
let (:listener) { double("create_blog_post listener", create_blog_post_success: nil, create_blog_post_failure: nil) }
|
|
7
|
+
let (:repository) { subject.repository }
|
|
8
|
+
|
|
9
|
+
context "With Valid Properties" do
|
|
10
|
+
it 'notifies listener of success' do
|
|
11
|
+
expect(listener).to receive(:create_blog_post_success)
|
|
12
|
+
subject.create()
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "With Invalid Properties" do
|
|
17
|
+
it 'notifies the listener of failure'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe UseCase::DeleteBlogPost do
|
|
4
|
+
describe 'delete' do
|
|
5
|
+
subject { described_class.new(listener, Repository::Memory::Delete Blog Post.new) }
|
|
6
|
+
let (:listener) { double("delete_blog_post listener", delete_blog_post_success: nil, delete_blog_post_failure: nil) }
|
|
7
|
+
let (:repository) { subject.repository }
|
|
8
|
+
|
|
9
|
+
context "With Valid Properties" do
|
|
10
|
+
it 'notifies listener of success' do
|
|
11
|
+
expect(listener).to receive(:delete_blog_post_success)
|
|
12
|
+
subject.delete()
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "With Invalid Properties" do
|
|
17
|
+
it 'notifies the listener of failure'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe UseCase::ListBlogPosts do
|
|
4
|
+
describe 'list' do
|
|
5
|
+
subject { described_class.new(listener, Repository::Memory::List Blog Posts.new) }
|
|
6
|
+
let (:listener) { double("list_blog_posts listener", list_blog_posts_success: nil, list_blog_posts_failure: nil) }
|
|
7
|
+
let (:repository) { subject.repository }
|
|
8
|
+
|
|
9
|
+
context "With Valid Properties" do
|
|
10
|
+
it 'notifies listener of success' do
|
|
11
|
+
expect(listener).to receive(:list_blog_posts_success)
|
|
12
|
+
subject.list()
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "With Invalid Properties" do
|
|
17
|
+
it 'notifies the listener of failure'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe UseCase::ReadBlogPost do
|
|
4
|
+
describe 'read' do
|
|
5
|
+
subject { described_class.new(listener, Repository::Memory::Read Blog Post.new) }
|
|
6
|
+
let (:listener) { double("read_blog_post listener", read_blog_post_success: nil, read_blog_post_failure: nil) }
|
|
7
|
+
let (:repository) { subject.repository }
|
|
8
|
+
|
|
9
|
+
context "With Valid Properties" do
|
|
10
|
+
it 'notifies listener of success' do
|
|
11
|
+
expect(listener).to receive(:read_blog_post_success)
|
|
12
|
+
subject.read()
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "With Invalid Properties" do
|
|
17
|
+
it 'notifies the listener of failure'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe UseCase::UpdateBlogPost do
|
|
4
|
+
describe 'update' do
|
|
5
|
+
subject { described_class.new(listener, Repository::Memory::Update Blog Post.new) }
|
|
6
|
+
let (:listener) { double("update_blog_post listener", update_blog_post_success: nil, update_blog_post_failure: nil) }
|
|
7
|
+
let (:repository) { subject.repository }
|
|
8
|
+
|
|
9
|
+
context "With Valid Properties" do
|
|
10
|
+
it 'notifies listener of success' do
|
|
11
|
+
expect(listener).to receive(:update_blog_post_success)
|
|
12
|
+
subject.update()
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "With Invalid Properties" do
|
|
17
|
+
it 'notifies the listener of failure'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
module Repository
|
|
2
|
+
module Database
|
|
3
|
+
class BlogPost
|
|
4
|
+
def initialize(listener = nil)
|
|
5
|
+
@listener = listener
|
|
6
|
+
@adapter = Repository::Adapters::AR::BlogPost.new(self)
|
|
7
|
+
@model = ::BlogPost
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def create(attributes)
|
|
11
|
+
@model.new(attributes).tap do |blog_post|
|
|
12
|
+
return unless blog_post.valid?
|
|
13
|
+
@adapter.create(blog_post.attributes)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def blog_post_adapter_create_success(sequence)
|
|
18
|
+
@listener.blog_post_repository_create_success(sequence)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def list
|
|
22
|
+
@listener.blog_post_repository_list_success(@adapter.list)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def count
|
|
26
|
+
@model.count
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def update(id, attributes)
|
|
30
|
+
@adapter.update(id, attributes)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def blog_post_adapter_update_success(blog_post)
|
|
34
|
+
@listener.blog_post_repository_update_success(blog_post)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def first
|
|
38
|
+
@adapter.first
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def blog_post_adapter_list_success(sequences)
|
|
42
|
+
@listener.blog_post_repository_list_success(sequences)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def read(id)
|
|
46
|
+
@adapter.read(id)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def blog_post_adapter_read_success(blog_post)
|
|
50
|
+
@listener.blog_post_repository_read_success(blog_post)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module Repository
|
|
2
|
+
module Memory
|
|
3
|
+
class BlogPost
|
|
4
|
+
attr_accessor :listener
|
|
5
|
+
|
|
6
|
+
def initialize
|
|
7
|
+
@list = []
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def find(blog_post)
|
|
11
|
+
@list.first do |listed_blog_post|
|
|
12
|
+
blog_post == listed_blog_post
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def all
|
|
17
|
+
@listener.blog_post_repository_all_success(@list)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def create(attributes)
|
|
21
|
+
::BlogPost.new(attributes).tap do |blog_post|
|
|
22
|
+
if blog_post.valid?
|
|
23
|
+
@list << blog_post
|
|
24
|
+
@listener.blog_post_repository_create_success(blog_post) if @listener
|
|
25
|
+
else
|
|
26
|
+
@listener.blog_post_repository_create_failure if @listener
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def count
|
|
32
|
+
@list.count
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def first
|
|
36
|
+
@list.first
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe UseCase::CreateBlogPost do
|
|
4
|
+
describe 'create' do
|
|
5
|
+
subject { described_class.new(listener, Repository::Memory::Create Blog Post.new) }
|
|
6
|
+
let (:listener) { double("create_blog_post listener", create_blog_post_success: nil, create_blog_post_failure: nil) }
|
|
7
|
+
let (:repository) { subject.repository }
|
|
8
|
+
|
|
9
|
+
context "With Valid Properties" do
|
|
10
|
+
it 'notifies listener of success' do
|
|
11
|
+
expect(listener).to receive(:create_blog_post_success)
|
|
12
|
+
subject.create()
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "With Invalid Properties" do
|
|
17
|
+
it 'notifies the listener of failure'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe UseCase::DeleteBlogPost do
|
|
4
|
+
describe 'delete' do
|
|
5
|
+
subject { described_class.new(listener, Repository::Memory::Delete Blog Post.new) }
|
|
6
|
+
let (:listener) { double("delete_blog_post listener", delete_blog_post_success: nil, delete_blog_post_failure: nil) }
|
|
7
|
+
let (:repository) { subject.repository }
|
|
8
|
+
|
|
9
|
+
context "With Valid Properties" do
|
|
10
|
+
it 'notifies listener of success' do
|
|
11
|
+
expect(listener).to receive(:delete_blog_post_success)
|
|
12
|
+
subject.delete()
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "With Invalid Properties" do
|
|
17
|
+
it 'notifies the listener of failure'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe UseCase::ListBlogPosts do
|
|
4
|
+
describe 'list' do
|
|
5
|
+
subject { described_class.new(listener, Repository::Memory::List Blog Posts.new) }
|
|
6
|
+
let (:listener) { double("list_blog_posts listener", list_blog_posts_success: nil, list_blog_posts_failure: nil) }
|
|
7
|
+
let (:repository) { subject.repository }
|
|
8
|
+
|
|
9
|
+
context "With Valid Properties" do
|
|
10
|
+
it 'notifies listener of success' do
|
|
11
|
+
expect(listener).to receive(:list_blog_posts_success)
|
|
12
|
+
subject.list()
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "With Invalid Properties" do
|
|
17
|
+
it 'notifies the listener of failure'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe UseCase::ReadBlogPost do
|
|
4
|
+
describe 'read' do
|
|
5
|
+
subject { described_class.new(listener, Repository::Memory::Read Blog Post.new) }
|
|
6
|
+
let (:listener) { double("read_blog_post listener", read_blog_post_success: nil, read_blog_post_failure: nil) }
|
|
7
|
+
let (:repository) { subject.repository }
|
|
8
|
+
|
|
9
|
+
context "With Valid Properties" do
|
|
10
|
+
it 'notifies listener of success' do
|
|
11
|
+
expect(listener).to receive(:read_blog_post_success)
|
|
12
|
+
subject.read()
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "With Invalid Properties" do
|
|
17
|
+
it 'notifies the listener of failure'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
describe UseCase::UpdateBlogPost do
|
|
4
|
+
describe 'update' do
|
|
5
|
+
subject { described_class.new(listener, Repository::Memory::Update Blog Post.new) }
|
|
6
|
+
let (:listener) { double("update_blog_post listener", update_blog_post_success: nil, update_blog_post_failure: nil) }
|
|
7
|
+
let (:repository) { subject.repository }
|
|
8
|
+
|
|
9
|
+
context "With Valid Properties" do
|
|
10
|
+
it 'notifies listener of success' do
|
|
11
|
+
expect(listener).to receive(:update_blog_post_success)
|
|
12
|
+
subject.update()
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context "With Invalid Properties" do
|
|
17
|
+
it 'notifies the listener of failure'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=ff65827671244e3ba1fdd67e3f6f06d2c2ceb9fa0c9898e9381966441809cbdc:ET
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
I"}app/assets/stylesheets/application.css?type=text/css&id=3f48156e77ce192bf7459e2671ced1b0082ca05f7d31a165cb7c1051cfcfb7ec:ET
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&id=4b069ca274e1a520bb086774effbc4f91f77f582e5a85a12551964e4f45da174:ET
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=d5d876fbc97f2e307192bb2afb87b462dd8d8926886d38de1e1acdbabef47bac:ET
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"%��Rm�v�S3.��O�L���ڹc�ƕq�=_j�
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"%�W\�yho9S���ƫ˥��)|�~���(���
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
[o:Set:
|
|
2
|
+
@hash{I"environment-version:ETTI"environment-paths;TTI"Lprocessors:type=application/javascript&file_type=application/javascript;TTI"8file-digest://app/assets/javascripts/application.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI")file-digest://app/assets/javascripts;TT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"%Ѱč@�����6H�uZoX�Z�gbh0W��V
|
data/test/heks_test.rb
ADDED
data/test/test_helper.rb
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Configure Rails Environment
|
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
|
3
|
+
|
|
4
|
+
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
|
5
|
+
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
|
6
|
+
require "rails/test_help"
|
|
7
|
+
|
|
8
|
+
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
|
9
|
+
# to be shown.
|
|
10
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
|
11
|
+
|
|
12
|
+
# Load support files
|
|
13
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
14
|
+
|
|
15
|
+
# Load fixtures from the engine
|
|
16
|
+
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
|
17
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
|
18
|
+
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
|
|
19
|
+
ActiveSupport::TestCase.fixtures :all
|
|
20
|
+
end
|