Find out the value selected in capybara by displayed option
<p>I am writing the cucumber capybara tests to check if the form has correct elements populated. I am stuck how to find the selected element value displayed in the dropdown. Here is the code </p>

<pre><code>&lt;select class="selectpicker form-control" id="server_request_cores" name="server_request[cores]"&gt;&lt;option value="1"&gt;1 x 2.0 GHz Core&lt;/option&gt;
&lt;option selected="selected" value="2"&gt;2 x 2.0 GHz Cores&lt;/option&gt;
&lt;option value="4"&gt;4 x 2.0 GHz Cores&lt;/option&gt;
&lt;option value="8"&gt;8 x 2.0 GHz Cores&lt;/option&gt;
&lt;option value="12"&gt;12 x 2.0 GHz Cores&lt;/option&gt;
&lt;option value="16"&gt;16 x 2.0 GHz Cores&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>I wanted to find if the dropdown has "2 x 2.0 GHz Cores" selected or not. I know there is way to find it through the "value" but I dont want to find it by value rather I wanted to find out by actual displayed value on page. Something like this </p>

<pre><code>expect( find(:css, 'select#server_request_cores').value ).to eq('2 x 2.0 GHz Cores')
</code></pre>