-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:water/mainline
- Loading branch information
Showing
6 changed files
with
66 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# encoding: utf-8 | ||
class RegistrationsController < ApplicationController | ||
|
||
def new | ||
end | ||
|
||
def create | ||
end | ||
|
||
def register | ||
ActiveRecord::Base.transaction do | ||
@lab_group = LabGroup.create!( | ||
given_course_id: params[:course_id], | ||
students: [current_user] | ||
) | ||
|
||
repository = Repository.create!() | ||
|
||
LabHasGroup.create!( | ||
repository: repository, | ||
lab_id: params[:lab_id], | ||
lab_group_id: @lab_group | ||
) | ||
end | ||
if LabGroup.exists?(@lab_group) | ||
redirect_back notice: "You have joined a lab and lab group" | ||
else | ||
redirect_back notice: "Something went wrong" | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
describe RegistrationsController do | ||
|
||
describe "register" do | ||
it "should be possible to use method register" do | ||
given_course = FactoryGirl.create(:given_course) | ||
lab = FactoryGirl.create(:lab, active: true, given_course_id: given_course.id) | ||
post :register, lab_id: lab.id, course_id: given_course.id | ||
|
||
LabHasGroup.find_by_lab_id(lab.id).lab_id.should eq(lab.id) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
describe SubmissionsController do | ||
describe "PUT notes" do | ||
it "should be possible for an assistant to set notes" do | ||
assistant = Factory.create(:assistant) | ||
login_as(assistant) | ||
subm = Factory.create(:submission) | ||
post :notes, id: subm.id, notes: "hej" | ||
subm.notes.should eq("hej") | ||
assistant = FactoryGirl.create(:assistant) | ||
subm = FactoryGirl.create(:submission) | ||
post :initial_comment, id: subm.id, input: "hej" | ||
subm = Submission.find(subm.id) | ||
Comment.find(subm.comment_id).body.should eq("hej") | ||
end | ||
end | ||
end |