-
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.
add tests for water trckers controller
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
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,48 @@ | ||
require "test_helper" | ||
|
||
class WaterTrackersControllerTest < ActionDispatch::IntegrationTest | ||
setup do | ||
@watertracker = watertrackers(:one) | ||
end | ||
|
||
test "should get index" do | ||
get watertrackers_url | ||
assert_response :success | ||
end | ||
|
||
test "should get new" do | ||
get new_watertracker_url | ||
assert_response :success | ||
end | ||
|
||
test "should create watertracker" do | ||
assert_difference("Watertracker.count") do | ||
post watertrackers_url, params: { watertracker: { date: '2006-6-6' } } | ||
end | ||
|
||
assert_redirected_to watertracker_url(Watertracker.last) | ||
end | ||
|
||
test "should show watertracker" do | ||
get watertracker_url(@watertracker) | ||
assert_response :success | ||
end | ||
|
||
test "should get edit" do | ||
get edit_watertracker_url(@watertracker) | ||
assert_response :success | ||
end | ||
|
||
test "should update watertracker" do | ||
patch watertracker_url(@watertracker), params: { watertracker: { date: '2006-06-06' } } | ||
assert_redirected_to watertracker_url(@watertracker) | ||
end | ||
|
||
test "should destroy watertracker" do | ||
assert_difference("Watertracker.count", -1) do | ||
delete watertracker_url(@watertracker) | ||
end | ||
|
||
assert_redirected_to watertracker_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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
|
||
one: | ||
id: 1 | ||
date: 2024-02-24 | ||
|
||
two: | ||
id: 2 | ||
date: 2024-03-02 |