Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix assert_select wanting something to call .css on #39

Open
wants to merge 1 commit into
base: 4.2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/prototype-rails/selector_assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,15 @@ def assert_select_rjs(*args, &block)
if matches
assert true # to count the assertion
if block_given? && !([:remove, :show, :hide, :toggle].include? rjs_type)
to_select = if ActionPack::VERSION::STRING > "4.2.0"
Nokogiri::HTML(matches.map(&:to_s).join)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this gem depends on Nokogiri? I don't think so. If we want to use nokogiri we need to make it a dependency

else
matches
end

begin
@selected ||= nil
in_scope, @selected = @selected, matches
in_scope, @selected = @selected, to_select
yield matches
ensure
@selected = in_scope
Expand All @@ -146,7 +152,7 @@ def assert_select_rjs(*args, &block)
flunk args.shift || flunk_message
end
end

protected

RJS_PATTERN_HTML = "\"((\\\\\"|[^\"])*)\""
Expand Down