jnicklas/capybara — Issue #587: have_content space comparison
Author: coffeencoke
Created: 2012-01-03 16:45:53+00:00
State: open

Our issue:

```cucumber
Given a page with content "Page with two spaces"
When I assert for content "Page with two spaces"
Then it should be true
```

The matcher we are using is

```ruby
page.should have_content("Page with two spaces")
```

This uses the method:

```ruby
page.has_content?("Page with two spaces") # => false
```

Which generates an xpath matcher using normalize-space:

```xpath
./descendant-or-self::*[contains(normalize-space(.), 'Page with two spaces')]
```

Use Case:
Using Date.to_s(:long) can generate a string with 2 spaces in it.

I apologize if this has already been reported. When searching we found a lot of issues referring to the has_content? matcher but nothing with this specific problem.

If this is indeed an issue, we are open to providing a solution but we do not want to dive into it if it has already been addressed.

Thanks.