-
Notifications
You must be signed in to change notification settings - Fork 9
Shared examples
David edited this page Mar 21, 2015
·
1 revision
Vigia allows to include custom shared rspec examples in the test using some options in the config
Vigia.configure do |config|
# Define where your examples are located
config.custom_examples_paths = [ '/my_project/shared_examples/apib_examples.rb' ]
# Define the custom examples you want to include in your test
# To the example in all your requests use `:all` symbol
config.add_custom_examples_on(:all, 'my custom examples')
end
Then, create your Rspec shared example and name the examples accordingly
# /my_project/shared_examples/apib_examples.rb
shared_examples 'my custom examples' do
it 'is a valid json response' do
expect { JSON.parse(result.body) }.not_to raise_error
end
end