模型/question_spec.rb
context "title" do
subject { Question.new(title: 'is it valid question ?') }
it { should be_valid }
end
模型/问题.rb
validates :title , presence: true , :length => { :minimum => 15, :maximum => 160 }
validates_length_of :body, :minimum => 250
结果
Question title
Failure/Error: it { should be_valid }
expected valid? to return true, got false
为什么 ?