# Need help with assert\_select semantics

**URL:** <https://www.ruby-forum.com/t/need-help-with-assert-select-semantics/170039>\
**Category:** Rails\
**Created:** [June 11, 2009, 4:47pm UTC](https://www.ruby-forum.com/t/need-help-with-assert-select-semantics/170039 "2009-06-11T16:47:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [June 11, 2009, 4:47pm UTC](https://www.ruby-forum.com/t/need-help-with-assert-select-semantics/170039/1 "2009-06-11T16:47:27Z")

</div>

I have this type of table row generated in a view:

…

  
  
CAD   
USD   
2009-04-05   
TEST   
  
1.184273  
  
features test   
  
…

There are many instances of dorex\_rate\_line and I wish to select only  
those that also contain a class “base\_rate\_is\_0.8444” and I wish to  
valiously test that there are: at least, exactly, or at most, N  
occurrences.

For the exact match I have tried this:

count = 1  
assert\_select( ‘.base\_rate\_is\_0.8444’, { :count =\> count.to\_i } )

But that gives this error:

Expected at least 1 element matching “base\_rate\_is\_0.8444”, found 0.  
 is not true. (Test::Unit::AssertionFailedError)

On the other hand, using exactly the same data I do this and it works as  
I anticipate:

```
count = 1
code = 'USD'
assert_select( '.quote_currency',
            { :maximum => count.to_i,
              :text => code })

```

So, what is it that I am misapprehending with assert\_select?

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [June 11, 2009, 5:38pm UTC](https://www.ruby-forum.com/t/need-help-with-assert-select-semantics/170039/2 "2009-06-11T17:38:21Z")

</div>

James B. wrote:

> So, what is it that I am misapprehending with assert\_select?

That one may not have a ‘.’ form part of a class value.

‘.base\_rate\_is\_0.8444’ s/b  
‘.base\_rate\_is\_0\_8444’
