I'm trying to test that I can
describe "when completing the survey" do
it "should submit correctly" do
@order.heard.should == "Other"
# test post survey
1) when completing the survey should submit correctly
end of file reached
# ./spec/features/edit_order/editing_order_spec.rb:<<the line with find("#submit-suvery")>>
@order = Order.find_by_disguised_id(order_params[:disguised_id])
render nothing: true
If you're using chrome with selenium make sure you're running the latest version of chromedriver (2.24 as of this answer).
Additionally - click is asynchronous so reloading the order immediately after clicking #submit-survey is going to be flaky at best since it's highly likely it will be reloading @order before the ajax request is processed. You need to wait for whatever visual change on the page would indicate the survey has been submitted after clicking.
find("#submit-survey").click page.should have_text('something') # whatever shows up when the survey finishes submitting - or use have_css, etc
Also the previous line
find(".modal#survey-box select[name='heard']").find("[value='Other']").select_option can be written in a more readable manner as
find(".modal#survey-box").select('Other', from: 'heard')