Skip to content

Commit

Permalink
Start on hooks test [#158]
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarrasch committed May 4, 2012
1 parent a19bcf8 commit d7ccc33
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions spec/hooks/hooks_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
describe "Git hooks" do

let(:lab_has_group) { create(:lab_has_group, repository: repository) }
let(:lab) { lab_has_group.lab }
let(:lab_group) { lab_has_group.lab_group }
let(:student) { create(:student) }
let(:user) { student.user }
let(:given_course) { lab_group.given_course }
let(:url) { repository.full_repository_path }
let(:repository) { create(:repo_with_data) }

before(:each) do
given_course.register_student(student)
lab_group.add_student(student)
Dir.chdir(Dir.mktmpdir)
`git clone #{url} dir`
Dir.chdir "dir"
end

def mutate_and_add!
`echo a >> a && git add a`
end

def push(branch)
`git push origin #{branch}`
end

it "can submit a repo" do
p url
p Dir.pwd
mutate_and_add!
`git commit -m 'I want to #submit'"`
Submission.first.should be_nil
push "master"
Submission.first.should_not be_nil
end

end



0 comments on commit d7ccc33

Please sign in to comment.