1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
require_relative 'helper'
describe MinispecMetadata::It do
it 'stores metadata for current spec', meta: 'data' do
_(metadata.fetch(:meta)).must_equal 'data'
end
specify 'it works with #specify', 1 => 2 do
_(metadata.fetch(1)).must_equal 2
end
it 'returns empty hash when no metadata set' do
_(metadata).must_equal({})
end
name = it 'returns name' do
_(name).must_match %r/test_/
end
describe 'before/after hooks' do
before do
_(metadata.fetch(:before)).must_equal 'accessible'
end
it 'is accessible in hooks', before: 'accessible', after: 'also accessible' do
pass
end
after do
_(metadata.fetch(:after)).must_equal 'also accessible'
end
end
describe 'with description metadata', description_meta: 'data' do
it 'inherits metadata from description' do
_(metadata.fetch(:description_meta)).must_equal 'data'
end
it "uses symbols as true values", :verity, :words_are_hard do
_(metadata).must_equal(
description_meta: 'data',
verity: true,
words_are_hard: true,
)
end
describe 'in a nested describe', 'with no metadata' do
it 'works', works: true do
_(metadata).must_equal(
:description_meta => 'data',
'with no metadata' => true,
:works => true,
)
end
end
describe 'in a nested describe', with_metadata: true do
it 'works', works: true do
_(metadata).must_equal(works: true, with_metadata: true, description_meta: 'data')
end
end
end
end
describe MinispecMetadata::It, '#desc' do
it 'provides a method to get the name of the spec' do
_(desc).must_equal 'provides a method to get the name of the spec'
end
end
|