Skip to content

Commit

Permalink
removed source_url validation from Project::Form
Browse files Browse the repository at this point in the history
  • Loading branch information
tsurupin committed Aug 8, 2016
1 parent 1b576d0 commit e34321c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
8 changes: 4 additions & 4 deletions app/models/project/form.rb
Expand Up @@ -27,10 +27,10 @@ class Project::Form < ActiveType::Record[Project]

validates :description, presence: true, if: proc { |project| project.accepted }
validates :image, presence: true, if: proc { |project| project.accepted }
validates :source_url,
presence: true,
format: { with: URI.regexp, message: '%{value} does not appear to be a valid URL' },
if: proc { |project| project.accepted }
# validates :source_url,
# presence: true,
# format: { with: URI.regexp, message: '%{value} does not appear to be a valid URL' },
# if: proc { |project| project.accepted }

accepts_nested_attributes_for :taggings, reject_if: ->(attributes) { attributes['tag_id'].blank? }

Expand Down
13 changes: 0 additions & 13 deletions spec/models/project/form_spec.rb
Expand Up @@ -60,19 +60,6 @@
end
end

context 'source_url' do
context 'when source_url is nil' do
it 'raises the error' do
project = create(
:project,
description: 'hoge',
image: File.new("#{Rails.root}/spec/fixtures/images/sample.png")
)
project_form = Project::Form.find(project.id)
expect { project_form.update!(accepted: true) }.to raise_error(ActiveRecord::RecordInvalid)
end
end
end
end

describe '.delete_unnecessary_tags!' do
Expand Down

0 comments on commit e34321c

Please sign in to comment.