Skip to content

Commit

Permalink
Silence warning: instance variable @selected not initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary committed Nov 9, 2009
1 parent b45d44c commit 22e1f4b
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions actionpack/lib/action_controller/assertions/selector_assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@ module Assertions
#
# Use +css_select+ to select elements without making an assertions, either
# from the response HTML or elements selected by the enclosing assertion.
#
#
# In addition to HTML responses, you can make the following assertions:
# * +assert_select_rjs+ - Assertions on HTML content of RJS update and insertion operations.
# * +assert_select_encoded+ - Assertions on HTML encoded inside XML, for example for dealing with feed item descriptions.
# * +assert_select_email+ - Assertions on the HTML body of an e-mail.
#
# Also see HTML::Selector to learn how to use selectors.
module SelectorAssertions

def initialize(*args)
super
@selected = nil
end

# :call-seq:
# css_select(selector) => array
# css_select(element, selector) => array
Expand Down Expand Up @@ -53,8 +59,8 @@ module SelectorAssertions
# end
#
# # Selects all list items in unordered lists
# items = css_select("ul>li")
#
# items = css_select("ul>li")
#
# # Selects all form tags and then all inputs inside the form
# forms = css_select("form")
# forms.each do |form|
Expand Down Expand Up @@ -212,7 +218,7 @@ def assert_select(*args, &block)
# Otherwise just operate on the response document.
root = response_from_page_or_rjs
end

# First or second argument is the selector: string and we pass
# all remaining arguments. Array and we pass the argument. Also
# accepts selector itself.
Expand All @@ -225,7 +231,7 @@ def assert_select(*args, &block)
selector = arg
else raise ArgumentError, "Expecting a selector as the first argument"
end

# Next argument is used for equality tests.
equals = {}
case arg = args.shift
Expand Down Expand Up @@ -315,10 +321,10 @@ def assert_select(*args, &block)
# Returns all matches elements.
matches
end

def count_description(min, max) #:nodoc:
pluralize = lambda {|word, quantity| word << (quantity == 1 ? '' : 's')}

if min && max && (max != min)
"between #{min} and #{max} elements"
elsif min && !(min == 1 && max == 1)
Expand All @@ -327,7 +333,7 @@ def count_description(min, max) #:nodoc:
"at most #{max} #{pluralize['element', max]}"
end
end

# :call-seq:
# assert_select_rjs(id?) { |elements| ... }
# assert_select_rjs(statement, id?) { |elements| ... }
Expand All @@ -344,7 +350,7 @@ def count_description(min, max) #:nodoc:
# that update or insert an element with that identifier.
#
# Use the first argument to narrow down assertions to only statements
# of that type. Possible values are <tt>:replace</tt>, <tt>:replace_html</tt>,
# of that type. Possible values are <tt>:replace</tt>, <tt>:replace_html</tt>,
# <tt>:show</tt>, <tt>:hide</tt>, <tt>:toggle</tt>, <tt>:remove</tt> and
# <tt>:insert_html</tt>.
#
Expand Down Expand Up @@ -488,7 +494,7 @@ def assert_select_rjs(*args, &block)
# end
# end
# end
#
#
#
# # Selects all paragraph tags from within the description of an RSS feed
# assert_select_feed :rss, 2.0 do
Expand Down

0 comments on commit 22e1f4b

Please sign in to comment.