Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy Sprint 1 code to prod #26

Closed
wants to merge 75 commits into from
Closed
Changes from 8 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
ed97691
User MVC+SOA added
OwenSanzas Oct 2, 2024
471110d
create basic stubbed game controller
nandiniiys Oct 2, 2024
f3f7e52
basic landing page
Wu-Junchao Oct 2, 2024
fadea97
SCRUM9+4_integration_test
nandiniiys Oct 2, 2024
a4852ea
initial base scrum9+4 for integration
nandiniiys Oct 2, 2024
0fe1e36
remove unused attribute for the db
Wu-Junchao Oct 2, 2024
2c19bd3
add back deleted health check route
nandiniiys Oct 2, 2024
04b45df
remove duplicate files, add basic front-end functions to main page
Wu-Junchao Oct 3, 2024
06e4ba8
Merge pull request #10 from tamu-edu-students/SCRUM-9-and-4
Wu-Junchao Oct 3, 2024
a0c00fd
pre-deployment
OwenSanzas Oct 3, 2024
ef61227
Update credentials with new Google configuration
OwenSanzas Oct 3, 2024
14577ec
Update Gemfile.lock
OwenSanzas Oct 3, 2024
d30dd03
Initial commit
OwenSanzas Oct 3, 2024
0e99bee
Merge branch 'main' into SCRUM-1-UserAPI
OwenSanzas Oct 3, 2024
aa146ff
Fixed find_by_id
OwenSanzas Oct 3, 2024
06438ea
added guest, user seperation
krishnacalindi Oct 3, 2024
e87b213
continue as guest
krishnacalindi Oct 3, 2024
9252b0c
User MVC+SOA added
OwenSanzas Oct 2, 2024
c1cf190
basic model migration
AntonioRosV Sep 28, 2024
635eb66
main roles seed
AntonioRosV Sep 28, 2024
8483c21
tweaked schema for user
AntonioRosV Oct 2, 2024
0d8e557
model correction
AntonioRosV Oct 2, 2024
4d79ead
basic model migration
AntonioRosV Sep 28, 2024
6955171
migration adjustment
AntonioRosV Oct 2, 2024
87bb131
basic model migration
AntonioRosV Sep 28, 2024
6f6056e
migration adjustment
AntonioRosV Oct 2, 2024
cf3d9dc
role restrictions for index
AntonioRosV Oct 3, 2024
02ada92
rebase and fixed conflicts
AntonioRosV Oct 3, 2024
76b1578
Made the login page look better
singhaltejas Oct 3, 2024
ca6b45f
role integration with users
AntonioRosV Oct 3, 2024
9b3abca
Merge pull request #12 from tamu-edu-students/SCRUM-3-model-view-for-…
krishnacalindi Oct 3, 2024
01b65b9
fixed new user role assignment
AntonioRosV Oct 3, 2024
5bd5f77
reset appropriate user role
AntonioRosV Oct 3, 2024
7bbf83d
Merge pull request #13 from tamu-edu-students/fix-new-user-role
krishnacalindi Oct 3, 2024
1b6ade1
Merge branch 'SCRUM-8-access-for-roles' of https://github.com/tamu-ed…
singhaltejas Oct 3, 2024
e95422a
scrum-4-add UI view for game demo page
nandiniiys Oct 3, 2024
74807ed
Merge pull request #15 from tamu-edu-students/scrum-4-demo-games
Wu-Junchao Oct 3, 2024
eb76cb8
ignores credentials.yml
krishnacalindi Oct 3, 2024
7410b5a
ignores credentials.yml
krishnacalindi Oct 3, 2024
50a421e
remove credential files
krishnacalindi Oct 3, 2024
99e76ea
add creds files to gitignore
nandiniiys Oct 3, 2024
decefc9
Merge pull request #16 from tamu-edu-students/no-issue-gitignore-cred…
nandiniiys Oct 3, 2024
638ac0e
scrum-4-add UI view for game demo page
nandiniiys Oct 3, 2024
c17d154
add creds files to gitignore
nandiniiys Oct 3, 2024
789aa09
Merge branch 'main' into scrum-8-access-for-roles
krishnacalindi Oct 3, 2024
7db44a5
Merge pull request #17 from tamu-edu-students/scrum-8-access-for-roles
nandiniiys Oct 3, 2024
f92cfb1
improvements to role model, app flow, oauth cred loading
krishnacalindi Oct 4, 2024
62a08c3
make website uniform
nandiniiys Oct 4, 2024
f3f5890
remove ref to role name
nandiniiys Oct 4, 2024
2a2b90b
fix relative path for accessibility partial
nandiniiys Oct 4, 2024
efa667f
button and route fixes
krishnacalindi Oct 4, 2024
b82f3ab
Merge pull request #18 from tamu-edu-students/scrum-4-make-partial-fo…
krishnacalindi Oct 4, 2024
1a3dc6f
Merge branch 'main' into scrum-1-fixes
krishnacalindi Oct 4, 2024
a72c329
updated functioning for role view
krishnacalindi Oct 4, 2024
3d1129a
Merge pull request #19 from tamu-edu-students/scrum-1-fixes
nandiniiys Oct 4, 2024
9c6af39
rspec tests for users and roles
krishnacalindi Oct 4, 2024
4952cb4
game rspec tests
krishnacalindi Oct 4, 2024
7a8c647
write uat tests
nandiniiys Oct 4, 2024
d98d517
Update test-and-coverage.yml
nandiniiys Oct 4, 2024
9a17546
Update test-and-coverage.yml
nandiniiys Oct 4, 2024
3327d4d
Merge pull request #22 from tamu-edu-students/scrum-1-test-1
krishnacalindi Oct 4, 2024
ad6910d
Merge branch 'main' into nandiniiys-patch-1
nandiniiys Oct 4, 2024
e64f19f
Update test-and-coverage.yml
nandiniiys Oct 4, 2024
9d80c6d
Merge pull request #21 from tamu-edu-students/nandiniiys-patch-1
nandiniiys Oct 4, 2024
9c85a66
Merge branch 'main' into cucumber_tests
nandiniiys Oct 4, 2024
45ac66f
Update test-and-coverage.yml
nandiniiys Oct 4, 2024
aaf195f
Merge pull request #23 from tamu-edu-students/nandiniiys-patch-1
nandiniiys Oct 4, 2024
59c7d1a
Merge branch 'main' into cucumber_tests
nandiniiys Oct 4, 2024
734d1f4
Update test-and-coverage.yml
nandiniiys Oct 4, 2024
8c3d5b9
Merge pull request #24 from tamu-edu-students/nandiniiys-patch-1
nandiniiys Oct 4, 2024
c0c4746
Merge branch 'main' into cucumber_tests
nandiniiys Oct 4, 2024
9e46475
fix unit tests
nandiniiys Oct 4, 2024
ef054a3
fix rubocop style issues
nandiniiys Oct 4, 2024
dbac555
fixed rspec cov
krishnacalindi Oct 4, 2024
6532f2e
Merge pull request #20 from tamu-edu-students/cucumber_tests
nandiniiys Oct 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
@@ -14,4 +14,6 @@
*= require_self
*/

