unit testing - Is it possible to change Rspec output on objects? -



unit testing - Is it possible to change Rspec output on objects? -

given next spec:

describe person describe "scopes , class methods" let!(:sixty_older) { factorygirl.create :person, birthdate: 60.years.ago } describe ".senior" subject { person.senior } { should include(sixty_older) } end end end

its output in cli using format --documentation:

person scopes , class methods .senior should include #<person person_id: 466, gender: "m", birthdate: "1953-02-07 19:44:22", birthdate_estimated: 0, dead: 0, death_date: nil, cause_of_death: nil, creator: 0, date_created: "0002-11-30 00:00:00", changed_by: nil, date_changed: nil, voided: 0, voided_by: nil, date_voided: nil, void_reason: nil, uuid: "key_4">

is possible me alter #<person person_id: ....> else?

say, display person_id, birthdate , uuid?

also, if can customized on per test basis , not on class-level change.

you can pass rspec matchers custom failure message, so:

describe ".senior" subject { person.senior } { should include(sixty_older), "should include #{person.person_id}:#{person.uuid}" } end

unit-testing rspec rspec-rails

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

Hibernate criteria by a list of natural ids -

ios - Lagging ScrollView with UIWebview inside -