comfortable_mexican_sofa 2.0.9 → 2.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/comfy/vendor/bootstrap.min.js +3 -3
- data/app/assets/stylesheets/comfy/admin/cms/application.sass +1 -2
- data/app/assets/stylesheets/comfy/admin/cms/base.sass +12 -13
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_alert.scss +3 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_button-group.scss +31 -72
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_buttons.scss +26 -19
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_card.scss +23 -12
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_carousel.scss +2 -2
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_close.scss +6 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_code.scss +4 -12
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_custom-forms.scss +124 -84
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_dropdown.scss +30 -2
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_forms.scss +46 -71
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_functions.scss +4 -4
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_images.scss +0 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_input-group.scss +99 -126
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_list-group.scss +2 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_modal.scss +24 -9
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_nav.scss +2 -2
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_navbar.scss +8 -3
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_pagination.scss +32 -19
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_popover.scss +106 -117
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_print.scss +17 -3
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_progress.scss +4 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_reboot.scss +3 -25
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_tables.scss +1 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_tooltip.scss +65 -57
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_type.scss +2 -2
- data/app/assets/stylesheets/comfy/vendor/bootstrap/_variables.scss +174 -108
- data/app/assets/stylesheets/comfy/vendor/bootstrap/bootstrap-grid.scss +32 -0
- data/app/assets/stylesheets/comfy/vendor/bootstrap/bootstrap-reboot.scss +12 -0
- data/app/assets/stylesheets/comfy/vendor/bootstrap/bootstrap.scss +42 -0
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_background-variant.scss +2 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_breakpoints.scss +11 -7
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_buttons.scss +37 -22
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_caret.scss +30 -0
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_forms.scss +48 -19
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_grid-framework.scss +5 -7
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_hover.scss +24 -46
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_list-group.scss +10 -13
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_screen-reader.scss +1 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/mixins/_text-hide.scss +1 -0
- data/app/assets/stylesheets/comfy/vendor/bootstrap/utilities/_borders.scss +6 -1
- data/app/assets/stylesheets/comfy/vendor/bootstrap/utilities/_display.scss +10 -28
- data/app/controllers/comfy/admin/cms/files_controller.rb +6 -7
- data/app/helpers/comfy/admin/cms_helper.rb +5 -4
- data/app/models/concerns/comfy/cms/with_categories.rb +20 -9
- data/app/views/comfy/admin/cms/categories/_edit.html.haml +3 -3
- data/app/views/comfy/admin/cms/categories/_form.html.haml +3 -9
- data/app/views/comfy/admin/cms/categories/_index.html.haml +2 -2
- data/app/views/comfy/admin/cms/categories/_show.html.haml +4 -3
- data/app/views/comfy/admin/cms/categories/create.js.erb +1 -1
- data/app/views/comfy/admin/cms/files/_form.html.haml +11 -12
- data/app/views/comfy/admin/cms/files/edit.html.haml +2 -2
- data/app/views/comfy/admin/cms/files/new.html.haml +2 -2
- data/app/views/comfy/admin/cms/fragments/_form_fragment_attachments.html.haml +7 -5
- data/app/views/comfy/admin/cms/fragments/_form_fragments.html.haml +1 -1
- data/app/views/comfy/admin/cms/layouts/_form.html.haml +3 -2
- data/app/views/comfy/admin/cms/layouts/edit.html.haml +1 -1
- data/app/views/comfy/admin/cms/layouts/new.html.haml +2 -2
- data/app/views/comfy/admin/cms/pages/_form.html.haml +3 -5
- data/app/views/comfy/admin/cms/pages/edit.html.haml +1 -1
- data/app/views/comfy/admin/cms/pages/new.html.haml +1 -1
- data/app/views/comfy/admin/cms/revisions/show.html.haml +2 -2
- data/app/views/comfy/admin/cms/sites/_form.html.haml +4 -4
- data/app/views/comfy/admin/cms/sites/edit.html.haml +1 -1
- data/app/views/comfy/admin/cms/sites/new.html.haml +2 -2
- data/app/views/comfy/admin/cms/snippets/_form.html.haml +2 -2
- data/app/views/comfy/admin/cms/snippets/edit.html.haml +1 -1
- data/app/views/comfy/admin/cms/snippets/new.html.haml +2 -2
- data/app/views/comfy/admin/cms/translations/_form.html.haml +5 -7
- data/app/views/comfy/admin/cms/translations/edit.html.haml +1 -1
- data/app/views/comfy/admin/cms/translations/new.html.haml +2 -2
- data/comfortable_mexican_sofa.gemspec +6 -3
- data/config/locales/fr.yml +33 -33
- data/lib/comfortable_mexican_sofa/content/tags/file.rb +1 -1
- data/lib/comfortable_mexican_sofa/content/tags/files.rb +1 -1
- data/lib/comfortable_mexican_sofa/form_builder.rb +10 -15
- data/lib/comfortable_mexican_sofa/seeds.rb +2 -5
- data/lib/comfortable_mexican_sofa/version.rb +1 -1
- metadata +9 -116
- data/app/assets/stylesheets/comfy/vendor/_bootstrap.scss +0 -42
- data/doc/preview.jpg +0 -0
- data/test/controllers/comfy/admin/cms/base_controller_test.rb +0 -18
- data/test/controllers/comfy/admin/cms/categories_controller_test.rb +0 -74
- data/test/controllers/comfy/admin/cms/files_controller_test.rb +0 -242
- data/test/controllers/comfy/admin/cms/layouts_controller_test.rb +0 -137
- data/test/controllers/comfy/admin/cms/pages_controller_test.rb +0 -580
- data/test/controllers/comfy/admin/cms/revisions/layout_controller_test.rb +0 -62
- data/test/controllers/comfy/admin/cms/revisions/page_controller_test.rb +0 -87
- data/test/controllers/comfy/admin/cms/revisions/snippet_controller_test.rb +0 -60
- data/test/controllers/comfy/admin/cms/revisions/translation_controller_test.rb +0 -68
- data/test/controllers/comfy/admin/cms/sites_controller_test.rb +0 -106
- data/test/controllers/comfy/admin/cms/snippets_controller_test.rb +0 -156
- data/test/controllers/comfy/admin/cms/translations_controller_test.rb +0 -182
- data/test/controllers/comfy/cms/assets_controller_test.rb +0 -61
- data/test/controllers/comfy/cms/content_controller_test.rb +0 -249
- data/test/fixtures/active_storage/attachments.yml +0 -9
- data/test/fixtures/active_storage/blobs.yml +0 -13
- data/test/fixtures/comfy/cms/categories.yml +0 -4
- data/test/fixtures/comfy/cms/categorizations.yml +0 -3
- data/test/fixtures/comfy/cms/files.yml +0 -5
- data/test/fixtures/comfy/cms/fragments.yml +0 -25
- data/test/fixtures/comfy/cms/layouts.yml +0 -34
- data/test/fixtures/comfy/cms/pages.yml +0 -24
- data/test/fixtures/comfy/cms/revisions.yml +0 -29
- data/test/fixtures/comfy/cms/sites.yml +0 -5
- data/test/fixtures/comfy/cms/snippets.yml +0 -6
- data/test/fixtures/comfy/cms/translations.yml +0 -7
- data/test/fixtures/files/data.zip +0 -0
- data/test/fixtures/files/document.pdf +0 -0
- data/test/fixtures/files/image.gif +0 -0
- data/test/fixtures/files/image.jpg +0 -0
- data/test/fixtures/generators/cms/application.rb +0 -7
- data/test/fixtures/generators/cms/routes.rb +0 -5
- data/test/fixtures/generators/scaffold/controller.rb +0 -62
- data/test/fixtures/generators/scaffold/migration.rb +0 -9
- data/test/fixtures/generators/scaffold/model.rb +0 -21
- data/test/fixtures/generators/scaffold/routes.rb +0 -6
- data/test/fixtures/generators/scaffold/tests/controller.rb +0 -111
- data/test/fixtures/generators/scaffold/tests/fixture +0 -2
- data/test/fixtures/generators/scaffold/tests/model.rb +0 -24
- data/test/fixtures/generators/scaffold/views/_form.haml +0 -5
- data/test/fixtures/generators/scaffold/views/edit.haml +0 -5
- data/test/fixtures/generators/scaffold/views/index.haml +0 -21
- data/test/fixtures/generators/scaffold/views/new.haml +0 -5
- data/test/fixtures/generators/scaffold/views/show.haml +0 -4
- data/test/fixtures/views/_nav_hook.html.erb +0 -1
- data/test/fixtures/views/_nav_hook_2.html.erb +0 -1
- data/test/fixtures/views/render_test/_test.html.erb +0 -1
- data/test/fixtures/views/render_test/new.html.erb +0 -1
- data/test/fixtures/views/render_test/render_layout.html.erb +0 -1
- data/test/gemfiles/5.2.gemfile +0 -19
- data/test/generators/cms_assets_generator_test.rb +0 -14
- data/test/generators/cms_controllers_generator_test.rb +0 -14
- data/test/generators/cms_generator_test.rb +0 -26
- data/test/generators/cms_models_generator_test.rb +0 -14
- data/test/generators/cms_views_generator_test.rb +0 -14
- data/test/generators/scaffold_generator_test.rb +0 -32
- data/test/helpers/cms_helper_test.rb +0 -106
- data/test/integration/access_control_test.rb +0 -179
- data/test/integration/i18n_test.rb +0 -38
- data/test/integration/meta_variables_test.rb +0 -27
- data/test/integration/render_cms_test.rb +0 -255
- data/test/integration/routing_test.rb +0 -19
- data/test/integration/seeds_test.rb +0 -75
- data/test/integration/sites_test.rb +0 -107
- data/test/integration/view_hooks_test.rb +0 -47
- data/test/lib/configuration_test.rb +0 -38
- data/test/lib/content/block_test.rb +0 -26
- data/test/lib/content/params_parser_test.rb +0 -126
- data/test/lib/content/renderer_test.rb +0 -276
- data/test/lib/content/tag_test.rb +0 -58
- data/test/lib/content/tags/asset_test.rb +0 -104
- data/test/lib/content/tags/checkbox_test.rb +0 -21
- data/test/lib/content/tags/date_test.rb +0 -21
- data/test/lib/content/tags/datetime_test.rb +0 -21
- data/test/lib/content/tags/file_link_test.rb +0 -91
- data/test/lib/content/tags/file_test.rb +0 -69
- data/test/lib/content/tags/files_test.rb +0 -52
- data/test/lib/content/tags/fragment_test.rb +0 -68
- data/test/lib/content/tags/helper_test.rb +0 -62
- data/test/lib/content/tags/markdown_test.rb +0 -37
- data/test/lib/content/tags/number_test.rb +0 -14
- data/test/lib/content/tags/partial_test.rb +0 -65
- data/test/lib/content/tags/snippet_test.rb +0 -37
- data/test/lib/content/tags/template_test.rb +0 -51
- data/test/lib/content/tags/text_test.rb +0 -14
- data/test/lib/content/tags/textarea_test.rb +0 -14
- data/test/lib/content/tags/wysiwyg_test.rb +0 -14
- data/test/lib/revisions_test.rb +0 -222
- data/test/lib/seeds/files_test.rb +0 -97
- data/test/lib/seeds/layouts_test.rb +0 -156
- data/test/lib/seeds/pages_test.rb +0 -230
- data/test/lib/seeds/snippets_test.rb +0 -99
- data/test/lib/seeds_test.rb +0 -51
- data/test/models/categorization_test.rb +0 -76
- data/test/models/category_test.rb +0 -39
- data/test/models/file_test.rb +0 -43
- data/test/models/fragment_test.rb +0 -132
- data/test/models/layout_test.rb +0 -194
- data/test/models/page_test.rb +0 -575
- data/test/models/site_test.rb +0 -190
- data/test/models/snippet_test.rb +0 -56
- data/test/models/translation_test.rb +0 -67
- data/test/system/layouts_frontend_test.rb +0 -15
- data/test/system/pages_frontend_test.rb +0 -15
- data/test/system/sites_frontend_test.rb +0 -11
- data/test/system/snippets_frontend_test.rb +0 -15
- data/test/tasks/cms_seeds_test.rb +0 -34
- data/test/test_helper.rb +0 -201
@@ -1,25 +0,0 @@
|
|
1
|
-
default:
|
2
|
-
record: default (Comfy::Cms::Page)
|
3
|
-
identifier: content
|
4
|
-
tag: text
|
5
|
-
content: content
|
6
|
-
|
7
|
-
file:
|
8
|
-
record: default (Comfy::Cms::Page)
|
9
|
-
identifier: file
|
10
|
-
tag: file
|
11
|
-
content:
|
12
|
-
|
13
|
-
datetime:
|
14
|
-
record: default (Comfy::Cms::Page)
|
15
|
-
identifier: datetime
|
16
|
-
tag: datetime
|
17
|
-
content:
|
18
|
-
datetime: <%= DateTime.parse("1981-10-04 12:34:56") %>
|
19
|
-
|
20
|
-
boolean:
|
21
|
-
record: default (Comfy::Cms::Page)
|
22
|
-
identifier: boolean
|
23
|
-
tag: checkbox
|
24
|
-
content:
|
25
|
-
boolean: true
|
@@ -1,34 +0,0 @@
|
|
1
|
-
default:
|
2
|
-
site: default
|
3
|
-
label: Default Layout
|
4
|
-
identifier: default
|
5
|
-
parent:
|
6
|
-
content: |-
|
7
|
-
{{cms:textarea content}}
|
8
|
-
css: default_css
|
9
|
-
js: default_js
|
10
|
-
position: 0
|
11
|
-
|
12
|
-
nested:
|
13
|
-
site: default
|
14
|
-
label: Nested Layout
|
15
|
-
identifier: nested
|
16
|
-
parent:
|
17
|
-
content: |-
|
18
|
-
{{cms:text header}}
|
19
|
-
{{cms:textarea content}}
|
20
|
-
css: nested_css
|
21
|
-
js: nested_js
|
22
|
-
position: 0
|
23
|
-
|
24
|
-
child:
|
25
|
-
site: default
|
26
|
-
label: Child Layout
|
27
|
-
identifier: child
|
28
|
-
parent: nested
|
29
|
-
content: |-
|
30
|
-
{{cms:textarea left_column}}
|
31
|
-
{{cms:textarea right_column}}
|
32
|
-
css: child_css
|
33
|
-
js: child_js
|
34
|
-
position: 0
|
@@ -1,24 +0,0 @@
|
|
1
|
-
default:
|
2
|
-
site: default
|
3
|
-
parent:
|
4
|
-
target_page:
|
5
|
-
layout: default
|
6
|
-
label: Default Page
|
7
|
-
slug:
|
8
|
-
full_path: '/'
|
9
|
-
children_count: 1
|
10
|
-
position: 0
|
11
|
-
is_published: true
|
12
|
-
content_cache:
|
13
|
-
|
14
|
-
child:
|
15
|
-
site: default
|
16
|
-
parent: default
|
17
|
-
target_page:
|
18
|
-
layout: default
|
19
|
-
label: Child Page
|
20
|
-
slug: 'child-page'
|
21
|
-
full_path: '/child-page'
|
22
|
-
children_count: 0
|
23
|
-
position: 0
|
24
|
-
is_published: true
|
@@ -1,29 +0,0 @@
|
|
1
|
-
layout:
|
2
|
-
record: default (Comfy::Cms::Layout)
|
3
|
-
data: <%= {
|
4
|
-
'content' => 'revision {{cms:fragment content}}',
|
5
|
-
'css' => 'revision css',
|
6
|
-
'js' => 'revision js' }.to_yaml.inspect %>
|
7
|
-
|
8
|
-
page:
|
9
|
-
record: default (Comfy::Cms::Page)
|
10
|
-
data: <%= {
|
11
|
-
'fragments_attributes' => [
|
12
|
-
{ 'identifier' => 'content',
|
13
|
-
'content' => 'old content' },
|
14
|
-
{ 'identifier' => 'title',
|
15
|
-
'content' => 'old title'}
|
16
|
-
]}.to_yaml.inspect %>
|
17
|
-
|
18
|
-
translation:
|
19
|
-
record: default (Comfy::Cms::Translation)
|
20
|
-
data: <%= {
|
21
|
-
"fragments_attributes" => [
|
22
|
-
{ "identifier" => "content",
|
23
|
-
"content" => "old content" }
|
24
|
-
]}.to_yaml.inspect %>
|
25
|
-
|
26
|
-
snippet:
|
27
|
-
record: default (Comfy::Cms::Snippet)
|
28
|
-
data: <%= {
|
29
|
-
'content' => 'revision content' }.to_yaml.inspect %>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,7 +0,0 @@
|
|
1
|
-
module TestApp
|
2
|
-
class Application < Rails::Application
|
3
|
-
# Ensuring that ActiveStorage routes are loaded before Comfy's globbing
|
4
|
-
# route. Without this file serving routes are inaccessible.
|
5
|
-
config.railties_order = [ActiveStorage::Engine, :main_app, :all]
|
6
|
-
end
|
7
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
class Admin::FoosController < Comfy::Admin::BaseController
|
2
|
-
|
3
|
-
before_action :build_foo, only: [:new, :create]
|
4
|
-
before_action :load_foo, only: [:show, :edit, :update, :destroy]
|
5
|
-
|
6
|
-
def index
|
7
|
-
@foos = Foo.page(params[:page])
|
8
|
-
end
|
9
|
-
|
10
|
-
def show
|
11
|
-
render
|
12
|
-
end
|
13
|
-
|
14
|
-
def new
|
15
|
-
render
|
16
|
-
end
|
17
|
-
|
18
|
-
def edit
|
19
|
-
render
|
20
|
-
end
|
21
|
-
|
22
|
-
def create
|
23
|
-
@foo.save!
|
24
|
-
flash[:success] = 'Foo created'
|
25
|
-
redirect_to action: :show, id: @foo
|
26
|
-
rescue ActiveRecord::RecordInvalid
|
27
|
-
flash.now[:danger] = 'Failed to create Foo'
|
28
|
-
render action: :new
|
29
|
-
end
|
30
|
-
|
31
|
-
def update
|
32
|
-
@foo.update_attributes!(foo_params)
|
33
|
-
flash[:success] = 'Foo updated'
|
34
|
-
redirect_to action: :show, id: @foo
|
35
|
-
rescue ActiveRecord::RecordInvalid
|
36
|
-
flash.now[:danger] = 'Failed to update Foo'
|
37
|
-
render action: :edit
|
38
|
-
end
|
39
|
-
|
40
|
-
def destroy
|
41
|
-
@foo.destroy
|
42
|
-
flash[:success] = 'Foo deleted'
|
43
|
-
redirect_to action: :index
|
44
|
-
end
|
45
|
-
|
46
|
-
protected
|
47
|
-
|
48
|
-
def build_foo
|
49
|
-
@foo = Foo.new(foo_params)
|
50
|
-
end
|
51
|
-
|
52
|
-
def load_foo
|
53
|
-
@foo = Foo.find(params[:id])
|
54
|
-
rescue ActiveRecord::RecordNotFound
|
55
|
-
flash[:danger] = 'Foo not found'
|
56
|
-
redirect_to action: :index
|
57
|
-
end
|
58
|
-
|
59
|
-
def foo_params
|
60
|
-
params.fetch(:foo, {}).permit(:bar)
|
61
|
-
end
|
62
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class Foo < ActiveRecord::Base
|
2
|
-
|
3
|
-
# -- Relationships -----------------------------------------------------------
|
4
|
-
|
5
|
-
|
6
|
-
# -- Callbacks ---------------------------------------------------------------
|
7
|
-
|
8
|
-
|
9
|
-
# -- Validations -------------------------------------------------------------
|
10
|
-
|
11
|
-
|
12
|
-
# -- Scopes ------------------------------------------------------------------
|
13
|
-
|
14
|
-
|
15
|
-
# -- Class Methods -----------------------------------------------------------
|
16
|
-
|
17
|
-
|
18
|
-
# -- Instance Methods --------------------------------------------------------
|
19
|
-
|
20
|
-
|
21
|
-
end
|
@@ -1,111 +0,0 @@
|
|
1
|
-
require_relative '../../test_helper'
|
2
|
-
|
3
|
-
class Admin::FoosControllerTest < ActionDispatch::IntegrationTest
|
4
|
-
|
5
|
-
setup do
|
6
|
-
@foo = foos(:default)
|
7
|
-
end
|
8
|
-
|
9
|
-
# Vanilla CMS has BasicAuth, so we need to send that with each request.
|
10
|
-
# Change this to fit your app's authentication strategy.
|
11
|
-
# Move this to test_helper.rb
|
12
|
-
def r(verb, path, options = {})
|
13
|
-
headers = options[:headers] || {}
|
14
|
-
headers['HTTP_AUTHORIZATION'] =
|
15
|
-
ActionController::HttpAuthentication::Basic.encode_credentials(
|
16
|
-
ComfortableMexicanSofa::AccessControl::AdminAuthentication.username,
|
17
|
-
ComfortableMexicanSofa::AccessControl::AdminAuthentication.password
|
18
|
-
)
|
19
|
-
options.merge!(headers: headers)
|
20
|
-
send(verb, path, options)
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_get_index
|
24
|
-
r :get, admin_foos_path
|
25
|
-
assert_response :success
|
26
|
-
assert assigns(:foos)
|
27
|
-
assert_template :index
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_get_show
|
31
|
-
r :get, admin_foo_path(@foo)
|
32
|
-
assert_response :success
|
33
|
-
assert assigns(:foo)
|
34
|
-
assert_template :show
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_get_show_failure
|
38
|
-
r :get, admin_foo_path('invalid')
|
39
|
-
assert_response :redirect
|
40
|
-
assert_redirected_to action: :index
|
41
|
-
assert_equal 'Foo not found', flash[:danger]
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_get_new
|
45
|
-
r :get, new_admin_foo_path
|
46
|
-
assert_response :success
|
47
|
-
assert assigns(:foo)
|
48
|
-
assert_template :new
|
49
|
-
assert_select "form[action='/admin/foos']"
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_get_edit
|
53
|
-
r :get, edit_admin_foo_path(@foo)
|
54
|
-
assert_response :success
|
55
|
-
assert assigns(:foo)
|
56
|
-
assert_template :edit
|
57
|
-
assert_select "form[action='/admin/foos/#{@foo.id}']"
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_creation
|
61
|
-
assert_difference 'Foo.count' do
|
62
|
-
r :post, admin_foos_path, params: {foo: {
|
63
|
-
bar: 'test bar',
|
64
|
-
}}
|
65
|
-
foo = Foo.last
|
66
|
-
assert_response :redirect
|
67
|
-
assert_redirected_to action: :show, id: foo
|
68
|
-
assert_equal 'Foo created', flash[:success]
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_creation_failure
|
73
|
-
assert_no_difference 'Foo.count' do
|
74
|
-
r :post, admin_foos_path, params: {foo: { }}
|
75
|
-
assert_response :success
|
76
|
-
assert_template :new
|
77
|
-
assert_equal 'Failed to create Foo', flash[:danger]
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_update
|
82
|
-
r :put, admin_foo_path(@foo), params: {foo: {
|
83
|
-
bar: 'Updated'
|
84
|
-
}}
|
85
|
-
assert_response :redirect
|
86
|
-
assert_redirected_to action: :show, id: @foo
|
87
|
-
assert_equal 'Foo updated', flash[:success]
|
88
|
-
@foo.reload
|
89
|
-
assert_equal 'Updated', @foo.bar
|
90
|
-
end
|
91
|
-
|
92
|
-
def test_update_failure
|
93
|
-
r :put, admin_foo_path(@foo), params: {foo: {
|
94
|
-
bar: ''
|
95
|
-
}}
|
96
|
-
assert_response :success
|
97
|
-
assert_template :edit
|
98
|
-
assert_equal 'Failed to update Foo', flash[:danger]
|
99
|
-
@foo.reload
|
100
|
-
refute_equal '', @foo.bar
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_destroy
|
104
|
-
assert_difference 'Foo.count', -1 do
|
105
|
-
r :delete, admin_foo_path(@foo)
|
106
|
-
assert_response :redirect
|
107
|
-
assert_redirected_to action: :index
|
108
|
-
assert_equal 'Foo deleted', flash[:success]
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require_relative '../test_helper'
|
2
|
-
|
3
|
-
class FooTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def test_fixtures_validity
|
6
|
-
Foo.all.each do |foo|
|
7
|
-
assert foo.valid?, foo.errors.inspect
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_validation
|
12
|
-
foo = Foo.new
|
13
|
-
assert foo.invalid?
|
14
|
-
assert_equal [:bar], foo.errors.keys
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_creation
|
18
|
-
assert_difference 'Foo.count' do
|
19
|
-
Foo.create(
|
20
|
-
bar: 'test bar',
|
21
|
-
)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|