[rspec-users] Need help in View Spec
flyeminent at hotmail.com
Thu Sep 13 23:09:52 EDT 2007
To spec the example I mentioned before, I wrote the spec as what you
describe "/group/_index_spec" do
it "should call JS function when click the button" do
response.should have_tag("input[onclick=?]", "update()")
However, it generated an error "Expecting a selector as the first argument".
What is wrong?
David Chelimsky-2 wrote:
> On 9/13/07, Shaker <flyeminent at hotmail.com> wrote:
>> Yes, I have gone through the documentation before, and I read the
>> of 'assert_select' as well. But I still can not figure out a way of
>> attributes in a tag. What I know is we can use:
>> should have_tag("tag#id") or should have_tag("tag.class")
>> to select a tag, whereas I don't know how to select an attribute and test
> That's all covered in the assert_select docs. Here's a cheat sheet you
> might find useful.
> so you can do this:
> response.should have_tag("form[action=?][method=post]", foo_path(@foo))
>> Another problem is the tag does not have id or class sometimes, does it
>> that is no way of selecting it?
>> David Chelimsky-2 wrote:
>> > On 9/13/07, Shaker <flyeminent at hotmail.com> wrote:
>> >> I can not find much
>> >> information about the "should have_tag" syntax in Rspec.
>> > _______________________________________________
>> > rspec-users mailing list
>> > rspec-users at rubyforge.org
>> > http://rubyforge.org/mailman/listinfo/rspec-users
>> View this message in context:
>> Sent from the rspec-users mailing list archive at Nabble.com.
>> rspec-users mailing list
>> rspec-users at rubyforge.org
> rspec-users mailing list
> rspec-users at rubyforge.org
View this message in context: http://www.nabble.com/Need-help-in-View-Spec-tf4439760.html#a12667709
Sent from the rspec-users mailing list archive at Nabble.com.
More information about the rspec-users