2012-12-18 8 views
6

Moje testy integracji Rspec + Capybara działały poprawnie, dopóki nie zacząłem próbować interakcji z zależnymi od JavaScript elementami interfejsu za pomocą Capybara-Webkit .Dlaczego otrzymuję puste strony z Capybara-webkit, ale nie ze standardowym (nie-JS) sterownikiem

Kiedy próbuję korzystać z Capybara-Webkit, otrzymuję puste strony na save_and_open_line poniżej. Czemu?

/spec/features/area_spec.rb:

require 'spec_helper' 
describe "Area" do 
    ... 
    describe "Admin" do 
    ... 
    before(:each) do 
     Capybara.current_driver = :webkit 
     @virginia = User.create(
     :username => "Virginia", 
     :password => "password", 
     :password_confirmation => "password", 
     :email => "[email protected]") 
     @admin = Role.create(:name => "admin")  
     @assignment = Assignment.create(user_id: @virginia.id, role_id: @admin.id) 
     visit login_path 
     fill_in 'user_session_username', :with => @virginia.username 
     fill_in 'user_session_password', :with => @virginia.password 
     click_on 'submit_user_session' 
     visit report_path(@report) 
     save_and_open_page 
     page.find('#nav_reports').trigger(:mouseover) 
     ... 
    end 
    ... 
    end 
    ... 
end 

/spec/spec_helper.rb:

require 'rubygems' 
require 'spork' 
require 'database_cleaner' 
Spork.prefork do 
end 
Spork.each_run do 
end 
ENV["RAILS_ENV"] ||= 'test' 
require File.expand_path("../../config/environment", __FILE__) 
require 'rspec/rails' 
require 'capybara/rspec' 
require 'capybara/rails' 
require 'capybara/dsl' 
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} 
RSpec.configure do |config| 
    config.mock_with :rspec 
    config.fail_fast = true 
    config.fixture_path = "#{::Rails.root}/spec/fixtures" 
    config.before(:each) { ActionMailer::Base.deliveries.clear } 
    config.use_instantiated_fixtures = false 
    config.include(Capybara, :type => :integration) 
    Capybara.javascript_driver = :webkit 
    config.use_transactional_fixtures = false 
    config.before(:suite) do 
    DatabaseCleaner.clean_with :truncation 
    end 
    config.before(:each) do 
    if example.metadata[:js] 
     DatabaseCleaner.strategy = :truncation 
    else 
     DatabaseCleaner.strategy = :transaction 
    end 
    DatabaseCleaner.start 
    end 
    config.after(:each) do 
    DatabaseCleaner.clean 
    end 
end 

Kiedy usunąć Capybara.current_driver = :webkit z area_spec.rb (ale pozostawić Webkit pokrewne kod w spec_helper.rb), strona wygenerowana przez save_and_open_page nie jest pusta, ale w wierszu poleceń Rspec pojawia się następujący błąd:

Failure/Error: page.find('#nav_reports').trigger(:mouseover) 
    Capybara::NotSupportedByDriverError: 
     Capybara::NotSupportedByDriverError 

Początkowo próbowałem dodając :js => :true do przed block ... do, ale rspec przechowywane odrzucając moją składnię. Kiedy dodać :js => true do pierwszego it ... do block być pokryte przez blok before ... do, wciąż otrzymuję pustą stronę na save_and_open_page, ale błąd w wierszu poleceń rspec zmienia się na:

Failure/Error: page.find('#nav_reports').trigger(:mouseover) 
    Capybara::Webkit::NodeNotAttachedError: 
     Capybara::Webkit::NodeNotAttachedError 

kiedy przenieść Capybara.javascript_driver = :webkit na wyższy poziom w pliku spec_helper.rb, z bloku Rspec.configure do, pojawia się ten sam błąd.

Po wycięciu każdej linii z bloku before ... do i wklejeniu go do pierwszego it ... do block, który miał pokryć, pojawia się ten sam błąd.

