spec/spec/rails/matchers/assert_select_spec.rb in dchelimsky-rspec-rails-1.1.99.9 vs spec/spec/rails/matchers/assert_select_spec.rb in dchelimsky-rspec-rails-1.1.99.13
- old
+ new
@@ -10,15 +10,10 @@
def response=(content)
@content = content
end
- #NOTE - this is commented because response is implemented in lib/spec/rails/context/controller
- # def response(&block)
- # @update = block
- # end
- #
def html()
render :text=>@content, :layout=>false, :content_type=>Mime::HTML
@content = nil
end
@@ -482,12 +477,11 @@
it "should find all rjs from multiple statements" do
response.should have_rjs do
with_tag("#1")
with_tag("#2")
with_tag("#3")
- # with_tag("#4")
- # with_tag("#5")
+ with_tag("#4")
end
end
it "should find by id" do
response.should have_rjs("test1") { |rjs|
@@ -676,60 +670,10 @@
}.should raise_error(SpecFailed, "should not send email, but did")
end
end
-# describe "An rjs call to :visual_effect, a 'should have_rjs' spec with",
-# :type => :view do
-#
-# before do
-# render 'rjs_spec/visual_effect'
-# end
-#
-# it "should pass with the correct element name" do
-# response.should have_rjs(:effect, :fade, 'mydiv')
-# end
-#
-# it "should fail the wrong element name" do
-# lambda {
-# response.should have_rjs(:effect, :fade, 'wrongname')
-# }.should raise_error(SpecFailed)
-# end
-#
-# it "should fail with the correct element but the wrong command" do
-# lambda {
-# response.should have_rjs(:effect, :puff, 'mydiv')
-# }.should raise_error(SpecFailed)
-# end
-#
-# end
-#
-# describe "An rjs call to :visual_effect for a toggle, a 'should have_rjs' spec with",
-# :type => :view do
-#
-# before do
-# render 'rjs_spec/visual_toggle_effect'
-# end
-#
-# it "should pass with the correct element name" do
-# response.should have_rjs(:effect, :toggle_blind, 'mydiv')
-# end
-#
-# it "should fail with the wrong element name" do
-# lambda {
-# response.should have_rjs(:effect, :toggle_blind, 'wrongname')
-# }.should raise_error(SpecFailed)
-# end
-#
-# it "should fail the correct element but the wrong command" do
-# lambda {
-# response.should have_rjs(:effect, :puff, 'mydiv')
-# }.should raise_error(SpecFailed)
-# end
-#
-# end
-
describe "string.should have_tag", :type => :helper do
include AssertSelectSpecHelpers
it "should find root element" do
"<p>a paragraph</p>".should have_tag("p", "a paragraph")
@@ -743,10 +687,14 @@
it "should find child element" do
"<div><p>a paragraph</p></div>".should have_tag("p", "a paragraph")
end
+ it "should find nested element in one line" do
+ "<div><p>a paragraph</p></div>".should have_tag("div p","a paragraph")
+ end
+
it "should find nested element" do
"<div><p>a paragraph</p></div>".should have_tag("div") do
with_tag("p", "a paragraph")
end
end
@@ -806,6 +754,56 @@
it 'should not print errors from assert_select' do
mock = mock("Dog", :null_object => true)
html = "<b>#{mock.colour}</b>"
lambda {html.should have_tag('b')}.should_not raise_error
end
-end
+end
+
+# describe "An rjs call to :visual_effect, a 'should have_rjs' spec with",
+# :type => :view do
+#
+# before do
+# render 'rjs_spec/visual_effect'
+# end
+#
+# it "should pass with the correct element name" do
+# response.should have_rjs(:effect, :fade, 'mydiv')
+# end
+#
+# it "should fail the wrong element name" do
+# lambda {
+# response.should have_rjs(:effect, :fade, 'wrongname')
+# }.should raise_error(SpecFailed)
+# end
+#
+# it "should fail with the correct element but the wrong command" do
+# lambda {
+# response.should have_rjs(:effect, :puff, 'mydiv')
+# }.should raise_error(SpecFailed)
+# end
+#
+# end
+#
+# describe "An rjs call to :visual_effect for a toggle, a 'should have_rjs' spec with",
+# :type => :view do
+#
+# before do
+# render 'rjs_spec/visual_toggle_effect'
+# end
+#
+# it "should pass with the correct element name" do
+# response.should have_rjs(:effect, :toggle_blind, 'mydiv')
+# end
+#
+# it "should fail with the wrong element name" do
+# lambda {
+# response.should have_rjs(:effect, :toggle_blind, 'wrongname')
+# }.should raise_error(SpecFailed)
+# end
+#
+# it "should fail the correct element but the wrong command" do
+# lambda {
+# response.should have_rjs(:effect, :puff, 'mydiv')
+# }.should raise_error(SpecFailed)
+# end
+#
+# end
\ No newline at end of file