Sha256: 1bb8cdd54afee5464eb0b1301321ce011f2d4c466629f8b16c0e5664956fe391

Contents?: true

Size: 1.27 KB

Versions: 7

Compression:

Stored size: 1.27 KB

Contents

shared_examples_for 'the horizontal helper' do
  all_tests_pass_with 'the horizontal not wrapped in navbar'
  all_tests_pass_with 'no horizontal options'
  all_tests_pass_with 'extra horizontal options (except :id)'
  all_tests_pass_with 'the horizontal wrapped in a navbar with :id'
end

#--

shared_examples_for 'the horizontal not wrapped in navbar' do
  specify 'returns nil' do
    expect(:horizontal).to generate nil
  end
end

shared_examples_for 'no horizontal options' do
  specify 'creates a <div class="collpase navbar-collapse"> element' do
    html = %r{<div class="collapse navbar-collapse" id=".+">content</div>}
    bh.navbar { expect(:horizontal).to generate html }
  end
end

shared_examples_for 'extra horizontal options (except :id)' do
  specify 'passes the options to the <div> element' do
    options = {class: 'important', data: {value: 1}}
    html = %r{<div class="important collapse navbar-collapse" data-value="1"}
    bh.navbar { expect(horizontal: options).to generate html }
  end
end

shared_examples_for 'the horizontal wrapped in a navbar with :id' do
  it 'uses the id from the navbar' do
    id = 'my-navbar'
    html = %r{<div class="collapse navbar-collapse" id="my-navbar">content</div>}
    bh.navbar(id: id) { expect(:horizontal).to generate html}
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bh-1.3.6 spec/shared/horizontal_helper.rb
bh-1.3.5 spec/shared/horizontal_helper.rb
bh-1.3.4 spec/shared/horizontal_helper.rb
bh-1.3.3 spec/shared/horizontal_helper.rb
bh-1.3.1 spec/shared/horizontal_helper.rb
bh-1.3.0 spec/shared/horizontal_helper.rb
bh-1.2.0 spec/shared/horizontal_helper.rb