Skip to content
This repository

not working with riot correctly? #80

Open
saiko-chriskun opened this Issue · 7 comments

3 participants

Chris Bolton Christoph Olszowka Elliott Mason
Chris Bolton

simplecov results: http://stuff.saikonet.org/images/misc/2011-09-18-150129_1024x768_scrot.png

my tests:

context 'New user visits web site' do
    base_uri 'http://localhost:3001'
    get '/'
    asserts_status.equals(200)
end
context 'Authentication' do
    context 'User signs up' do
      base_uri 'http://localhost:3001'
      post '/site/authenticate', body: { user: { email: 'saiko_chriskun@shortmail.com', password: 'my_pass' } }
      asserts_status.equals(200)
      asserts('display tasks') { response.body.match(/New Task/) != nil }
    end

    context 'User signs in' do
       base_uri 'http://localhost:3001'
       post '/site/authenticate', body: { user: { email: 'saiko_chriskun@shortmail.com', password: 'my_pass' } }
       asserts_status.equals(200)
       asserts('display tasks') { response.body.match(/New Task/) != nil }
     end
    context 'User tries to signup with existing email' do
       base_uri 'http://localhost:3001'
       post '/site/authenticate', body: { user: { email: 'saiko_chriskun@shortmail.com', password: 'incorrect_pass' } }
       asserts_status.equals(200)
       asserts('display flash message') { response.body.match(/taken!/) != nil }
     end
end
Christoph Olszowka
Owner

I haven't tried SimpleCov with riot yet, but there's no reason it shouldn't work. I'll try it out. Maybe this is related to the bug in the Coverage lib as figured out in #60.

Chris Bolton

yeah I think it's the Coverage lib as cover_me is churning out the same results :P

Christoph Olszowka
Owner

@saiko-chriskun Could you please edit your issue description to hold the code sample you had posted on StackOverflow as it seems the question is no longer present there and I wanted to provide Ruby core maintainers with this example on my already filed bug report on this: http://redmine.ruby-lang.org/issues/5333

Chris Bolton

not sure what changed exactly but it's not catching any of my controller code now (it doesn't detect any files under the controller tab) although the models seem to be fine.

Christoph Olszowka
Owner

Thanks for the report. I'm not using riot so I didn't realize the problem yet.

It would be great if you could create a cucumber feature and example that tests usage with the riot framework similar to those already existing and submit it as a Pull Request so I could go about fixing those.

Also, this might be related to #60.

Elliott Mason

I'm not having any trouble using it with Riot... Although, I was.

I'm trying to remember how I fixed it. I think what I actually ended up with was this: https://gist.github.com/1814276

Again, I'm fuzzy on the whole "fix". But I think it's the rand(99999) part that is the key. Somehow it allows the results to accumulate, otherwise each set of tests overwrites the previous set of results. Using a random name prevents the overwriting. (Well it actually just makes the odds 1:99999.) What you're probably encountering is your model tests being run after your controller tests, so the controller test coverage results get overwritten.

And yeah I'm pretty sure it's related to #60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.