generated from FGA0138-MDS-Ajax/template-repository
-
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
cd44a83
commit a44b452
Showing
19 changed files
with
198 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module EstoquesHelper | ||
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,2 @@ | ||
class Estoque < ApplicationRecord | ||
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
class User < ApplicationRecord | ||
belongs_to :cargo | ||
has_many :estoques | ||
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,2 @@ | ||
<div id="<%= dom_id estoque %>"> | ||
</div> |
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,2 @@ | ||
json.extract! estoque, :id, :created_at, :updated_at | ||
json.url estoque_url(estoque, format: :json) |
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,17 @@ | ||
<%= form_with(model: estoque) do |form| %> | ||
<% if estoque.errors.any? %> | ||
<div style="color: red"> | ||
<h2><%= pluralize(estoque.errors.count, "error") %> prohibited this estoque from being saved:</h2> | ||
|
||
<ul> | ||
<% estoque.errors.each do |error| %> | ||
<li><%= error.full_message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div> | ||
<%= form.submit %> | ||
</div> | ||
<% 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,10 @@ | ||
<h1>Editing estoque</h1> | ||
|
||
<%= render "form", estoque: @estoque %> | ||
|
||
<br> | ||
|
||
<div> | ||
<%= link_to "Show this estoque", @estoque %> | | ||
<%= link_to "Back to estoques", estoques_path %> | ||
</div> |
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,14 @@ | ||
<p style="color: green"><%= notice %></p> | ||
|
||
<h1>Estoques</h1> | ||
|
||
<div id="estoques"> | ||
<% @estoques.each do |estoque| %> | ||
<%= render estoque %> | ||
<p> | ||
<%= link_to "Show this estoque", estoque %> | ||
</p> | ||
<% end %> | ||
</div> | ||
|
||
<%= link_to "New estoque", new_estoque_path %> |
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 @@ | ||
json.array! @estoques, partial: "estoques/estoque", as: :estoque |
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,9 @@ | ||
<h1>New estoque</h1> | ||
|
||
<%= render "form", estoque: @estoque %> | ||
|
||
<br> | ||
|
||
<div> | ||
<%= link_to "Back to estoques", estoques_path %> | ||
</div> |
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,10 @@ | ||
<p style="color: green"><%= notice %></p> | ||
|
||
<%= render @estoque %> | ||
|
||
<div> | ||
<%= link_to "Edit this estoque", edit_estoque_path(@estoque) %> | | ||
<%= link_to "Back to estoques", estoques_path %> | ||
|
||
<%= button_to "Destroy this estoque", @estoque, method: :delete %> | ||
</div> |
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 @@ | ||
json.partial! "estoques/estoque", estoque: @estoque |
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,8 @@ | ||
class CreateEstoques < ActiveRecord::Migration[7.1] | ||
def change | ||
create_table :estoques do |t| | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,48 @@ | ||
require "test_helper" | ||
|
||
class EstoquesControllerTest < ActionDispatch::IntegrationTest | ||
setup do | ||
@estoque = estoques(:one) | ||
end | ||
|
||
test "should get index" do | ||
get estoques_url | ||
assert_response :success | ||
end | ||
|
||
test "should get new" do | ||
get new_estoque_url | ||
assert_response :success | ||
end | ||
|
||
test "should create estoque" do | ||
assert_difference("Estoque.count") do | ||
post estoques_url, params: { estoque: { } } | ||
end | ||
|
||
assert_redirected_to estoque_url(Estoque.last) | ||
end | ||
|
||
test "should show estoque" do | ||
get estoque_url(@estoque) | ||
assert_response :success | ||
end | ||
|
||
test "should get edit" do | ||
get edit_estoque_url(@estoque) | ||
assert_response :success | ||
end | ||
|
||
test "should update estoque" do | ||
patch estoque_url(@estoque), params: { estoque: { } } | ||
assert_redirected_to estoque_url(@estoque) | ||
end | ||
|
||
test "should destroy estoque" do | ||
assert_difference("Estoque.count", -1) do | ||
delete estoque_url(@estoque) | ||
end | ||
|
||
assert_redirected_to estoques_url | ||
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,11 @@ | ||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
|
||
# This model initially had no columns defined. If you add columns to the | ||
# model remove the "{}" from the fixture names and add the columns immediately | ||
# below each fixture, per the syntax in the comments below | ||
# | ||
one: {} | ||
# column: value | ||
# | ||
two: {} | ||
# column: value |
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,7 @@ | ||
require "test_helper" | ||
|
||
class EstoqueTest < ActiveSupport::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# 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,39 @@ | ||
require "application_system_test_case" | ||
|
||
class EstoquesTest < ApplicationSystemTestCase | ||
setup do | ||
@estoque = estoques(:one) | ||
end | ||
|
||
test "visiting the index" do | ||
visit estoques_url | ||
assert_selector "h1", text: "Estoques" | ||
end | ||
|
||
test "should create estoque" do | ||
visit estoques_url | ||
click_on "New estoque" | ||
|
||
click_on "Create Estoque" | ||
|
||
assert_text "Estoque was successfully created" | ||
click_on "Back" | ||
end | ||
|
||
test "should update Estoque" do | ||
visit estoque_url(@estoque) | ||
click_on "Edit this estoque", match: :first | ||
|
||
click_on "Update Estoque" | ||
|
||
assert_text "Estoque was successfully updated" | ||
click_on "Back" | ||
end | ||
|
||
test "should destroy Estoque" do | ||
visit estoque_url(@estoque) | ||
click_on "Destroy this estoque", match: :first | ||
|
||
assert_text "Estoque was successfully destroyed" | ||
end | ||
end |