From b11fc98927032b4ec4eb85b32319ac248cae529f Mon Sep 17 00:00:00 2001 From: Thiago Pradi Date: Fri, 11 Sep 2009 01:12:11 -0300 Subject: [PATCH] Better exception message on select options --- lib/webrat/core/locators/select_option_locator.rb | 2 +- spec/public/select_spec.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/webrat/core/locators/select_option_locator.rb b/lib/webrat/core/locators/select_option_locator.rb index 123755e5..dadc85cd 100644 --- a/lib/webrat/core/locators/select_option_locator.rb +++ b/lib/webrat/core/locators/select_option_locator.rb @@ -43,7 +43,7 @@ def option_elements def error_message if @id_or_name_or_label - "The '#{@option_text}' option was not found in the #{@id_or_name_or_label.inspect} select box" + "The '#{@option_text}' option was not found in the #{@id_or_name_or_label.inspect} select box - The Available Options are: #{option_elements.collect{|j| j.inner_html}.join(' | ')}" else "Could not find option #{@option_text.inspect}" end diff --git a/spec/public/select_spec.rb b/spec/public/select_spec.rb index d0d05d0d..9f798435 100644 --- a/spec/public/select_spec.rb +++ b/spec/public/select_spec.rb @@ -6,12 +6,13 @@
+
HTML lambda { select "February", :from => "month" }.should raise_error(Webrat::NotFoundError, - "The 'February' option was not found in the \"month\" select box") + "The 'February' option was not found in the \"month\" select box - The Available Options are: January | March") end it "should fail if option not found in list specified by element name" do