first commit

This commit is contained in:
Kris
2024-02-03 08:34:36 -05:00
commit 2f398caa90
102 changed files with 2717 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
end

View File

@@ -0,0 +1,13 @@
require "test_helper"
module ApplicationCable
class ConnectionTest < ActionCable::Connection::TestCase
# test "connects with cookies" do
# cookies.signed[:user_id] = 42
#
# connect
#
# assert_equal connection.user_id, "42"
# end
end
end

0
test/controllers/.keep Normal file
View File

View File

@@ -0,0 +1,48 @@
require "test_helper"
class SuggestionsControllerTest < ActionDispatch::IntegrationTest
setup do
@suggestion = suggestions(:one)
end
test "should get index" do
get suggestions_url
assert_response :success
end
test "should get new" do
get new_suggestion_url
assert_response :success
end
test "should create suggestion" do
assert_difference("Suggestion.count") do
post suggestions_url, params: { suggestion: { body: @suggestion.body, sent: @suggestion.sent, subject: @suggestion.subject } }
end
assert_redirected_to suggestion_url(Suggestion.last)
end
test "should show suggestion" do
get suggestion_url(@suggestion)
assert_response :success
end
test "should get edit" do
get edit_suggestion_url(@suggestion)
assert_response :success
end
test "should update suggestion" do
patch suggestion_url(@suggestion), params: { suggestion: { body: @suggestion.body, sent: @suggestion.sent, subject: @suggestion.subject } }
assert_redirected_to suggestion_url(@suggestion)
end
test "should destroy suggestion" do
assert_difference("Suggestion.count", -1) do
delete suggestion_url(@suggestion)
end
assert_redirected_to suggestions_url
end
end

0
test/fixtures/files/.keep vendored Normal file
View File

11
test/fixtures/suggestions.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
subject: MyString
body: MyText
sent: false
two:
subject: MyString
body: MyText
sent: false

0
test/helpers/.keep Normal file
View File

0
test/integration/.keep Normal file
View File

0
test/mailers/.keep Normal file
View File

0
test/models/.keep Normal file
View File

View File

@@ -0,0 +1,7 @@
require "test_helper"
class SuggestionTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

0
test/system/.keep Normal file
View File

View File

@@ -0,0 +1,45 @@
require "application_system_test_case"
class SuggestionsTest < ApplicationSystemTestCase
setup do
@suggestion = suggestions(:one)
end
test "visiting the index" do
visit suggestions_url
assert_selector "h1", text: "Suggestions"
end
test "should create suggestion" do
visit suggestions_url
click_on "New suggestion"
fill_in "Body", with: @suggestion.body
check "Sent" if @suggestion.sent
fill_in "Subject", with: @suggestion.subject
click_on "Create Suggestion"
assert_text "Suggestion was successfully created"
click_on "Back"
end
test "should update Suggestion" do
visit suggestion_url(@suggestion)
click_on "Edit this suggestion", match: :first
fill_in "Body", with: @suggestion.body
check "Sent" if @suggestion.sent
fill_in "Subject", with: @suggestion.subject
click_on "Update Suggestion"
assert_text "Suggestion was successfully updated"
click_on "Back"
end
test "should destroy Suggestion" do
visit suggestion_url(@suggestion)
click_on "Destroy this suggestion", match: :first
assert_text "Suggestion was successfully destroyed"
end
end

15
test/test_helper.rb Normal file
View File

@@ -0,0 +1,15 @@
ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
require "rails/test_help"
module ActiveSupport
class TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end
end