mirror of
https://github.com/diaspora/diaspora.git
synced 2026-04-29 03:01:03 -04:00
Merge pull request #4916 from hpetru/validate-poll-answer
I added the validation to poll question and poll answer Conflicts: app/assets/javascripts/app/views/publisher_view.js
This commit is contained in:
@@ -51,4 +51,11 @@ describe('app.views.PublisherPollCreator', function(){
|
||||
expect(this.view.$(remove_btn).hasClass('active')).toBe(false);
|
||||
});
|
||||
});
|
||||
describe('#validateInput', function(){
|
||||
it('should invalid blank value', function(){
|
||||
var input = this.view.$('input');
|
||||
input.val(' ');
|
||||
expect(this.view.validateInput(input)).toBe(false);
|
||||
}):
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,4 +18,17 @@ describe PollAnswer do
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
describe 'validation' do
|
||||
it 'should validate pressence of answer' do
|
||||
answer = PollAnswer.new
|
||||
answer.valid?
|
||||
answer.errors.should have_key(:answer)
|
||||
end
|
||||
it 'answer should not empty' do
|
||||
answer = PollAnswer.new answer: ' '
|
||||
answer.valid?
|
||||
answer.errors.should have_key(:answer)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -16,5 +16,11 @@ describe Poll do
|
||||
@poll.poll_answers.build(:answer => '2')
|
||||
@poll.should be_valid
|
||||
end
|
||||
|
||||
it 'should not create a poll when question in blank' do
|
||||
@poll.question = ' '
|
||||
@poll.valid?
|
||||
@poll.errors.should have_key(:question)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user