From 62349acc544ea51db089b103fbfada0ebcbfe3a8 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 16 Jul 2015 19:26:17 +0200 Subject: [PATCH] adds debate model specs [#5] --- spec/models/debate_spec.rb | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb index 768e6feec..490eea985 100644 --- a/spec/models/debate_spec.rb +++ b/spec/models/debate_spec.rb @@ -1,5 +1,28 @@ require 'rails_helper' -RSpec.describe Debate, type: :model do - pending "add some examples to (or delete) #{__FILE__}" +describe Debate do + + before(:each) do + @debate = build(:debate) + end + + it "should be valid" do + expect(@debate).to be_valid + end + + it "should not be valid without a title" do + @debate.title = nil + expect(@debate).to_not be_valid + end + + it "should not be valid without a description" do + @debate.description = nil + expect(@debate).to_not be_valid + end + + it "should not be valid without accepting terms of service" do + @debate.terms_of_service = nil + expect(@debate).to_not be_valid + end + end