From 3b6863a124425a5872ad28357d0b548930466e81 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sat, 25 May 2013 14:04:51 -0400 Subject: [PATCH] small updates --- .../attributes_table_builder.rb | 2 ++ lib/semantic_rails_view_helpers/capybara.rb | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/semantic_rails_view_helpers/attributes_table_builder.rb b/lib/semantic_rails_view_helpers/attributes_table_builder.rb index e8328ca..461e75c 100644 --- a/lib/semantic_rails_view_helpers/attributes_table_builder.rb +++ b/lib/semantic_rails_view_helpers/attributes_table_builder.rb @@ -12,6 +12,8 @@ module SemanticRailsViewHelpers @options[:class] ||= '' @options[:class] << ' attributes table' + @options.merge!(@context.send(:semantic_model_data, @object)) + @context.content_tag(:table, @options) do @context.capture(self, &@block) end diff --git a/lib/semantic_rails_view_helpers/capybara.rb b/lib/semantic_rails_view_helpers/capybara.rb index 1f1f044..54fb82f 100644 --- a/lib/semantic_rails_view_helpers/capybara.rb +++ b/lib/semantic_rails_view_helpers/capybara.rb @@ -24,7 +24,7 @@ def find_first(search) omatch = Capybara.match Capybara.match = :first result = find(search) - Capybara.match = omatch +Capybara.match = omatch result end @@ -178,15 +178,18 @@ def within_any(search, &block) raise Capybara::ElementNotFound if nodes.empty? + exceptions = [] + nodes.each_with_index do |node, index| begin within("#{search}:nth-child(#{index + 1})", &block) return true - rescue RSpec::Expectations::ExpectationNotMetError, Capybara::ElementNotFound + rescue RSpec::Expectations::ExpectationNotMetError, Capybara::ElementNotFound => e + exceptions << e end end - false + raise exceptions.last end def refind_object(object)