jonleighton/poltergeist — pull request #144 by zumda (2012-09-02 19:36:46+00:00)
Title: join separate text nodes with a whitespace instead of nothing at all

This should fix issue #139.

Just using ```el.innertext```, as suggested by @carhartl won't work, since then we would lose the ```[not(ancestor::script)]``` part. Instead I just tally up all the text in an array and ```join``` it at the end with a space.

I don't know if you normally test these things (and where they should go), I couldn't find any appropriate place to put them. So here is the test just as a comment:

```ruby
it "treats
as a space" do
@session.visit '/poltergeist/simple'
@session.find('//div').text.should == "Two lines of text"
end
```

Of course this also means that (in this case) ```simple.erb``` should have a ```

Two lines
of text

```.