Empty test suite / Not Tests found
Trying to run spec test below, but returning "No Tests were found"
require 'spec_helper'
describe "StaticPages" do
describe "Home page" do
it "should have the content 'Sample App'" do
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
visit '/static_pages/home'
page.should have_content('Sample App')
end
end
end
spec_helper file is
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# 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 = true
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
end
If I change the "require 'spec_helper'" to "require 'rspec'" it seems to run the test, but then cannot find the "view" method.
请先登录再写评论。
Also just realized these errors:
/Users/kimardenmiller/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/bin/spork rspec
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:47:in `resolve_hash_connection'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:129:in `establish_connection'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/railtie.rb:82:in `block (2 levels) in <class:Railtie>'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `each'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/base.rb:721:in `<top (required)>'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/rspec-rails-2.11.0/lib/rspec/rails/extensions/active_record/base.rb:19:in `<module:Extensions>'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/rspec-rails-2.11.0/lib/rspec/rails/extensions/active_record/base.rb:4:in `<module:Rails>'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/rspec-rails-2.11.0/lib/rspec/rails/extensions/active_record/base.rb:2:in `<module:RSpec>'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/rspec-rails-2.11.0/lib/rspec/rails/extensions/active_record/base.rb:1:in `<top (required)>'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/rspec-rails-2.11.0/lib/rspec/rails/extensions.rb:1:in `<top (required)>'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/rspec-rails-2.11.0/lib/rspec/rails.rb:8:in `<top (required)>'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/Users/kimardenmiller/RubymineProjects/Sample_App/spec/spec_helper.rb:13:in `block in <top (required)>'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork.rb:24:in `prefork'
/Users/kimardenmiller/RubymineProjects/Sample_App/spec/spec_helper.rb:4:in `<top (required)>'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `block in load'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/test_framework.rb:138:in `block (2 levels) in preload'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/app_framework/rails.rb:8:in `preload'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/test_framework.rb:134:in `block in preload'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork.rb:62:in `exec_prefork'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/test_framework.rb:120:in `preload'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:25:in `preload'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/runner.rb:74:in `run'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/lib/spork/runner.rb:10:in `run'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/gems/spork-0.9.2/bin/spork:10:in `<top (required)>'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/bin/spork:23:in `load'
/Users/kimardenmiller/.rvm/gems/ruby-1.9.3-p194/bin/spork:23:in `<top (required)>'
-e:1:in `load'
-e:1:in `<main>'
Process finished with exit code 1
Are you able to run the test in command line?
Reagrds, Oleg.
No ... which led me to the solution ....
My test database had not been created.
Thanks!