starting with events, tied to profiles (not accounts)
This commit is contained in:
17
test/fixtures/events.yml
vendored
Normal file
17
test/fixtures/events.yml
vendored
Normal 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
|
7
test/models/event_test.rb
Normal file
7
test/models/event_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class EventTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
18
test/policies/event_policy_test.rb
Normal file
18
test/policies/event_policy_test.rb
Normal 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
|
51
test/system/events_test.rb
Normal file
51
test/system/events_test.rb
Normal 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
|
Reference in New Issue
Block a user