2014-06-12 13 views
40

Non sono sicuro se si tratta di un problema di Capybara, ma ho appena effettuato una nuova installazione di Rails (4.1.1) e Rspec Rails (3.0.1) e vorrei utilizzare Capybara (2.3.0), ma non averlo mai usato mi sto imbattendo in problemi. Ho creato una "specifica" in spec/features e la specifica stessa viene eseguita e trasmessa come previsto, ma ottengo i seguenti "avvertimenti" quando viene eseguito rspec. Qualche idea? Devo solo disabilitare gli avvisi a livello di rubino o qualcosa del genere?Rspec/Capybara caricamento in corso, circolare richiesta considerata dannosa

/Users/typeoneerror/.rvm/gems/[email protected]/gems/mail-2.5.4/lib/mail/network/delivery_methods/sendmail.rb:53: warning: shadowing outer local variable - to 
/Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247: warning: loading in progress, circular require considered harmful - /Users/typeoneerror/.rvm/gems/[email protected]/gems/capybara-2.3.0/lib/capybara.rb 
    from /Users/typeoneerror/.rvm/gems/[email protected]/bin/ruby_executable_hooks:15:in `<main>' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/bin/ruby_executable_hooks:15:in `eval' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/bin/rspec:23:in `<main>' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/bin/rspec:23:in `load' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/rspec-core-3.0.0/exe/rspec:4:in `<top (required)>' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:38:in `invoke' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:70:in `run' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:85:in `run' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/rspec-core-3.0.0/lib/rspec/core/runner.rb:97:in `setup' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051:in `load_spec_files' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051:in `each' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051:in `block in load_spec_files' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/rspec-core-3.0.0/lib/rspec/core/configuration.rb:1051:in `load' 
    from /Users/typeoneerror/Dev/Doki/engines/doki_core/spec/features/accounts/sign_up_spec.rb:1:in `<top (required)>' 
    from /Users/typeoneerror/Dev/Doki/engines/doki_core/spec/features/accounts/sign_up_spec.rb:1:in `require' 
    from /Users/typeoneerror/Dev/Doki/engines/doki_core/spec/rails_helper.rb:7:in `<top (required)>' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/rspec-rails-3.0.1/lib/rspec/rails.rb:9:in `<top (required)>' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/rspec-rails-3.0.1/lib/rspec/rails/vendor/capybara.rb:2:in `<top (required)>' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/capybara-2.3.0/lib/capybara/rspec.rb:1:in `<top (required)>' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/capybara-2.3.0/lib/capybara.rb:5:in `<top (required)>' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/capybara-2.3.0/lib/capybara.rb:320:in `<module:Capybara>' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/capybara-2.3.0/lib/capybara/dsl.rb:1:in `<top (required)>' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require' 
    from /Users/typeoneerror/.rvm/gems/[email protected]/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require' 
/Users/typeoneerror/.rvm/gems/[email protected]/gems/capybara-2.3.0/lib/capybara/node/matchers.rb:121: warning: assigned but unused variable - e 
/Users/typeoneerror/.rvm/gems/[email protected]/gems/capybara-2.3.0/lib/capybara/selenium/driver.rb:119: warning: assigned but unused variable - a 
+1

Ho avuto lo stesso problema quando ho aggiornato a RSpec 3 - e la risposta di Myron è corretta, spegnere gli avvertimenti. – Anthony

+0

Questo accade anche con la gemma sass (riceve l'avviso di richiesta circolare) da uno stock 'rails new' (almeno per 4.1.1 e 4.1.2) quando aggiungi rspec-rails ed esegui i generatori di rails per installare rspec e creare una specifica per le caratteristiche. La correzione è la stessa descritta, rimuovere - warnings dal file .rspec generato. – RatDaddy

risposta

94

Rimuovere --warnings da .rspec. Il generatore in rspec 3.0.0 includeva questa impostazione, ma ci siamo resi conto che si trattava di un errore: mentre è opportuno incoraggiare gli utenti a scrivere codice privo di avvisi, è difficile per gli utenti ottenere questi avvisi senza essere sicuri del perché.

Per maggiori informazioni:

https://github.com/rspec/rspec-core/issues/1571

+0

ha fatto il trucco, grazie, myron. – typeoneerror

+5

rimuovere "--warnings" da .rspec risolverà il problema ma molti degli avvertimenti sembrano essere causati dalla linea "--require spec_helper" in .rspec, almeno quando si esegue rspec sotto Rails, perché il file rails_helper.rb generato da "rails genera rspec: install" richiede esplicitamente anche spec_helper, risultante in risme di avvisi di dipendenza circolare. –

+0

@Jeremy - Ruby consente di richiedere lo stesso file più volte senza fornire avvisi, quindi ciò che descrivi è inaspettato. Puoi aprire un problema con rspec-rails per questo? –

Problemi correlati