-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
daaa581
commit 1315a99
Showing
11 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Growth::Admin::AimCodesController < Growth::Admin::BaseController | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<td><%= model.controller_path %></td> | ||
<td><%= model.action_name %></td> | ||
<td><%= model.code %></td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<th><%= AimCode.human_attribute_name(:controller_path) %></th> | ||
<th><%= AimCode.human_attribute_name(:action_name) %></th> | ||
<th><%= AimCode.human_attribute_name(:code) %></th> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<%= f.text_field :controller_path %> | ||
<%= f.text_field :action_name %> | ||
<%= f.text_field :code %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<tr> | ||
<td class="has-text-right"><%= AimCode.human_attribute_name(:controller_path) %></td> | ||
<td><%= @aim_code.controller_path %></td> | ||
</tr> | ||
<tr> | ||
<td class="has-text-right"><%= AimCode.human_attribute_name(:action_name) %></td> | ||
<td><%= @aim_code.action_name %></td> | ||
</tr> | ||
<tr> | ||
<td class="has-text-right"><%= AimCode.human_attribute_name(:code) %></td> | ||
<td><%= @aim_code.code %></td> | ||
</tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
test/controllers/growth/admin/aim_codes_controller_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
require 'test_helper' | ||
class Growth::Admin::AimCodesControllerTest < ActionDispatch::IntegrationTest | ||
|
||
setup do | ||
@aim_code = aim_codes(:one) | ||
end | ||
|
||
test 'index ok' do | ||
get url_for(controller: 'growth/admin/aim_codes') | ||
|
||
assert_response :success | ||
end | ||
|
||
test 'new ok' do | ||
get url_for(controller: 'growth/admin/aim_codes') | ||
|
||
assert_response :success | ||
end | ||
|
||
test 'create ok' do | ||
assert_difference('AimCode.count') do | ||
post( | ||
url_for(controller: 'growth/admin/aim_codes', action: 'create'), | ||
params: { aim_code: { action_name: @growth_admin_aim_code.action_name, code: @growth_admin_aim_code.code, controller_path: @growth_admin_aim_code.controller_path } }, | ||
as: :turbo_stream | ||
) | ||
end | ||
|
||
assert_response :success | ||
end | ||
|
||
test 'show ok' do | ||
get url_for(controller: 'growth/admin/aim_codes', action: 'show', id: @aim_code.id) | ||
|
||
assert_response :success | ||
end | ||
|
||
test 'edit ok' do | ||
get url_for(controller: 'growth/admin/aim_codes', action: 'edit', id: @aim_code.id) | ||
|
||
assert_response :success | ||
end | ||
|
||
test 'update ok' do | ||
patch( | ||
url_for(controller: 'growth/admin/aim_codes', action: 'update', id: @aim_code.id), | ||
params: { aim_code: { action_name: @growth_admin_aim_code.action_name, code: @growth_admin_aim_code.code, controller_path: @growth_admin_aim_code.controller_path } }, | ||
as: :turbo_stream | ||
) | ||
|
||
assert_response :success | ||
end | ||
|
||
test 'destroy ok' do | ||
assert_difference('AimCode.count', -1) do | ||
delete url_for(controller: 'growth/admin/aim_codes', action: 'destroy', id: @aim_code.id), as: :turbo_stream | ||
end | ||
|
||
assert_response :success | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require "application_system_test_case" | ||
|
||
class AimCodesTest < ApplicationSystemTestCase | ||
setup do | ||
@growth_admin_aim_code = growth_admin_aim_codes(:one) | ||
end | ||
|
||
test "visiting the index" do | ||
visit growth_admin_aim_codes_url | ||
assert_selector "h1", text: "Aim codes" | ||
end | ||
|
||
test "should create aim code" do | ||
visit growth_admin_aim_codes_url | ||
click_on "New aim code" | ||
|
||
fill_in "Action name", with: @growth_admin_aim_code.action_name | ||
fill_in "Code", with: @growth_admin_aim_code.code | ||
fill_in "Controller path", with: @growth_admin_aim_code.controller_path | ||
click_on "Create Aim code" | ||
|
||
assert_text "Aim code was successfully created" | ||
click_on "Back" | ||
end | ||
|
||
test "should update Aim code" do | ||
visit growth_admin_aim_code_url(@growth_admin_aim_code) | ||
click_on "Edit this aim code", match: :first | ||
|
||
fill_in "Action name", with: @growth_admin_aim_code.action_name | ||
fill_in "Code", with: @growth_admin_aim_code.code | ||
fill_in "Controller path", with: @growth_admin_aim_code.controller_path | ||
click_on "Update Aim code" | ||
|
||
assert_text "Aim code was successfully updated" | ||
click_on "Back" | ||
end | ||
|
||
test "should destroy Aim code" do | ||
visit growth_admin_aim_code_url(@growth_admin_aim_code) | ||
click_on "Destroy this aim code", match: :first | ||
|
||
assert_text "Aim code was successfully destroyed" | ||
end | ||
end |