exposition 0.0.3.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +25 -0
- data/app/assets/images/exposition/twitter.svg +10 -0
- data/app/assets/javascripts/exposition/admin/application.js +3 -0
- data/app/assets/stylesheets/exposition/_breakpoints.scss +5 -0
- data/app/assets/stylesheets/exposition/_code.scss +83 -0
- data/app/assets/stylesheets/exposition/_footer.scss +9 -0
- data/app/assets/stylesheets/exposition/_header.scss +62 -0
- data/app/assets/stylesheets/exposition/_layout.scss +28 -0
- data/app/assets/stylesheets/exposition/_mixins.scss +4 -0
- data/app/assets/stylesheets/exposition/_normalize.scss +427 -0
- data/app/assets/stylesheets/exposition/_pagination.scss +18 -0
- data/app/assets/stylesheets/exposition/_posts.scss +96 -0
- data/app/assets/stylesheets/exposition/_tags.scss +12 -0
- data/app/assets/stylesheets/exposition/_variables.scss +16 -0
- data/app/assets/stylesheets/exposition/admin/_layout.scss +58 -0
- data/app/assets/stylesheets/exposition/admin/_mixins.scss +3 -0
- data/app/assets/stylesheets/exposition/admin/_notifications.scss +46 -0
- data/app/assets/stylesheets/exposition/admin/_pagination.scss +12 -0
- data/app/assets/stylesheets/exposition/admin/_posts.scss +7 -0
- data/app/assets/stylesheets/exposition/admin/application.scss +9 -0
- data/app/assets/stylesheets/exposition/admin/base/_base.scss +15 -0
- data/app/assets/stylesheets/exposition/admin/base/_buttons.scss +31 -0
- data/app/assets/stylesheets/exposition/admin/base/_forms.scss +78 -0
- data/app/assets/stylesheets/exposition/admin/base/_grid-settings.scss +14 -0
- data/app/assets/stylesheets/exposition/admin/base/_lists.scss +31 -0
- data/app/assets/stylesheets/exposition/admin/base/_tables.scss +25 -0
- data/app/assets/stylesheets/exposition/admin/base/_typography.scss +55 -0
- data/app/assets/stylesheets/exposition/admin/base/_variables.scss +35 -0
- data/app/assets/stylesheets/exposition/admin/normalize.scss +427 -0
- data/app/assets/stylesheets/exposition/application.scss +17 -0
- data/app/controllers/exposition/admin/admin_controller.rb +5 -0
- data/app/controllers/exposition/admin/posts_controller.rb +5 -0
- data/app/controllers/exposition/admin/sessions_controller.rb +31 -0
- data/app/controllers/exposition/admin/tags_controller.rb +5 -0
- data/app/controllers/exposition/application_controller.rb +8 -0
- data/app/controllers/exposition/posts_controller.rb +5 -0
- data/app/controllers/exposition/tags_controller.rb +5 -0
- data/app/helpers/exposition/admin/flashes_helper.rb +7 -0
- data/app/helpers/exposition/admin/sessions_helper.rb +20 -0
- data/app/helpers/exposition/markdown_helper.rb +21 -0
- data/app/models/categorical/tag.rb +6 -0
- data/app/models/exposition/encryptor.rb +10 -0
- data/app/models/exposition/post.rb +5 -0
- data/app/models/exposition/user.rb +5 -0
- data/app/views/exposition/admin/images/index.html.haml +12 -0
- data/app/views/exposition/admin/images/new.html.haml +0 -0
- data/app/views/exposition/admin/posts/_error_handler.html.haml +8 -0
- data/app/views/exposition/admin/posts/_form_fields.html.haml +23 -0
- data/app/views/exposition/admin/posts/edit.html.haml +5 -0
- data/app/views/exposition/admin/posts/index.html.haml +23 -0
- data/app/views/exposition/admin/posts/new.html.haml +7 -0
- data/app/views/exposition/admin/posts/update.html.haml +2 -0
- data/app/views/exposition/admin/sessions/new.html.haml +10 -0
- data/app/views/exposition/admin/tags/_error_handler.html.haml +8 -0
- data/app/views/exposition/admin/tags/edit.html.haml +10 -0
- data/app/views/exposition/admin/tags/index.html.haml +18 -0
- data/app/views/exposition/admin/tags/new.html.haml +10 -0
- data/app/views/exposition/posts/_post.html.haml +8 -0
- data/app/views/exposition/posts/_tags.html.haml +6 -0
- data/app/views/exposition/posts/index.html.haml +8 -0
- data/app/views/exposition/posts/show.html.haml +5 -0
- data/app/views/exposition/tags/show.html.haml +6 -0
- data/app/views/layouts/exposition/admin.html.haml +22 -0
- data/app/views/layouts/exposition/application.html.haml +20 -0
- data/config/locales/en.yml +37 -0
- data/config/routes.rb +14 -0
- data/db/migrate/20160106220615_create_exposition_posters.rb +12 -0
- data/db/migrate/20160112194424_add_author_id_to_posts.rb +5 -0
- data/db/migrate/20160112200248_create_exposition_users.rb +14 -0
- data/db/migrate/20160112202302_add_slug_to_expositon_posts.rb +7 -0
- data/db/migrate/20160112204019_add_categorial_tags.rb +17 -0
- data/db/migrate/20160225203524_add_summary_to_posts.rb +5 -0
- data/db/migrate/20160226035733_convert_published_at_to_datetime.rb +9 -0
- data/lib/exposition.rb +19 -0
- data/lib/exposition/concerns/controllers/admin/admin_controller.rb +39 -0
- data/lib/exposition/concerns/controllers/admin/posts_controller.rb +70 -0
- data/lib/exposition/concerns/controllers/admin/tags_controller.rb +63 -0
- data/lib/exposition/concerns/controllers/posts_controller.rb +19 -0
- data/lib/exposition/concerns/controllers/tags_controller.rb +31 -0
- data/lib/exposition/concerns/models/post.rb +52 -0
- data/lib/exposition/concerns/models/user.rb +43 -0
- data/lib/exposition/engine.rb +14 -0
- data/lib/exposition/setup.rb +15 -0
- data/lib/exposition/version.rb +3 -0
- data/lib/tasks/exposition_tasks.rake +4 -0
- data/lib/tasks/setup.rb +17 -0
- data/spec/controllers/exposition/admin/admin_controller_spec.rb +88 -0
- data/spec/controllers/exposition/admin/posts_controller_spec.rb +153 -0
- data/spec/controllers/exposition/admin/sessions_controller_spec.rb +46 -0
- data/spec/controllers/exposition/admin/tags_controller_spec.rb +106 -0
- data/spec/controllers/exposition/posts_controller_spec.rb +43 -0
- data/spec/controllers/exposition/tags_controller_spec.rb +40 -0
- data/spec/dummy/Gemfile +5 -0
- data/spec/dummy/Gemfile.lock +173 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/Thorfile +1 -0
- data/spec/dummy/app/assets/javascripts/application.js +1 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +9 -0
- data/spec/dummy/bin/rake +9 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/bin/spring +15 -0
- data/spec/dummy/bin/thor +16 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +26 -0
- data/spec/dummy/config/boot.rb +3 -0
- data/spec/dummy/config/database.yml +12 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/schema.rb +62 -0
- data/spec/dummy/db/seeds.rb +22 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/factories/categorical/tags.rb +5 -0
- data/spec/factories/posts.rb +8 -0
- data/spec/factories/taggings.rb +7 -0
- data/spec/factories/users.rb +7 -0
- data/spec/features/admin/post_management_spec.rb +95 -0
- data/spec/features/admin/session_management_spec.rb +40 -0
- data/spec/features/admin/tags_management_spec.rb +59 -0
- data/spec/features/posts_index_spec.rb +28 -0
- data/spec/features/viewing_a_post_spec.rb +21 -0
- data/spec/features/viewing_posts_by_tag_spec.rb +17 -0
- data/spec/helpers/admin/flashes_helper_spec.rb +29 -0
- data/spec/helpers/admin/sessions_helper_spec.rb +56 -0
- data/spec/helpers/markdown_helper_spec.rb +10 -0
- data/spec/models/categorical/tag_spec.rb +35 -0
- data/spec/models/exposition/post_spec.rb +123 -0
- data/spec/models/exposition/user_spec.rb +15 -0
- data/spec/rails_helper.rb +47 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/controllers.rb +6 -0
- data/spec/support/controllers/pagination.rb +17 -0
- data/spec/support/controllers/session_management.rb +20 -0
- data/spec/support/features.rb +6 -0
- data/spec/support/features/pagination.rb +22 -0
- data/spec/support/features/session_management.rb +17 -0
- data/spec/support/models.rb +5 -0
- data/spec/support/models/sluggable.rb +11 -0
- data/spec/tasks/setup_spec.rb +32 -0
- data/spec/views/admin/posts/index.html.haml_spec.rb +16 -0
- metadata +619 -0
@@ -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,95 @@
|
|
1
|
+
require "rails_helper"
|
2
|
+
|
3
|
+
RSpec.feature "Post management", :type => :feature do
|
4
|
+
scenario "user can view posts" do
|
5
|
+
user = create_user_and_login
|
6
|
+
post = create(:post)
|
7
|
+
|
8
|
+
visit exposition.admin_posts_path
|
9
|
+
|
10
|
+
expect(page).to have_text(post.title)
|
11
|
+
end
|
12
|
+
|
13
|
+
it do
|
14
|
+
create_user_and_login
|
15
|
+
paginates(factory: :post, increment: 25, selector: '.post') do
|
16
|
+
visit exposition.admin_posts_path
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
scenario "user can paginate through the posts" do
|
21
|
+
create_user_and_login
|
22
|
+
posts = FactoryGirl.create_list(:post, 26)
|
23
|
+
|
24
|
+
visit exposition.admin_posts_path
|
25
|
+
expect(page).to have_selector('.post', count: 25)
|
26
|
+
click_on('Next')
|
27
|
+
|
28
|
+
expect(page).to have_selector('.post', count: 1)
|
29
|
+
end
|
30
|
+
|
31
|
+
scenario "user can edit posts " do
|
32
|
+
user = create_user_and_login(name: 'Andrew')
|
33
|
+
author = create(:user, name: 'Josh')
|
34
|
+
post = create(:post)
|
35
|
+
tag = create(:tag, label: 'coffee')
|
36
|
+
|
37
|
+
visit exposition.edit_admin_post_path(post)
|
38
|
+
|
39
|
+
expect(page).to have_text(post.title)
|
40
|
+
expect(page).to have_text(post.body)
|
41
|
+
|
42
|
+
fill_in "Title", with: "Hello World!"
|
43
|
+
fill_in "Body", with: "My great idea!"
|
44
|
+
fill_in "Summary", with: "My great summary!"
|
45
|
+
fill_in "Slug", with: "my slug"
|
46
|
+
check "coffee"
|
47
|
+
select "Josh", from: "post[author_id]"
|
48
|
+
check "Published"
|
49
|
+
click_on "Update Post"
|
50
|
+
|
51
|
+
expect(page).to have_text("Hello World!")
|
52
|
+
expect(page).to have_text("My great summary!")
|
53
|
+
expect(page).to have_text("my-slug")
|
54
|
+
expect(page).to have_text("Josh")
|
55
|
+
expect(page).to have_text("Josh")
|
56
|
+
expect(page).to have_text("coffee")
|
57
|
+
expect(page).to have_css(".published")
|
58
|
+
end
|
59
|
+
|
60
|
+
scenario "user can create posts " do
|
61
|
+
user = create_user_and_login(name: 'Andrew')
|
62
|
+
author = create(:user, name: 'Josh')
|
63
|
+
tag = create(:tag, label: 'coffee')
|
64
|
+
|
65
|
+
visit exposition.new_admin_post_path
|
66
|
+
fill_in "Title", with: "Hello World!"
|
67
|
+
fill_in "Body", with: "My great idea!"
|
68
|
+
fill_in "Summary", with: "My great summary!"
|
69
|
+
fill_in "Slug", with: "my slug"
|
70
|
+
select "Josh", from: "post[author_id]"
|
71
|
+
check "coffee"
|
72
|
+
check "Published"
|
73
|
+
click_on "Create Post"
|
74
|
+
|
75
|
+
expect(page).to have_text("Hello World!")
|
76
|
+
expect(page).to have_text("My great summary!")
|
77
|
+
expect(page).to have_text("my-slug")
|
78
|
+
expect(page).to have_css(".published")
|
79
|
+
expect(page).to have_text("Josh")
|
80
|
+
expect(page).to have_text("coffee")
|
81
|
+
expect(page).to have_text("Post successfully created.")
|
82
|
+
end
|
83
|
+
|
84
|
+
scenario "user can fix invalid posts" do
|
85
|
+
user = create_user_and_login
|
86
|
+
visit exposition.new_admin_post_path
|
87
|
+
|
88
|
+
fill_in "Title", with: ""
|
89
|
+
fill_in "Body", with: "1, 2, 3, 4 get your booty on the floor."
|
90
|
+
click_on "Create Post"
|
91
|
+
|
92
|
+
expect(page).to have_text("Title can't be blank")
|
93
|
+
expect(page).to have_text("1, 2, 3, 4 get your booty on the floor.")
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
require "rails_helper"
|
3
|
+
|
4
|
+
RSpec.feature "Session management", :type => :feature do
|
5
|
+
scenario "user gets error message with invalid credentials" do
|
6
|
+
visit exposition.admin_login_path
|
7
|
+
fill_in "Email", with: ''
|
8
|
+
fill_in "Password", with: ''
|
9
|
+
click_on I18n.t("sessions.submit")
|
10
|
+
|
11
|
+
expect(page).to have_content(I18n.t("sessions.failed_login"))
|
12
|
+
|
13
|
+
visit exposition.admin_login_path
|
14
|
+
|
15
|
+
expect(page).to_not have_content(I18n.t("sessions.failed_login"))
|
16
|
+
end
|
17
|
+
|
18
|
+
scenario "user can log in" do
|
19
|
+
user = create(:user, email: 'user@user.com',
|
20
|
+
password: 'password',
|
21
|
+
name: 'Josh')
|
22
|
+
|
23
|
+
login_as(user)
|
24
|
+
|
25
|
+
expect(current_path).to eq(exposition.admin_posts_path)
|
26
|
+
expect(page).to have_content(I18n.t("sessions.destroy"))
|
27
|
+
end
|
28
|
+
|
29
|
+
scenario "user can log out", js: true do
|
30
|
+
user = create(:user, email: 'user@user.com',
|
31
|
+
password: 'password',
|
32
|
+
name: 'Josh')
|
33
|
+
|
34
|
+
login_as(user)
|
35
|
+
click_on(I18n.t("sessions.destroy"))
|
36
|
+
visit exposition.admin_login_path
|
37
|
+
|
38
|
+
expect(page).to_not have_content(I18n.t("sessions.destroy"))
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "rails_helper"
|
2
|
+
|
3
|
+
RSpec.feature "Tag management", :type => :feature do
|
4
|
+
scenario "user can view tags" do
|
5
|
+
create_user_and_login
|
6
|
+
tag = create(:tag)
|
7
|
+
|
8
|
+
visit exposition.admin_tags_path
|
9
|
+
|
10
|
+
expect(page).to have_text(tag.label)
|
11
|
+
end
|
12
|
+
|
13
|
+
it do
|
14
|
+
create_user_and_login
|
15
|
+
paginates(factory: :tag, increment: 25, selector: '.tag') do
|
16
|
+
visit exposition.admin_tags_path
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
scenario "user can create tags " do
|
21
|
+
create_user_and_login
|
22
|
+
|
23
|
+
visit exposition.new_admin_tag_path
|
24
|
+
|
25
|
+
fill_in "Label", with: "my tag"
|
26
|
+
click_on "Create Tag"
|
27
|
+
|
28
|
+
expect(current_path).to eq(exposition.admin_tags_path)
|
29
|
+
expect(page).to have_content("my tag")
|
30
|
+
end
|
31
|
+
|
32
|
+
scenario "user can edit tags " do
|
33
|
+
create_user_and_login
|
34
|
+
tag = create(:tag, label: 'Old Label')
|
35
|
+
|
36
|
+
visit exposition.edit_admin_tag_path(tag)
|
37
|
+
|
38
|
+
fill_in "Label", with: "New Label"
|
39
|
+
click_on "Update Tag"
|
40
|
+
|
41
|
+
expect(current_path).to eq(exposition.admin_tags_path)
|
42
|
+
expect(page).to have_text("New Label")
|
43
|
+
end
|
44
|
+
|
45
|
+
scenario "user can delete tags " do
|
46
|
+
create_user_and_login
|
47
|
+
tag = create(:tag, label: 'My Label')
|
48
|
+
|
49
|
+
visit exposition.admin_tags_path
|
50
|
+
|
51
|
+
expect(page).to have_text("My Label")
|
52
|
+
|
53
|
+
click_on "Delete"
|
54
|
+
|
55
|
+
expect(current_path).to eq(exposition.admin_tags_path)
|
56
|
+
expect(page).to_not have_text("My Label")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|