ItGo.me Focus on IT Recommend

Home > ruby on rails - what type of "assert" should I use in rspec to validate pre-conditions are ok?

ruby on rails - what type of "assert" should I use in rspec to validate pre-conditions are ok?

I'm using rspec with ruby on rails for testing.

Question - In a spec if I was to do a cross check a pre-condition is established properly before starting the test, what approach is recommended?

For example, using an rspec ".should" type assertion doesn't seem like this would be the right thing as I'm only checking a precondition...

Recommend:ruby on rails - Stupefied by RSpec

ffled by RSpec. Have watched video after video, read tutorial after tutorial, and still I'm just stuck on square one. === here is what I'm working with http://github.com/fudgestudios/bort/tree/master === Errors F1)NoMethodError in 'biddi

answer 1 >>---Accepted---Accepted---Accepted---

A should is perfectly valid in this situation as it is a condition that should be valid at the start of the test. As a very trivial example:

it "should increment by one" do
  value = 10
  value.should eql(10)
  value += 1
  value.should eql(11)
end

Recommend:ruby on rails - What is RSpec Mocks

about RSpec Mocks. However I don't know about the advantages of RSpec Mocks and how to use it. So can anyone summary about this. ruby-on-rails ruby-on-rails-4 rspec-mocks share | improve this question edited Feb 6 '16 at 23:53 Dave Schweisg

oriUlr:http://stackoverflow.com/questions/9525835/what-type-of-assert-should-i-use-in-rspec-to-validate-pre-conditions-are-ok

------splitte line----------------------------