first commit, largely copied volunteers
This commit is contained in:
5
test/application_system_test_case.rb
Normal file
5
test/application_system_test_case.rb
Normal file
@ -0,0 +1,5 @@
|
||||
require "test_helper"
|
||||
|
||||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
||||
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
|
||||
end
|
0
test/controllers/.keep
Normal file
0
test/controllers/.keep
Normal file
48
test/controllers/members_controller_test.rb
Normal file
48
test/controllers/members_controller_test.rb
Normal file
@ -0,0 +1,48 @@
|
||||
require "test_helper"
|
||||
|
||||
class MembersControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@member = members(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get members_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get new_member_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create member" do
|
||||
assert_difference("Member.count") do
|
||||
post members_url, params: { member: { name: @member.name, public: @member.public } }
|
||||
end
|
||||
|
||||
assert_redirected_to member_url(Member.last)
|
||||
end
|
||||
|
||||
test "should show member" do
|
||||
get member_url(@member)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get edit_member_url(@member)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update member" do
|
||||
patch member_url(@member), params: { member: { name: @member.name, public: @member.public } }
|
||||
assert_redirected_to member_url(@member)
|
||||
end
|
||||
|
||||
test "should destroy member" do
|
||||
assert_difference("Member.count", -1) do
|
||||
delete member_url(@member)
|
||||
end
|
||||
|
||||
assert_redirected_to members_url
|
||||
end
|
||||
end
|
48
test/controllers/pictures_controller_test.rb
Normal file
48
test/controllers/pictures_controller_test.rb
Normal file
@ -0,0 +1,48 @@
|
||||
require "test_helper"
|
||||
|
||||
class PicturesControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@picture = pictures(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get pictures_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get new_picture_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create picture" do
|
||||
assert_difference("Picture.count") do
|
||||
post pictures_url, params: { picture: { member_id: @picture.member_id, picture: @picture.picture, text: @picture.text } }
|
||||
end
|
||||
|
||||
assert_redirected_to picture_url(Picture.last)
|
||||
end
|
||||
|
||||
test "should show picture" do
|
||||
get picture_url(@picture)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get edit_picture_url(@picture)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update picture" do
|
||||
patch picture_url(@picture), params: { picture: { member_id: @picture.member_id, picture: @picture.picture, text: @picture.text } }
|
||||
assert_redirected_to picture_url(@picture)
|
||||
end
|
||||
|
||||
test "should destroy picture" do
|
||||
assert_difference("Picture.count", -1) do
|
||||
delete picture_url(@picture)
|
||||
end
|
||||
|
||||
assert_redirected_to pictures_url
|
||||
end
|
||||
end
|
48
test/controllers/stories_controller_test.rb
Normal file
48
test/controllers/stories_controller_test.rb
Normal file
@ -0,0 +1,48 @@
|
||||
require "test_helper"
|
||||
|
||||
class StoriesControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@story = stories(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get stories_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get new_story_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create story" do
|
||||
assert_difference("Story.count") do
|
||||
post stories_url, params: { story: { happened: @story.happened, header: @story.header, picture: @story.picture, text: @story.text } }
|
||||
end
|
||||
|
||||
assert_redirected_to story_url(Story.last)
|
||||
end
|
||||
|
||||
test "should show story" do
|
||||
get story_url(@story)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get edit_story_url(@story)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update story" do
|
||||
patch story_url(@story), params: { story: { happened: @story.happened, header: @story.header, picture: @story.picture, text: @story.text } }
|
||||
assert_redirected_to story_url(@story)
|
||||
end
|
||||
|
||||
test "should destroy story" do
|
||||
assert_difference("Story.count", -1) do
|
||||
delete story_url(@story)
|
||||
end
|
||||
|
||||
assert_redirected_to stories_url
|
||||
end
|
||||
end
|
4
test/fixtures/action_text/rich_texts.yml
vendored
Normal file
4
test/fixtures/action_text/rich_texts.yml
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# one:
|
||||
# record: name_of_fixture (ClassOfFixture)
|
||||
# name: content
|
||||
# body: <p>In a <i>million</i> stars!</p>
|
0
test/fixtures/files/.keep
vendored
Normal file
0
test/fixtures/files/.keep
vendored
Normal file
9
test/fixtures/members.yml
vendored
Normal file
9
test/fixtures/members.yml
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
public: false
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
public: false
|
11
test/fixtures/pictures.yml
vendored
Normal file
11
test/fixtures/pictures.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
picture: MyString
|
||||
text: MyString
|
||||
member: one
|
||||
|
||||
two:
|
||||
picture: MyString
|
||||
text: MyString
|
||||
member: two
|
13
test/fixtures/stories.yml
vendored
Normal file
13
test/fixtures/stories.yml
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
picture: MyString
|
||||
header: MyString
|
||||
text: MyText
|
||||
happened: 2023-01-11
|
||||
|
||||
two:
|
||||
picture: MyString
|
||||
header: MyString
|
||||
text: MyText
|
||||
happened: 2023-01-11
|
0
test/helpers/.keep
Normal file
0
test/helpers/.keep
Normal file
0
test/integration/.keep
Normal file
0
test/integration/.keep
Normal file
0
test/mailers/.keep
Normal file
0
test/mailers/.keep
Normal file
0
test/models/.keep
Normal file
0
test/models/.keep
Normal file
7
test/models/member_test.rb
Normal file
7
test/models/member_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class MemberTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
7
test/models/picture_test.rb
Normal file
7
test/models/picture_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class PictureTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
7
test/models/story_test.rb
Normal file
7
test/models/story_test.rb
Normal file
@ -0,0 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class StoryTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
18
test/policies/picture_policy_test.rb
Normal file
18
test/policies/picture_policy_test.rb
Normal file
@ -0,0 +1,18 @@
|
||||
require 'test_helper'
|
||||
|
||||
class PicturePolicyTest < ActiveSupport::TestCase
|
||||
def test_scope
|
||||
end
|
||||
|
||||
def test_show
|
||||
end
|
||||
|
||||
def test_create
|
||||
end
|
||||
|
||||
def test_update
|
||||
end
|
||||
|
||||
def test_destroy
|
||||
end
|
||||
end
|
0
test/system/.keep
Normal file
0
test/system/.keep
Normal file
43
test/system/members_test.rb
Normal file
43
test/system/members_test.rb
Normal file
@ -0,0 +1,43 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class MembersTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@member = members(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
visit members_url
|
||||
assert_selector "h1", text: "Members"
|
||||
end
|
||||
|
||||
test "should create member" do
|
||||
visit members_url
|
||||
click_on "New member"
|
||||
|
||||
fill_in "Name", with: @member.name
|
||||
check "Public" if @member.public
|
||||
click_on "Create Member"
|
||||
|
||||
assert_text "Member was successfully created"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should update Member" do
|
||||
visit member_url(@member)
|
||||
click_on "Edit this member", match: :first
|
||||
|
||||
fill_in "Name", with: @member.name
|
||||
check "Public" if @member.public
|
||||
click_on "Update Member"
|
||||
|
||||
assert_text "Member was successfully updated"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should destroy Member" do
|
||||
visit member_url(@member)
|
||||
click_on "Destroy this member", match: :first
|
||||
|
||||
assert_text "Member was successfully destroyed"
|
||||
end
|
||||
end
|
45
test/system/pictures_test.rb
Normal file
45
test/system/pictures_test.rb
Normal file
@ -0,0 +1,45 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class PicturesTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@picture = pictures(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
visit pictures_url
|
||||
assert_selector "h1", text: "Pictures"
|
||||
end
|
||||
|
||||
test "should create picture" do
|
||||
visit pictures_url
|
||||
click_on "New picture"
|
||||
|
||||
fill_in "Member", with: @picture.member_id
|
||||
fill_in "Picture", with: @picture.picture
|
||||
fill_in "Text", with: @picture.text
|
||||
click_on "Create Picture"
|
||||
|
||||
assert_text "Picture was successfully created"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should update Picture" do
|
||||
visit picture_url(@picture)
|
||||
click_on "Edit this picture", match: :first
|
||||
|
||||
fill_in "Member", with: @picture.member_id
|
||||
fill_in "Picture", with: @picture.picture
|
||||
fill_in "Text", with: @picture.text
|
||||
click_on "Update Picture"
|
||||
|
||||
assert_text "Picture was successfully updated"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should destroy Picture" do
|
||||
visit picture_url(@picture)
|
||||
click_on "Destroy this picture", match: :first
|
||||
|
||||
assert_text "Picture was successfully destroyed"
|
||||
end
|
||||
end
|
47
test/system/stories_test.rb
Normal file
47
test/system/stories_test.rb
Normal file
@ -0,0 +1,47 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class StoriesTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@story = stories(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
visit stories_url
|
||||
assert_selector "h1", text: "Stories"
|
||||
end
|
||||
|
||||
test "should create story" do
|
||||
visit stories_url
|
||||
click_on "New story"
|
||||
|
||||
fill_in "Happened", with: @story.happened
|
||||
fill_in "Header", with: @story.header
|
||||
fill_in "Picture", with: @story.picture
|
||||
fill_in "Text", with: @story.text
|
||||
click_on "Create Story"
|
||||
|
||||
assert_text "Story was successfully created"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should update Story" do
|
||||
visit story_url(@story)
|
||||
click_on "Edit this story", match: :first
|
||||
|
||||
fill_in "Happened", with: @story.happened
|
||||
fill_in "Header", with: @story.header
|
||||
fill_in "Picture", with: @story.picture
|
||||
fill_in "Text", with: @story.text
|
||||
click_on "Update Story"
|
||||
|
||||
assert_text "Story was successfully updated"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should destroy Story" do
|
||||
visit story_url(@story)
|
||||
click_on "Destroy this story", match: :first
|
||||
|
||||
assert_text "Story was successfully destroyed"
|
||||
end
|
||||
end
|
13
test/test_helper.rb
Normal file
13
test/test_helper.rb
Normal file
@ -0,0 +1,13 @@
|
||||
ENV["RAILS_ENV"] ||= "test"
|
||||
require_relative "../config/environment"
|
||||
require "rails/test_help"
|
||||
|
||||
class ActiveSupport::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
|
Reference in New Issue
Block a user