-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
E1848. Write unit tests for assignment_team.rb #1228
Conversation
Generated by expertiza-bot |
Travis tests have failedHey @kevacken, Ruby: 2.2.7export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rake 2> /dev/null
TravisBuddy Request Identifier: 101ea190-d3be-11e8-8287-c1a5f8036931 |
Travis tests have failedHey @kevacken, Ruby: 2.2.7export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rake 2> /dev/null
TravisBuddy Request Identifier: bfa9f9d0-d647-11e8-9e21-2d628ca2e168 |
Travis tests have failedHey @kevacken, Ruby: 2.2.7export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rake 2> /dev/null
TravisBuddy Request Identifier: 730a5500-d707-11e8-a0c1-37e29dcbd83a |
Travis tests have failedHey @kevacken, Ruby: 2.2.7export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rake 2> /dev/null
TravisBuddy Request Identifier: 3dfd5780-d70d-11e8-a0c1-37e29dcbd83a |
Pull Request Test Coverage Report for Build 6018
💛 - Coveralls |
Travis tests have failedHey @kevacken, Ruby: 2.2.7export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rake 2> /dev/null
TravisBuddy Request Identifier: 96e9c6d0-d70d-11e8-a0c1-37e29dcbd83a |
Travis tests have failedHey @kevacken, Ruby: 2.2.7export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rake 2> /dev/null
TravisBuddy Request Identifier: 2d444730-d7d7-11e8-9c01-d7c60254052a |
Travis tests have failedHey @kevacken, Ruby: 2.2.7export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rake 2> /dev/null
TravisBuddy Request Identifier: fc99af10-d800-11e8-9c01-d7c60254052a |
Travis tests have failedHey @kevacken, Ruby: 2.2.7export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rake 2> /dev/null
TravisBuddy Request Identifier: 0d1ab0a0-d801-11e8-9c01-d7c60254052a |
Travis tests have failedHey @kevacken, Ruby: 2.2.7export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rake 2> /dev/null
TravisBuddy Request Identifier: 7b1dc450-d803-11e8-9c01-d7c60254052a |
Travis tests have failedHey @kevacken, Ruby: 2.2.7export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rake 2> /dev/null
TravisBuddy Request Identifier: 6d7a6800-d897-11e8-b9f2-b1fbc111596d |
spec/models/assignment_team_spec.rb
Outdated
describe ".get_first_member" do | ||
context "when team id is present" do | ||
it "get first member of the team" do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at block body beginning.
spec/models/assignment_team_spec.rb
Outdated
end | ||
end | ||
|
||
describe ".remove_team_by_id" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
spec/models/assignment_team_spec.rb
Outdated
context "when a team has an id" do | ||
it "delete the team by id" do | ||
team = build(:assignment_team, id: 1) | ||
allow(AssignmentTeam).to receive(:find).with(1).and_return(team) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
spec/models/assignment_team_spec.rb
Outdated
it "delete the team by id" do | ||
team = build(:assignment_team, id: 1) | ||
allow(AssignmentTeam).to receive(:find).with(1).and_return(team) | ||
expect(AssignmentTeam.remove_team_by_id(team.id)).to eq(team) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
spec/models/assignment_team_spec.rb
Outdated
it "get first member of the team" do | ||
|
||
team = build(:assignment_team, id: 1) | ||
build(:student, id: 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
spec/models/assignment_team_spec.rb
Outdated
expect(team.includes?(participant)).to eq true | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
spec/models/assignment_team_spec.rb
Outdated
team = build(:assignment_team, id: 1) | ||
build(:student, id: 3) | ||
participant1 = build(:participant, id: 1, user_id: 3) | ||
team_user1 = build(:team_user, team_id: 1, user_id: 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
spec/models/assignment_team_spec.rb
Outdated
build(:student, id: 3) | ||
participant1 = build(:participant, id: 1, user_id: 3) | ||
team_user1 = build(:team_user, team_id: 1, user_id: 3) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace detected.
expect(AssignmentTeam.remove_team_by_id(team.id)).to eq(team) | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end
at 70, 2 is not aligned with describe ".remove_team_by_id" do
at 62, 1.
spec/models/assignment_team_spec.rb
Outdated
team = build(:assignment_team, id: 1) | ||
build(:student, id: 3) | ||
participant1 = build(:participant, id: 1, user_id: 3) | ||
team_user1 = build(:team_user, team_id: 1, user_id: 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless assignment to variable - team_user1
.
Travis tests have failedHey @kevacken, Ruby: 2.2.7export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rake 2> /dev/null
TravisBuddy Request Identifier: cfc35550-dbec-11e8-8e0f-4de0fcdedaae |
…ssignmentTeam.import bug fix
Travis tests have failedHey @kevacken, Ruby: 2.2.7export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rake 2> /dev/null
TravisBuddy Request Identifier: 5240ed10-dbf4-11e8-8e0f-4de0fcdedaae |
Conflicts: spec/models/assignment_team_spec.rb
Travis tests have failedHey @kevacken, Ruby: 2.2.7export DISPLAY=:99.0 && RUBYOPT=W0 bundle exec rake 2> /dev/null
TravisBuddy Request Identifier: 687b02d0-dbf6-11e8-8e0f-4de0fcdedaae |
spec/models/assignment_team_spec.rb
Outdated
team = build(:assignment_team, id: 1) | ||
build(:student, id: 3) | ||
participant1 = build(:participant, id: 1, user_id: 3) | ||
team_user1 = build(:team_user, team_id: 1, user_id: 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
spec/models/assignment_team_spec.rb
Outdated
it "provides the topic id" do | ||
assignment = team.assignment | ||
allow(SignUpTopic).to receive(:find_by).with(assignment: assignment).and_return(topic) | ||
allow(SignedUpTeam).to receive_message_chain(:find_by, :try).with(team_id: team.id).with(:topic_id).and_return(topic.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
spec/models/assignment_team_spec.rb
Outdated
assignment = team.assignment | ||
allow(SignUpTopic).to receive(:find_by).with(assignment: assignment).and_return(topic) | ||
allow(SignedUpTeam).to receive_message_chain(:find_by, :try).with(team_id: team.id).with(:topic_id).and_return(topic.id) | ||
expect(team.topic).to eq(topic.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
spec/models/assignment_team_spec.rb
Outdated
describe "#delete" do | ||
it "deletes the team" do | ||
allow(team).to receive(:users).with(no_args).and_return([user1, user2]) | ||
allow(AssignmentParticipant).to receive(:find_by).with(user_id: user1.id, parent_id: team.parent_id).and_return(participant1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
spec/models/assignment_team_spec.rb
Outdated
it "deletes the team" do | ||
allow(team).to receive(:users).with(no_args).and_return([user1, user2]) | ||
allow(AssignmentParticipant).to receive(:find_by).with(user_id: user1.id, parent_id: team.parent_id).and_return(participant1) | ||
allow(AssignmentParticipant).to receive(:find_by).with(user_id: user2.id, parent_id: team.parent_id).and_return(participant2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
expect(AssignmentTeam.remove_team_by_id(team.id)).to eq(team) | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end
at 74, 2 is not aligned with describe ".remove_team_by_id" do
at 66, 1.
allow(Team).to receive(:export).with([], 1, [], instance_of(AssignmentTeam)) | ||
expect(Team).to receive(:export).with([], 1, [], instance_of(AssignmentTeam)) | ||
AssignmentTeam.export([], 1, []) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end
at 226, 4 is not aligned with it "redirects to Team.export with a new AssignmentTeam object" do
at 222, 5.
spec/models/assignment_team_spec.rb
Outdated
team = build(:assignment_team, id: 1) | ||
build(:student, id: 3) | ||
participant1 = build(:participant, id: 1, user_id: 3) | ||
team_user1 = build(:team_user, team_id: 1, user_id: 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless assignment to variable - team_user1
.
spec/models/assignment_team_spec.rb
Outdated
allow(team).to receive(:users).with(no_args).and_return([user1, user2]) | ||
allow(AssignmentParticipant).to receive(:find_by).with(user_id: user1.id, parent_id: team.parent_id).and_return(participant1) | ||
allow(AssignmentParticipant).to receive(:find_by).with(user_id: user2.id, parent_id: team.parent_id).and_return(participant2) | ||
signupteam = build(:signed_up_team, id: 1, team_id: team.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless assignment to variable - signupteam
.
spec/models/assignment_team_spec.rb
Outdated
it "sets the directory for the team" do | ||
team = build(:assignment_team, id: 1, parent_id: 1,directory_num: -1) | ||
max_num = 0 | ||
allow(AssignmentTeam).to receive_message_chain(:where, :order, :first, :directory_num).with(parent_id: team.parent_id).with(:directory_num, :desc).with(no_args).with(no_args).and_return(max_num) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [206/160]
spec/models/assignment_team_spec.rb
Outdated
team = build(:assignment_team, id: 1) | ||
build(:student, id: 3) | ||
participant1 = build(:participant, id: 1, user_id: 3) | ||
team_user1 = build(:team_user, team_id: 1, user_id: 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
spec/models/assignment_team_spec.rb
Outdated
it "provides the topic id" do | ||
assignment = team.assignment | ||
allow(SignUpTopic).to receive(:find_by).with(assignment: assignment).and_return(topic) | ||
allow(SignedUpTeam).to receive_message_chain(:find_by, :try).with(team_id: team.id).with(:topic_id).and_return(topic.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
spec/models/assignment_team_spec.rb
Outdated
assignment = team.assignment | ||
allow(SignUpTopic).to receive(:find_by).with(assignment: assignment).and_return(topic) | ||
allow(SignedUpTeam).to receive_message_chain(:find_by, :try).with(team_id: team.id).with(:topic_id).and_return(topic.id) | ||
expect(team.topic).to eq(topic.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
spec/models/assignment_team_spec.rb
Outdated
describe "#delete" do | ||
it "deletes the team" do | ||
allow(team).to receive(:users).with(no_args).and_return([user1, user2]) | ||
allow(AssignmentParticipant).to receive(:find_by).with(user_id: user1.id, parent_id: team.parent_id).and_return(participant1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
spec/models/assignment_team_spec.rb
Outdated
it "deletes the team" do | ||
allow(team).to receive(:users).with(no_args).and_return([user1, user2]) | ||
allow(AssignmentParticipant).to receive(:find_by).with(user_id: user1.id, parent_id: team.parent_id).and_return(participant1) | ||
allow(AssignmentParticipant).to receive(:find_by).with(user_id: user2.id, parent_id: team.parent_id).and_return(participant2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation detected.
expect(AssignmentTeam.remove_team_by_id(team.id)).to eq(team) | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end
at 74, 2 is not aligned with describe ".remove_team_by_id" do
at 66, 1.
allow(Team).to receive(:export).with([], 1, [], instance_of(AssignmentTeam)) | ||
expect(Team).to receive(:export).with([], 1, [], instance_of(AssignmentTeam)) | ||
AssignmentTeam.export([], 1, []) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
end
at 226, 4 is not aligned with it "redirects to Team.export with a new AssignmentTeam object" do
at 222, 5.
spec/models/assignment_team_spec.rb
Outdated
team = build(:assignment_team, id: 1) | ||
build(:student, id: 3) | ||
participant1 = build(:participant, id: 1, user_id: 3) | ||
team_user1 = build(:team_user, team_id: 1, user_id: 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless assignment to variable - team_user1
.
spec/models/assignment_team_spec.rb
Outdated
allow(team).to receive(:users).with(no_args).and_return([user1, user2]) | ||
allow(AssignmentParticipant).to receive(:find_by).with(user_id: user1.id, parent_id: team.parent_id).and_return(participant1) | ||
allow(AssignmentParticipant).to receive(:find_by).with(user_id: user2.id, parent_id: team.parent_id).and_return(participant2) | ||
signupteam = build(:signed_up_team, id: 1, team_id: team.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless assignment to variable - signupteam
.
spec/models/assignment_team_spec.rb
Outdated
it "sets the directory for the team" do | ||
team = build(:assignment_team, id: 1, parent_id: 1,directory_num: -1) | ||
max_num = 0 | ||
allow(AssignmentTeam).to receive_message_chain(:where, :order, :first, :directory_num).with(parent_id: team.parent_id).with(:directory_num, :desc).with(no_args).with(no_args).and_return(max_num) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [206/160]
spec/models/assignment_team_spec.rb
Outdated
allow(team).to receive(:users).with(no_args).and_return([user1, user2]) | ||
allow(AssignmentParticipant).to receive(:find_by).with(user_id: user1.id, parent_id: team.parent_id).and_return(participant1) | ||
allow(AssignmentParticipant).to receive(:find_by).with(user_id: user2.id, parent_id: team.parent_id).and_return(participant2) | ||
signupteam = build(:signed_up_team, id: 1, team_id: team.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless assignment to variable - signupteam
.
end | ||
end | ||
|
||
describe "#scores" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Block has too many lines. [26/25]
Hi team, You did a good job! Thanks, |
We have written more unit tests for assignment_team.rb in assignment_team_spec.rb as part of program 3 for ECE 517 in the fall of 2018. @Winbobob is our mentor.