parent
e9c40a9c0f
commit
aecc989154
|
@ -34,7 +34,6 @@ class Snippet < ActiveRecord::Base
|
|||
validates :author, presence: true
|
||||
validates :title, presence: true, length: { within: 0..255 }
|
||||
validates :file_name,
|
||||
presence: true,
|
||||
length: { within: 0..255 },
|
||||
format: { with: Gitlab::Regex.file_name_regex,
|
||||
message: Gitlab::Regex.file_name_regex_message }
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
.col-sm-10
|
||||
.file-holder.snippet
|
||||
.file-title
|
||||
= f.text_field :file_name, placeholder: "example.rb", class: 'form-control snippet-file-name', required: true
|
||||
= f.text_field :file_name, placeholder: "Optionally name this file to add code highlighting, e.g. example.rb for Ruby.", class: 'form-control snippet-file-name'
|
||||
.file-content.code
|
||||
%pre#editor= @snippet.content
|
||||
= f.hidden_field :content, class: 'snippet-file-content'
|
||||
|
|
|
@ -40,7 +40,6 @@ describe Snippet do
|
|||
it { is_expected.to validate_presence_of(:title) }
|
||||
it { is_expected.to validate_length_of(:title).is_within(0..255) }
|
||||
|
||||
it { is_expected.to validate_presence_of(:file_name) }
|
||||
it { is_expected.to validate_length_of(:file_name).is_within(0..255) }
|
||||
|
||||
it { is_expected.to validate_presence_of(:content) }
|
||||
|
|
Loading…
Reference in New Issue