@import "welcome"; /* Imports the welcome.css file */
@import "welcome.css"; /* Imports the welcome.css file */
@import "games.css"; /* Imports the welcome.css file */
@import "users.css"; /* Imports the welcome.css file */
51 changes: 28 additions & 23 deletions app/services/user_service.rb
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
# app/services/user_service.rb
class UserService
def self.find_or_create_user(auth)
uid = auth["uid"]
email = auth["info"]["email"]
names = auth["info"]["name"].split
first_name = names[0]
last_name = names[1..].join(" ")

user = UserRepository.find_by_email(email)

unless user
user = UserRepository.create_user(
uid: uid,
email: email,
first_name: first_name,
last_name: last_name
)
Role.create(user_id: user.id, role: "Member")
end
user
uid = auth["uid"]
email = auth["info"]["email"]
names = auth["info"]["name"].split
first_name = names[0]
last_name = names[1..].join(" ")

if Rails.env.test?
email_to_find = email.present? ? email : "spongey@tamu.edu"
user = UserRepository.find_by_email(email_to_find)
end

unless user
user = UserRepository.create_user(
uid: uid,
email: email,
first_name: first_name,
last_name: last_name
)
Role.create(user_id: user.id, role: "Member")
end

user
end

def self.find_user_by_id(id)
UserRepository.find_by_id(id)
UserRepository.find_by_id(id)
end

def self.fetch_all
UserRepository.fetch_all()
UserRepository.fetch_all
end
end
end

22 changes: 17 additions & 5 deletions db/seeds.rb
Original file line number Diff line number Diff line change
@@ -18,12 +18,24 @@
Game.find_or_create_by!(game)
end

initial_users = [
{ first_name: 'Krishna', last_name: "Calindi", email: "kxc@tamu.edu", uid: 1 },
{ first_name: "Philip", last_name: "Ritchey", email: "pcr@tamu.edu", uid: 0 }
]
if Rails.env.development?
user = { first_name: 'Krishna', last_name: "Calindi", email: "kxc@tamu.edu", uid: 0 }
new_user = User.find_or_create_by(user)
Role.find_or_create_by!(user_id: new_user.id, role: "System Admin")
end

initial_users.each do |user|
if Rails.env.production?
user = { first_name: "Philip", last_name: "Ritchey", email: "pcr@tamu.edu", uid: 0 }
new_user = User.find_or_create_by(user)
Role.find_or_create_by!(user_id: new_user.id, role: "System Admin")
end

if Rails.env.test?
test_user = { first_name: 'Spongebob', last_name: 'Squarepants', email: 'spongey@tamu.edu', uid: 0 }
new_user = User.find_or_create_by(test_user)
Role.find_or_create_by!(user_id: new_user.id, role: "System Admin")

