lib/rack/insight/rspec_matchers.rb in rack-insight-0.5.26 vs lib/rack/insight/rspec_matchers.rb in rack-insight-0.5.27
- old
+ new
@@ -15,9 +15,25 @@
failure_message_for_should do |response|
"Expected: \n#{response.body}\nto have a row matching #{key}"
end
end
+ RSpec::Matchers.define :have_li do |container, key, value|
+ match do |response|
+ if value
+ response.should have_selector("#{container} li", :content => key) do |row|
+ row.should contain(value)
+ end
+ else
+ response.should have_selector("#{container} li", :content => key)
+ end
+ end
+
+ failure_message_for_should do |response|
+ "Expected: \n#{response.body}\nto have a li matching #{key}"
+ end
+ end
+
RSpec::Matchers.define :have_heading do |text|
match do |response|
response.should have_selector("#rack-insight_toolbar li") do |heading|
heading.should contain(text)
end