should_not render_with_layoutcan be flaky. For example, asserting that an XHR request doesn’t have a layout could fail if the request renders an email template that does have a layout. These matchers are not very sophisticated, mostly doing string matching, not real template resolution.
Ask for Help
- “How do I test relative time with FixtureBuilder?”
Since the models are all built beforehand, it’s tricky to write tests that make assertions about relative time. There were a variety of suggestions. You can write all the tests relative to a model:
some_time.should == model.created_at - 3.days. You can wrap the entire suite and fixture generation in a Timecop block, but you’ll have to deal with losing that context whenever any test calls
- “How do I separate multiple FixtureBuilder files, but allow them to reference objects created in each other?”
Typically you want to separate fixtures into smaller files. But, you also often want to reference objects in other files, for example so you can assign a user from
user_fixtures.rb to a post in
post_fixtures.rb. One solution is to
eval each file in a loop, so they can share instance variables. You can also use
User.where(:name => "Tom") but that’s awkward and repetitive.
- “Any suggestions for a CMS that would allow lots of different visual presentations of the content?”
The questioner is experimenting with branding. Not many suggestions… a shared database perhaps?