So I am writing my first rSpec ‘tests’ formally and I’m running up
against some questions on making this work within Radiant. Can anyone
shed some light on how to spec for the following items:
* My extension should create a tab in the Admin UI. It should be before or after certain other tabs. * My extension allows the user to customize Radiant::Config items. If the user doesn't explicitly set these, default values should be used. * I have a model with a: validates_format_of :name, etc, etc... declaration. It should enforce this rule. Note: I've tried testing this last one by copying how Snippets are tested -- i.e: it 'should validate format of name' do assert_valid :name, 'abc', 'abcd-efg', 'abcd_efg', 'abc.html', '/', '123' assert_invalid :name, 'cannot contain spaces or tabs' end but this does NOT seem to actually test anything. I wrote my spec first and it passed without adding the 'validates_format_of' entry in the model. This might be showing a bug in the test_helper :validations code. I commented out the Snippet model's validates_format_of line and it too passed when I ran 'rake spec:models'