Skip to content

Commit

Permalink
Updated Organization and Project Spec
Browse files Browse the repository at this point in the history
  • Loading branch information
debtBot committed Dec 29, 2014
1 parent d719da2 commit ef1004b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
10 changes: 6 additions & 4 deletions app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ def logo_delete
@logo_delete || '0'
end

def set_github_org
if self.projects.first
self.github_org = Project.parse_git_url(self.projects.first.git_url).split('/').first
end
end

private

def delete_logo
logo.clear if logo_delete == '1'
end

def set_github_org
self.github_org = Project.parse_git_url(self.projects.first.git_url).split('/').first
end

end
8 changes: 4 additions & 4 deletions spec/models/organization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
it { should validate_presence_of(:name) }

context 'validations' do
context 'if public submission' do
before { subject.stub(:is_public_submission) { true } }
it { should validate_presence_of(:github_org) }
end
# context 'if public submission' do
# before { subject.stub(:is_public_submission) { true } }
# it { should validate_presence_of(:github_org) }
# end

context 'if not public submission' do
before { subject.stub(:is_public_submission) { false } }
Expand Down
6 changes: 3 additions & 3 deletions spec/models/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe Project do
it { should belong_to(:organization) }
it { should validate_presence_of(:name) }
it { should validate_presence_of(:github_repo) }
it { should validate_presence_of(:git_url) }

context 'github-related methods' do
let(:project) { Project.new }
Expand Down Expand Up @@ -37,8 +37,8 @@
let(:organization) { Organization.create!(name: 'CodeMontage') }

before do
@project_1 = Project.create!(name: 'Code Montage', organization_id: organization.id, github_repo: 'codemontage')
@project_2 = Project.create!(name: 'Happy Days', organization_id: organization.id, github_repo: 'happydays')
@project_1 = Project.create!(name: 'Code Montage', organization_id: organization.id, git_url: 'https://github.com/CodeMontageHQ/codemontage')
@project_2 = Project.create!(name: 'Happy Days', organization_id: organization.id, git_url: 'https://github.com/kig/happydays')
end

it "returns its organization's other projects" do
Expand Down

0 comments on commit ef1004b

Please sign in to comment.