Here's the dropdown menu:
<div class="btn-group bootstrap-select dropup open">
<button type="button" class="btn dropdown-toggle btn-default" data-toggle="dropdown" data-id="taggings_tag_id" title="Nothing selected" aria-expanded="true">
<span class="filter-option pull-left">Nothing selected</span> <span class="bs-caret"><span class="caret"></span></span>
</button>
<div class="dropdown-menu open" style="max-height: 484px; overflow: hidden; min-height: 92px;">
<ul class="dropdown-menu inner" role="menu" style="max-height: 472px; overflow-y: auto; min-height: 80px;">
<li data-original-index="0" class="selected">
<a tabindex="0" class="" style="" data-tokens="null">
<span class="text"></span>
<span class="glyphicon glyphicon-ok check-mark">
</span>
</a>
</li>
<li data-original-index="1">
<a tabindex="0" class="" style="" data-tokens="null">
<span class="text">Create Account</span>
<span class="glyphicon glyphicon-ok check-mark"></span>
</a>
</li>
</ul>
</div>
<select class="selectpicker" id="taggings_tag_id" name="taggings[tag_id]" tabindex="-98">
<option value=""></option>
<option value="1">Create Account</option>
</select>
</div>
I'm trying to select that "Create Account" option from the dropdown. I can get capybara to click on the dropdown and expand the list, but I can't get it to select the correct option--resulting in a null value failure when it clicks on Add Tag.
it 'adds a tag' do
page.find(:xpath, "//button[@title='Nothing selected']").click
option=all("ul.dropdown-menu.inner > li").last
option.click
find('input[value="Add Tag"]').trigger("click")
expect(page).to have_content 'Create Account'
end