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)