starting with events, tied to profiles (not accounts)

This commit is contained in:
2023-01-16 14:49:45 +02:00
parent 63299d4464
commit cb54951037
19 changed files with 307 additions and 11 deletions

17
test/fixtures/events.yml vendored Normal file
View File

@ -0,0 +1,17 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
text: MyText
start_date: 2023-01-16
end_date: 2023-01-16
profile: one
picture: MyString
two:
name: MyString
text: MyText
start_date: 2023-01-16
end_date: 2023-01-16
profile: two
picture: MyString

View File

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

View File

@ -0,0 +1,18 @@
require 'test_helper'
class EventPolicyTest < ActiveSupport::TestCase
def test_scope
end
def test_show
end
def test_create
end
def test_update
end
def test_destroy
end
end

View File

@ -0,0 +1,51 @@
require "application_system_test_case"
class EventsTest < ApplicationSystemTestCase
setup do
@event = events(:one)
end
test "visiting the index" do
visit events_url
assert_selector "h1", text: "Events"
end
test "should create event" do
visit events_url
click_on "New event"
fill_in "End date", with: @event.end_date
fill_in "Name", with: @event.name
fill_in "Picture", with: @event.picture
fill_in "Profile", with: @event.profile_id
fill_in "Start date", with: @event.start_date
fill_in "Text", with: @event.text
click_on "Create Event"
assert_text "Event was successfully created"
click_on "Back"
end
test "should update Event" do
visit event_url(@event)
click_on "Edit this event", match: :first
fill_in "End date", with: @event.end_date
fill_in "Name", with: @event.name
fill_in "Picture", with: @event.picture
fill_in "Profile", with: @event.profile_id
fill_in "Start date", with: @event.start_date
fill_in "Text", with: @event.text
click_on "Update Event"
assert_text "Event was successfully updated"
click_on "Back"
end
test "should destroy Event" do
visit event_url(@event)
click_on "Destroy this event", match: :first
assert_text "Event was successfully destroyed"
end
end