test_member_user = { first_name: 'Patrick', last_name: 'Star', email: 'starry@tamu.edu', uid: 1 }
new_member_user = User.find_or_create_by(test_member_user)
Role.find_or_create_by!(user_id: new_member_user.id, role: "Member")
end
23 changes: 23 additions & 0 deletions features/account_management.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Feature: Login and Account Creation

Scenario: view my profile as a logged in user
Given I am logged into Arcade
Then I should see "My Account"
When I press "My Account"
Then I should see "Profile"
When I select "Profile" from the dropdown
Then I should see "View Profile Details"
And I should see "Spongebob"
And I should see "Squarepants"
And I should see "spongey@tamu.edu"

Scenario: edit my profile as a logged in user
Given I am logged into Arcade
Then I should see "My Account"
When I press "My Account"
Then I should see "Profile"
When I select "Profile" from the dropdown
Then I should see "View Profile Details"
When I follow "Edit Account"
Then I should see "Profile Details"
And I should not see "email"
23 changes: 23 additions & 0 deletions features/login.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Feature: Login and Account Creation

Scenario: access Arcade as a guest user
Given I am on the login page
Then I should see "Welcome to CSE 606 Team Arcade's Project"
When I press "Continue as Guest"
Then I should see "Welcome, Guest!"
And I should not see "You are logged in as"
And I should not see "My Account"
And I should see "Games"
When I follow "Play"
Then I should see "Spelling Bee"

Scenario: login to arcade with Google
Given I am on the login page
Then I should see "Welcome to CSE 606 Team Arcade's Project"
And I should see "Login with Google"
When I login as System Admin
Then I should see "Howdy Spongebob!"
And I should see "You are logged in as System Admin"
And I should see "All Users for Admin"
And I should see "My Account"
And I should see "Games"
9 changes: 9 additions & 0 deletions features/roles.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Feature: Login and Account Creation

Scenario: as system admin I should see all users
Given I am logged into Arcade
Then I should see "All Users for Admin"
When I follow "All Users for Admin"
Then I should see "All Users"
And I should see "Spongebob"
And I should see "Patrick"
10 changes: 10 additions & 0 deletions features/step_definitions/account_management_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Given('I am logged into Arcade') do
visit(welcome_index_path)
OmniAuth.config.test_mode = true
click_button("Login with Google")
end

When('I select {string} from the dropdown') do |option|
find('.dropbtn').click
find('.dropdown-content a', text: option).click
end
29 changes: 29 additions & 0 deletions features/step_definitions/login_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Given('I am on the login page') do
visit(welcome_index_path)
end

Then('I should see {string}') do |string|
expect(page).to have_content(string)
end

When('I press {string}') do |string|
click_button(string)
end

When('I follow {string}') do |string|
first(:link, string).click
end

Then('I should not see {string}') do |string|
expect(page).not_to have_content(string)
end

When('I login as System Admin') do
OmniAuth.config.test_mode = true
click_button("Login with Google")
end

When('I go to the landing page') do
save_and_open_page
visit(games_path)
end
42 changes: 21 additions & 21 deletions spec/services/user_service_spec.rb
Original file line number Diff line number Diff line change
@@ -12,30 +12,30 @@
}
end

context 'when no user' do
before do
allow(UserRepository).to receive(:find_by_email).with(auth["info"]["email"]).and_return(nil)
allow(UserRepository).to receive(:create_user).with(
uid: auth["uid"],
email: auth["info"]["email"],
first_name: "Test",
last_name: "User"
).and_return(User.new(id: 1, uid: auth["uid"], email: auth["info"]["email"], first_name: "Test", last_name: "User"))
allow(Role).to receive(:create)
end

it 'creates new user' do
user = UserService.find_or_create_user(auth)

expect(user.uid).to eq("1")
expect(user.email).to eq("test@tamu.edu")
expect(UserRepository).to have_received(:create_user)
expect(Role).to have_received(:create).with(user_id: user.id, role: "Member")
end
context 'when no user' do
before do
allow(UserRepository).to receive(:find_by_email).with(auth["info"]["email"]).and_return(nil)
allow(UserRepository).to receive(:create_user).with(
uid: auth["uid"],
email: auth["info"]["email"],
first_name: "Test",
last_name: "User"
).and_return(User.create(uid: auth["uid"], email: auth["info"]["email"], first_name: "Test", last_name: "User"))
allow(Role).to receive(:create)
end

it 'creates new user' do
user = UserService.find_or_create_user(auth)

expect(user.uid).to eq("1")
expect(user.email).to eq("test@tamu.edu")
expect(UserRepository).to have_received(:create_user)
expect(Role).to have_received(:create).with(user_id: user.id, role: "Member")
end
end

context 'when user' do
let(:existing_user) { User.new(id: 1, uid: "1", email: "test@tamu.edu", first_name: "Test", last_name: "User") }
let(:existing_user) { User.create(uid: "1", email: "test@tamu.edu", first_name: "Test", last_name: "User") }

before do
allow(UserRepository).to receive(:find_by_email).with(auth["info"]["email"]).and_return(existing_user)
Loading