Po ustawieniu config.use_transactional_fixtures = true i usunięciu całego kodu związanego z Webkit, specyfikacja działa, z wyjątkiem oczywiście dla page.find('#nav_reports').trigger(:mouseover), która wymaga sterownika Javascript.

UPDATE: I dodaje page.current_path.should == report_path(@report) przed save_and_open_page i odkrył, że coś o Kapibara-Webkit jest zatrzymanie moich visit report_path(@report) od pracy. (To działa dobrze, kiedy nie spróbować przetestować Javascript zależnych elementów interfejsu z Kapibara-Webkit). Kod błędu:

Failure/Error: page.current_path.should == report_path(@report) 
     expected: "/reports/3" 
      got: nil (using ==) 

kolejną aktualizację: Odkryłam, że kiedy używam Kapibara-Webkit , Rspec ma problem ze znalezieniem obiektu @report, nawet jeśli przeniesię moje oświadczenie @report = Report.create(...) do linii tuż przed odwiedzeniem report_path(@report). Pełne dziennika testu jest poniżej:

Marker - 19/12/2012 11:55:45 AM 
Connecting to database specified by database.yml 
    [1m[36m (2.1ms)[0m [1mALTER TABLE "references" DISABLE TRIGGER ALL;ALTER TABLE "values" DISABLE TRIGGER ALL;ALTER TABLE "variants" DISABLE TRIGGER ALL;ALTER TABLE "veracities" DISABLE TRIGGER ALL;ALTER TABLE "goods" DISABLE TRIGGER ALL;ALTER TABLE "orders" DISABLE TRIGGER ALL;ALTER TABLE "reports" DISABLE TRIGGER ALL;ALTER TABLE "roles" DISABLE TRIGGER ALL;ALTER TABLE "users" DISABLE TRIGGER ALL;ALTER TABLE "areas" DISABLE TRIGGER ALL;ALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "ijoins" DISABLE TRIGGER ALL;ALTER TABLE "fields" DISABLE TRIGGER ALL;ALTER TABLE "footnotes" DISABLE TRIGGER ALL;ALTER TABLE "gjoins" DISABLE TRIGGER ALL;ALTER TABLE "heuristics" DISABLE TRIGGER ALL;ALTER TABLE "assignments" DISABLE TRIGGER ALL;ALTER TABLE "categories" DISABLE TRIGGER ALL;ALTER TABLE "industries" DISABLE TRIGGER ALL;ALTER TABLE "markets" DISABLE TRIGGER ALL;ALTER TABLE "mjoins" DISABLE TRIGGER ALL[0m 
    [1m[35m (2.0ms)[0m select table_name from information_schema.views where table_schema = 'db/testivate_test' 
    [1m[36m (82.3ms)[0m [1mTRUNCATE TABLE "references", "values", "variants", "veracities", "goods", "orders", "reports", "roles", "users", "areas", "ijoins", "fields", "footnotes", "gjoins", "heuristics", "assignments", "categories", "industries", "markets", "mjoins" RESTART IDENTITY CASCADE;[0m 
    [1m[35m (1.7ms)[0m ALTER TABLE "references" ENABLE TRIGGER ALL;ALTER TABLE "variants" ENABLE TRIGGER ALL;ALTER TABLE "veracities" ENABLE TRIGGER ALL;ALTER TABLE "goods" ENABLE TRIGGER ALL;ALTER TABLE "values" ENABLE TRIGGER ALL;ALTER TABLE "orders" ENABLE TRIGGER ALL;ALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "reports" ENABLE TRIGGER ALL;ALTER TABLE "roles" ENABLE TRIGGER ALL;ALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "areas" ENABLE TRIGGER ALL;ALTER TABLE "ijoins" ENABLE TRIGGER ALL;ALTER TABLE "fields" ENABLE TRIGGER ALL;ALTER TABLE "footnotes" ENABLE TRIGGER ALL;ALTER TABLE "gjoins" ENABLE TRIGGER ALL;ALTER TABLE "heuristics" ENABLE TRIGGER ALL;ALTER TABLE "categories" ENABLE TRIGGER ALL;ALTER TABLE "industries" ENABLE TRIGGER ALL;ALTER TABLE "markets" ENABLE TRIGGER ALL;ALTER TABLE "mjoins" ENABLE TRIGGER ALL;ALTER TABLE "assignments" ENABLE TRIGGER ALL 
    [1m[36m (0.2ms)[0m [1mBEGIN[0m 
    [1m[35mUser Exists (0.7ms)[0m SELECT 1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER('[email protected]') LIMIT 1 
    [1m[36mUser Exists (0.3ms)[0m [1mSELECT 1 AS one FROM "users" WHERE LOWER("users"."username") = LOWER('Virginia') LIMIT 1[0m 
    [1m[35mUser Exists (0.3ms)[0m SELECT 1 AS one FROM "users" WHERE "users"."persistence_token" = 'f0a9f99733b2d60d466811c27c5b0375019959e894845e6baced63af874c93cada0b6f8dd1e94e3cb99447c8bfddbbc22ed991ac6b7924f80a84649689fb25c7' LIMIT 1 
    [1m[36mSQL (47.5ms)[0m [1mINSERT INTO "users" ("created_at", "crypted_password", "email", "password_salt", "persistence_token", "updated_at", "username") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"[0m [["created_at", Wed, 19 Dec 2012 00:56:22 UTC +00:00], ["crypted_password", "28f6bd928c62aab1dac4eb58c3ab3d8c09bb0ff762218bedfbf4457b234a0140cc4c7e01594fe6d9c0c5fc6acb283befc1eae12c21930187ba09547a413205fb"], ["email", "[email protected]"], ["password_salt", "BWr1wBmASo58D6d2j0aD"], ["persistence_token", "f0a9f99733b2d60d466811c27c5b0375019959e894845e6baced63af874c93cada0b6f8dd1e94e3cb99447c8bfddbbc22ed991ac6b7924f80a84649689fb25c7"], ["updated_at", Wed, 19 Dec 2012 00:56:22 UTC +00:00], ["username", "Virginia"]] 
    [1m[35m (0.5ms)[0m COMMIT 
    [1m[36m (0.1ms)[0m [1mBEGIN[0m 
    [1m[35mSQL (1.3ms)[0m INSERT INTO "roles" ("created_at", "name", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["created_at", Wed, 19 Dec 2012 00:56:23 UTC +00:00], ["name", "admin"], ["updated_at", Wed, 19 Dec 2012 00:56:23 UTC +00:00]] 
    [1m[36m (0.5ms)[0m [1mCOMMIT[0m 
    [1m[35m (0.1ms)[0m BEGIN 
    [1m[36mSQL (1.3ms)[0m [1mINSERT INTO "assignments" ("created_at", "role_id", "updated_at", "user_id") VALUES ($1, $2, $3, $4) RETURNING "id"[0m [["created_at", Wed, 19 Dec 2012 00:56:23 UTC +00:00], ["role_id", 1], ["updated_at", Wed, 19 Dec 2012 00:56:23 UTC +00:00], ["user_id", 1]] 
    [1m[35m (0.5ms)[0m COMMIT 
Started GET "/login" for 127.0.0.1 at 2012-12-19 11:56:29 +1100 
Processing by UserSessionsController#new as HTML 
    Rendered user_sessions/new.html.haml within layouts/application (30.1ms) 
    Rendered shared/_subscribe.html.haml (15.6ms) 
    Rendered shared/_share.html.haml (6.1ms) 
    Rendered shared/_contact.html.haml (10.2ms) 
Completed 200 OK in 420ms (Views: 319.1ms | ActiveRecord: 0.0ms) 
Started GET "/assets/application.css" for 127.0.0.1 at 2012-12-19 11:56:30 +1100 
Served asset /application.css - 200 OK (269ms) 
Started GET "/assets/application.js" for 127.0.0.1 at 2012-12-19 11:56:31 +1100 
Served asset /application.js - 200 OK (1611ms) 
Started GET "/assets/subtle_dots3.png" for 127.0.0.1 at 2012-12-19 11:56:33 +1100 
Served asset /subtle_dots3.png - 200 OK (75ms) 
Started GET "/assets/background.png" for 127.0.0.1 at 2012-12-19 11:56:33 +1100 
Served asset /background.png - 200 OK (56ms) 
Started GET "/assets/logo3.png" for 127.0.0.1 at 2012-12-19 11:56:33 +1100 
Served asset /logo3.png - 200 OK (24ms) 
    [1m[36m (0.1ms)[0m [1mBEGIN[0m 
Started POST "/user_sessions" for 127.0.0.1 at 2012-12-19 11:56:35 +1100 
Processing by UserSessionsController#create as HTML 
    Parameters: {"utf8"=>"✓", "user_session"=>{"username"=>"Virginia", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Login"} 
    [1m[35mSQL (118.9ms)[0m INSERT INTO "reports" ("created_at", "name", "short_name", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["created_at", Wed, 19 Dec 2012 00:56:35 UTC +00:00], ["name", "The Testivate Retail Site Search Benchmark"], ["short_name", "Search"], ["updated_at", Wed, 19 Dec 2012 00:56:35 UTC +00:00]] 
    [1m[36m (32.8ms)[0m [1mCOMMIT[0m 
    [1m[35mUser Load (1.3ms)[0m SELECT "users".* FROM "users" WHERE (LOWER("users".username) = 'virginia') LIMIT 1 
Redirected to http://127.0.0.1:61073/ 
Completed 302 Found in 348ms (ActiveRecord: 7.3ms) 
Started GET "/" for 127.0.0.1 at 2012-12-19 11:56:36 +1100 
Processing by HighVoltage::PagesController#show as HTML 
    Parameters: {"id"=>"home"} 
    [1m[36mUser Load (0.6ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1[0m 
    Rendered pages/home.html.haml within layouts/application (152.8ms) 
    Rendered shared/_subscribe.html.haml (0.2ms) 
    Rendered shared/_share.html.haml (0.2ms) 
    Rendered shared/_contact.html.haml (0.3ms) 
Completed 200 OK in 256ms (Views: 213.1ms | ActiveRecord: 0.6ms) 
Started GET "/assets/steven_portrait.jpg" for 127.0.0.1 at 2012-12-19 11:56:36 +1100 
Served asset /steven_portrait.jpg - 200 OK (18ms) 
Started GET "/assets/stack-of-papers3.png" for 127.0.0.1 at 2012-12-19 11:56:36 +1100 
Served asset /stack-of-papers3.png - 200 OK (10ms) 
Started GET "/assets/guarantee.png" for 127.0.0.1 at 2012-12-19 11:56:36 +1100 
Served asset /guarantee.png - 200 OK (3ms) 
Started GET "/assets/sample-chart.png" for 127.0.0.1 at 2012-12-19 11:56:36 +1100 
Served asset /sample-chart.png - 200 OK (3ms) 
Started GET "/reports/1" for 127.0.0.1 at 2012-12-19 11:56:39 +1100 
Processing by ReportsController#show as HTML 
    Parameters: {"id"=>"1"} 
    [1m[35mUser Load (0.5ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 
    [1m[36mReport Load (0.9ms)[0m [1mSELECT "reports".* FROM "reports" WHERE "reports"."id" = $1 LIMIT 1[0m [["id", "1"]] 
    [1m[35mRole Load (0.7ms)[0m SELECT "roles".* FROM "roles" INNER JOIN "assignments" ON "roles"."id" = "assignments"."role_id" WHERE "assignments"."user_id" = 1 
    [1m[36mCACHE (0.0ms)[0m [1mSELECT "reports".* FROM "reports" WHERE "reports"."id" = $1 LIMIT 1[0m [["id", "1"]] 
    [1m[35mArea Load (0.3ms)[0m SELECT "areas".* FROM "areas" 
    [1m[36mCategory Load (0.4ms)[0m [1mSELECT "categories".* FROM "categories" [0m 
    [1m[35mHeuristic Load (0.4ms)[0m SELECT "heuristics".* FROM "heuristics" WHERE "heuristics"."report_id" = 1 
    Rendered reports/show.html.haml within layouts/wide (34.9ms) 
Completed 200 OK in 499ms (Views: 161.8ms | ActiveRecord: 16.1ms) 
Started GET "/images/shadow.png" for 127.0.0.1 at 2012-12-19 11:56:39 +1100 
Started GET "/reports/1" for 127.0.0.1 at 2012-12-19 11:56:39 +1100 
Processing by ReportsController#show as HTML 
    Parameters: {"id"=>"1"} 
    [1m[36m (2.7ms)[0m [1mALTER TABLE "references" DISABLE TRIGGER ALL;ALTER TABLE "variants" DISABLE TRIGGER ALL;ALTER TABLE "veracities" DISABLE TRIGGER ALL;ALTER TABLE "goods" DISABLE TRIGGER ALL;ALTER TABLE "values" DISABLE TRIGGER ALL;ALTER TABLE "orders" DISABLE TRIGGER ALL;ALTER TABLE "schema_migrations" DISABLE TRIGGER ALL;ALTER TABLE "reports" DISABLE TRIGGER ALL;ALTER TABLE "roles" DISABLE TRIGGER ALL;ALTER TABLE "users" DISABLE TRIGGER ALL;ALTER TABLE "areas" DISABLE TRIGGER ALL;ALTER TABLE "ijoins" DISABLE TRIGGER ALL;ALTER TABLE "fields" DISABLE TRIGGER ALL;ALTER TABLE "footnotes" DISABLE TRIGGER ALL;ALTER TABLE "gjoins" DISABLE TRIGGER ALL;ALTER TABLE "heuristics" DISABLE TRIGGER ALL;ALTER TABLE "categories" DISABLE TRIGGER ALL;ALTER TABLE "industries" DISABLE TRIGGER ALL;ALTER TABLE "markets" DISABLE TRIGGER ALL;ALTER TABLE "mjoins" DISABLE TRIGGER ALL;ALTER TABLE "assignments" DISABLE TRIGGER ALL[0m 
    [1m[35mUser Load (0.8ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 
    [1m[36m (39.7ms)[0m [1mTRUNCATE TABLE "references", "values", "variants", "veracities", "goods", "orders", "reports", "roles", "users", "areas", "ijoins", "fields", "footnotes", "gjoins", "heuristics", "assignments", "categories", "industries", "markets", "mjoins" RESTART IDENTITY CASCADE;[0m 
    [1m[35mReport Load (37.2ms)[0m SELECT "reports".* FROM "reports" WHERE "reports"."id" = $1 LIMIT 1 [["id", "1"]] 
Completed 404 Not Found in 46ms 

ActiveRecord::RecordNotFound - Couldn't find Report with id=1: 
    (gem) activerecord-3.2.9/lib/active_record/relation/finder_methods.rb:341:in `find_one' 
    (gem) activerecord-3.2.9/lib/active_record/relation/finder_methods.rb:312:in `find_with_ids' 
    (gem) activerecord-3.2.9/lib/active_record/relation/finder_methods.rb:107:in `find' 
    (gem) activerecord-3.2.9/lib/active_record/querying.rb:5:in `find' 
    (gem) declarative_authorization-0.5.6/lib/declarative_authorization/in_controller.rb:143:in `load_controller_object' 
    (gem) declarative_authorization-0.5.6/lib/declarative_authorization/in_controller.rb:527:in `block in filter_resource_access' 
    (gem) activesupport-3.2.9/lib/active_support/callbacks.rb:440:in `_run__1180530030885761146__process_action__691010259609085274__callbacks' 
    (gem) activesupport-3.2.9/lib/active_support/callbacks.rb:405:in `__run_callback' 
    (gem) activesupport-3.2.9/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks' 
    (gem) activesupport-3.2.9/lib/active_support/callbacks.rb:81:in `run_callbacks' 
    (gem) actionpack-3.2.9/lib/abstract_controller/callbacks.rb:17:in `process_action' 
    (gem) actionpack-3.2.9/lib/action_controller/metal/rescue.rb:29:in `process_action' 
    (gem) actionpack-3.2.9/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' 
    (gem) activesupport-3.2.9/lib/active_support/notifications.rb:123:in `block in instrument' 
    (gem) activesupport-3.2.9/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
    (gem) activesupport-3.2.9/lib/active_support/notifications.rb:123:in `instrument' 
    (gem) actionpack-3.2.9/lib/action_controller/metal/instrumentation.rb:29:in `process_action' 
    (gem) actionpack-3.2.9/lib/action_controller/metal/params_wrapper.rb:207:in `process_action' 
    (gem) activerecord-3.2.9/lib/active_record/railties/controller_runtime.rb:18:in `process_action' 
    (gem) actionpack-3.2.9/lib/abstract_controller/base.rb:121:in `process' 
    (gem) actionpack-3.2.9/lib/abstract_controller/rendering.rb:45:in `process' 
    (gem) actionpack-3.2.9/lib/action_controller/metal.rb:203:in `dispatch' 
    (gem) actionpack-3.2.9/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' 
    (gem) actionpack-3.2.9/lib/action_controller/metal.rb:246:in `block in action' 
    (gem) actionpack-3.2.9/lib/action_dispatch/routing/route_set.rb:73:in `call' 
    (gem) actionpack-3.2.9/lib/action_dispatch/routing/route_set.rb:73:in `dispatch' 
    (gem) actionpack-3.2.9/lib/action_dispatch/routing/route_set.rb:36:in `call' 
    (gem) journey-1.0.4/lib/journey/router.rb:68:in `block in call' 
    (gem) journey-1.0.4/lib/journey/router.rb:56:in `each' 
    (gem) journey-1.0.4/lib/journey/router.rb:56:in `call' 
    (gem) actionpack-3.2.9/lib/action_dispatch/routing/route_set.rb:601:in `call' 
    (gem) better_errors-0.2.0/lib/better_errors/middleware.rb:23:in `app_call' 
    (gem) better_errors-0.2.0/lib/better_errors/middleware.rb:17:in `call' 
    (gem) sass-3.2.3/lib/sass/plugin/rack.rb:54:in `call' 
    (gem) actionpack-3.2.9/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' 
    (gem) rack-1.4.1/lib/rack/etag.rb:23:in `call' 
    (gem) rack-1.4.1/lib/rack/conditionalget.rb:25:in `call' 
    (gem) actionpack-3.2.9/lib/action_dispatch/middleware/head.rb:14:in `call' 
    (gem) actionpack-3.2.9/lib/action_dispatch/middleware/params_parser.rb:21:in `call' 
    (gem) actionpack-3.2.9/lib/action_dispatch/middleware/flash.rb:242:in `call' 
    (gem) rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context' 
    (gem) rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call' 
    (gem) actionpack-3.2.9/lib/action_dispatch/middleware/cookies.rb:341:in `call' 
    (gem) activerecord-3.2.9/lib/active_record/query_cache.rb:64:in `call' 
    (gem) activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call' 
    (gem) actionpack-3.2.9/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' 
    (gem) activesupport-3.2.9/lib/active_support/callbacks.rb:405:in `_run__3970772839722169598__call__3997376486539605674__callbacks' 
    (gem) activesupport-3.2.9/lib/active_support/callbacks.rb:405:in `__run_callback' 
    (gem) activesupport-3.2.9/lib/active_support/callbacks.rb:385:in `_run_call_callbacks' 
    (gem) activesupport-3.2.9/lib/active_support/callbacks.rb:81:in `run_callbacks' 
    (gem) actionpack-3.2.9/lib/action_dispatch/middleware/callbacks.rb:27:in `call' 
    (gem) actionpack-3.2.9/lib/action_dispatch/middleware/remote_ip.rb:31:in `call' 
    (gem) actionpack-3.2.9/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call' 
    (gem) actionpack-3.2.9/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' 
    (gem) railties-3.2.9/lib/rails/rack/logger.rb:32:in `call_app' 
    (gem) railties-3.2.9/lib/rails/rack/logger.rb:16:in `block in call' 
    (gem) activesupport-3.2.9/lib/active_support/tagged_logging.rb:22:in `tagged' 
    (gem) railties-3.2.9/lib/rails/rack/logger.rb:16:in `call' 
    (gem) actionpack-3.2.9/lib/action_dispatch/middleware/request_id.rb:22:in `call' 
    (gem) rack-1.4.1/lib/rack/methodoverride.rb:21:in `call' 
    (gem) rack-1.4.1/lib/rack/runtime.rb:17:in `call' 
    (gem) activesupport-3.2.9/lib/active_support/cache/strategy/local_cache.rb:72:in `call' 
    (gem) rack-1.4.1/lib/rack/lock.rb:15:in `call' 
    (gem) actionpack-3.2.9/lib/action_dispatch/middleware/static.rb:62:in `call' 
    (gem) railties-3.2.9/lib/rails/engine.rb:479:in `call' 
    (gem) railties-3.2.9/lib/rails/application.rb:223:in `call' 
    (gem) rack-1.4.1/lib/rack/builder.rb:134:in `call' 
    (gem) rack-1.4.1/lib/rack/urlmap.rb:64:in `block in call' 
    (gem) rack-1.4.1/lib/rack/urlmap.rb:49:in `each' 
    (gem) rack-1.4.1/lib/rack/urlmap.rb:49:in `call' 
    (gem) capybara-2.0.1/lib/capybara/server.rb:19:in `call' 
    (gem) rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service' 
    /Users/steven/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service' 
    /Users/steven/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run' 
    /Users/steven/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread' 

    [1m[36m (1.7ms)[0m [1mALTER TABLE "references" ENABLE TRIGGER ALL;ALTER TABLE "variants" ENABLE TRIGGER ALL;ALTER TABLE "veracities" ENABLE TRIGGER ALL;ALTER TABLE "goods" ENABLE TRIGGER ALL;ALTER TABLE "values" ENABLE TRIGGER ALL;ALTER TABLE "orders" ENABLE TRIGGER ALL;ALTER TABLE "reports" ENABLE TRIGGER ALL;ALTER TABLE "roles" ENABLE TRIGGER ALL;ALTER TABLE "users" ENABLE TRIGGER ALL;ALTER TABLE "areas" ENABLE TRIGGER ALL;ALTER TABLE "schema_migrations" ENABLE TRIGGER ALL;ALTER TABLE "ijoins" ENABLE TRIGGER ALL;ALTER TABLE "fields" ENABLE TRIGGER ALL;ALTER TABLE "footnotes" ENABLE TRIGGER ALL;ALTER TABLE "gjoins" ENABLE TRIGGER ALL;ALTER TABLE "heuristics" ENABLE TRIGGER ALL;ALTER TABLE "assignments" ENABLE TRIGGER ALL;ALTER TABLE "categories" ENABLE TRIGGER ALL;ALTER TABLE "industries" ENABLE TRIGGER ALL;ALTER TABLE "markets" ENABLE TRIGGER ALL;ALTER TABLE "mjoins" ENABLE TRIGGER ALL[0m 

Odpowiedz

0

Mam podobny problem, wciąż próbuje znaleźć dokładną problemu, ale przy użyciu page.visit zamiast tylko visit wydaje się pomagać.

6

Prawdopodobnie nie jest prawidłowa odpowiedź, ale tylko w przypadku kogoś innego google tę odpowiedź jak ja, szuka pomysłów:

zapomniałem ukośnik z przodu mojego visit URL.Z jakiegoś powodu domyślny sterownik stelaża był w porządku, ale moje sterowniki JS nie były (zarówno kapibara-webkit, jak i poltergeist).

0

Używamy capybara-WebKit 1.3.1, Kapibara 2.1.0

widziałam tego powodu jest zwrócony kod 304 statusu. Myślę, że Capybara Webkit z jakiegokolwiek powodu nie wyrenderował strony (prawdopodobnie z powodu kodu innego niż 2xx) i zwróciłby pustą stronę.

Po ustawieniu nagłówków, aby nie były buforowane, problem ten ustąpił w naszej sytuacji.