What would cause Capybara (with selenium-webkit as the driver) to not render a partial in a Ruby on Rails 4.2.5 view? I have a pretty standard setup (spec helper included) and nothing fancy going on in the view directly relating to the partial that I can see (such as conditionals not allowing something in a test environment or something or other). Kinda lost on this one.
ENV['RAILS_ENV'] ||= 'test'
require 'spec_helper'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
require 'capybara/rails'
require 'capybara/rspec'
require 'email_spec'
require 'database_cleaner'
require 'bcrypt'
require 'sidekiq/testing'
Sidekiq::Testing.inline!
require 'rake'
require 'vcr'
require 'webmock'
require 'webmock/rspec'
Bookly::Application.load_tasks
require 'simplecov'
require 'metric_fu/metrics/rcov/simplecov_formatter'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::MetricFu
]
SimpleCov.start do
add_filter '/spec/'
add_filter '/config/'
add_filter '/lib/'
add_filter '/vendor/'
add_group 'Controllers', 'app/controllers'
add_group 'Models', 'app/models'
add_group 'Helpers', 'app/helpers'
add_group 'Mailers', 'app/mailers'
add_group 'Views', 'app/views'
add_group 'Services', 'app/services'
add_group 'Workers', 'app/workers'
add_group 'Presenters', 'app/presenters'
add_group 'Decorators', 'app/decorators'
minimum_coverage 80
end
include ActionDispatch::TestProcess
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
# in _spec.rb will both be required and run as specs, causing the specs to be
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
Dir[Rails.root.join('spec/fakes/**/*.rb')].each { |f| require f }
# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!
# Capybara Settings
# Capybara.register_driver :poltergeist do |app|
# Capybara::Poltergeist::Driver.new(app, { debug: false })
# end
# Capybara.register_driver :selenium_chrome do |app|
# Capybara::Selenium::Driver.new(app, :browser => :chrome)
# end
Capybara.javascript_driver = :selenium
Capybara.default_max_wait_time = 10
RSpec.configure do |config|
# Reduce cost
BCrypt::Engine::DEFAULT_COST = 1
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = false
config.include FactoryGirl::Syntax::Methods
config.include EmailSpec::Helpers
config.include EmailSpec::Matchers
config.include LoginMacros
config.include SecurityMacros
config.include ResourceAccessMacros
config.include ActiveSupport::Testing::TimeHelpers
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:all) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
Sidekiq::Worker.clear_all
end
config.before(:each, js: true) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
config.before(:all) do
# Rake::Task['init:yodlee'].invoke
DeferredGarbageCollection.start
end
config.after(:all) do
DeferredGarbageCollection.reconsider
end
# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and
# `post` in specs under `spec/controllers`.
#
# You can disable this behaviour by removing the line below, and instead
# explicitly tag your specs with their type, e.g.:
#
# RSpec.describe UsersController, :type => :controller do
# # ...
# end
#
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!
end
The view in question:
<div class="expanded clearfix">
<div class="inline-form edit-form clearfix">
<%= render partial: 'transactions/form', locals: { transaction: transaction.object } %>
</div>
</div>