我是Rspec的新用户,在设置安装gem和创建spec文件之后,当我运行bundle exec spec
时,我得到以下错误
aditya@aditya-Inspiron-3543:~/orthoweb$ bundle exec rspec
/home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `ip' for #<Rails::Application::Configuration:0x0000000443d038> (NoMethodError)
from /home/aditya/orthoweb/config/initializers/carrierwave.rb:4:in `block in <top (required)>'
from /home/aditya/.rvm/gems/ruby-2.2.2/bundler/gems/carrierwave-cc2ab785a9d4/lib/carrierwave/uploader/configuration.rb:158:in `configure'
from /home/aditya/.rvm/gems/ruby-2.2.2/bundler/gems/carrierwave-cc2ab785a9d4/lib/carrierwave.rb:14:in `configure'
from /home/aditya/orthoweb/config/initializers/carrierwave.rb:1:in `<top (required)>'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `block in load'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/engine.rb:652:in `block in load_config_initializer'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.3/lib/active_support/notifications.rb:166:in `instrument'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/engine.rb:651:in `load_config_initializer'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/engine.rb:615:in `each'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/engine.rb:615:in `block in <class:Engine>'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `run'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/aditya/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /home/aditya/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/aditya/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:420:in `block (2 levels) in each_strongly_connected_component_from'
from /home/aditya/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /home/aditya/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:419:in `block in each_strongly_connected_component_from'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `each'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `tsort_each_child'
from /home/aditya/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:413:in `call'
from /home/aditya/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:413:in `each_strongly_connected_component_from'
from /home/aditya/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/aditya/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /home/aditya/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /home/aditya/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/aditya/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /home/aditya/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/application.rb:352:in `initialize!'
from /home/aditya/orthoweb/config/environment.rb:5:in `<top (required)>'
from /home/aditya/orthoweb/spec/rails_helper.rb:4:in `require'
from /home/aditya/orthoweb/spec/rails_helper.rb:4:in `<top (required)>'
from /home/aditya/orthoweb/spec/controllers/beds_controller_spec.rb:1:in `require'
from /home/aditya/orthoweb/spec/controllers/beds_controller_spec.rb:1:in `<top (required)>'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1361:in `load'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1361:in `block in load_spec_files'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1359:in `each'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.4.1/lib/rspec/core/configuration.rb:1359:in `load_spec_files'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:102:in `setup'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:88:in `run'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:73:in `run'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.4.1/lib/rspec/core/runner.rb:41:in `invoke'
from /home/aditya/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.4.1/exe/rspec:4:in `<top (required)>'
from /home/aditya/.rvm/gems/ruby-2.2.2/bin/rspec:23:in `load'
from /home/aditya/.rvm/gems/ruby-2.2.2/bin/rspec:23:in `<main>'
from /home/aditya/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
from /home/aditya/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'
我的gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
gem 'responders', '~> 2.0'
# Use mysql as the database for Active Record
gem 'mysql2', '~> 0.3.20'
gem 'haml', '~> 4.0.5'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
gem 'mongoid_paranoia' #refer this link for commands info 'https://github.com/simi/mongoid_paranoia'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'time_difference', '~> 0.4.2'
gem 'simple_form', '~> 3.2'
gem 'remotipart', '~> 1.2.1'
gem 'letter_opener', group: :development
gem 'backbone-on-rails' #ADDED BY KUMAR ABINASH
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'hashie', '~> 3.3.1'
gem 'ventable'
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary-edge', '~> 0.12.2.1'
gem 'carrierwave',:git => "git://github.com/carrierwaveuploader/carrierwave.git"
gem 'global'
gem 'fiscali'
gem 'mongoid-ancestry'
gem 'inline_svg'
gem "bson"
gem "mongoid"
gem "moped", github: "mongoid/moped"
gem 'mongoid-history'
gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
gem 'nested_form'
gem 'apipie-rails', :git => 'git://github.com/Apipie/apipie-rails.git'
gem 'faker'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
gem 'seed_dump', group: [:development, :test]
gem 'pry-rails', :group => :development
gem 'will_paginate'
gem 'data-confirm-modal', github: 'ifad/data-confirm-modal'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :development, :test do
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'awesome_print'
end
group :test do
gem 'shoulda-matchers', require: false
gem 'capybara'
gem 'guard-rspec'
gem 'launchy'
gem 'database_cleaner'
end
# Use ActiveModel has_secure_password
gem 'bcrypt'
#gem 'bcrypt-ruby', '~> 3.1.2'
# Use unicorn as the app server
gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
gem 'authority',:git => "git://github.com/nathanl/authority.git"
gem 'rolify', :git => "git://github.com/EppO/rolify.git"
gem 'rmagick', '2.13.4'
gem 'nokogiri'
gem 'mini_magick'
gem 'mime-types'
gem 'sidekiq'
gem 'whenever', :require => false
gem 'state_machine'
gem 'state_machine-audit_trail'
# Use redis as session store
gem 'redis-store' , group: :production
gem 'redis-rails' , group: :production
#for client side validations
gem 'client_side_validations', github: 'DavyJonesLocker/client_side_validations'
gem 'client_side_validations-simple_form', github: 'DavyJonesLocker/client_side_validations-simple_form'
gem 'dicom'
gem 'high_voltage', '~> 2.3.0'
gem 'spreadsheet'
gem 'fog-aws'
gem 'gcm'
gem 'exception_notification'
Apllication.rb文件是:
require File.expand_path('../boot', __FILE__)
require 'rails/all'
require 'csv'
require "bson"
require "moped"
Moped::BSON = BSON
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Orthograph
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.generators do |gen|
gen.orm :active_record
end
config.action_view.embed_authenticity_token_in_remote_forms = true
config.i18n.enforce_available_locales = true
# AUTO LOAD PATHS -- HEALTHGRAPH
config.autoload_paths += Dir[Rails.root.join('app', 'controllers', '{**/}')]
config.autoload_paths += Dir[Rails.root.join('app', 'services', '{**/}')]
config.autoload_paths += Dir[Rails.root.join('app', 'models', '{**/}')]
config.autoload_paths += Dir[Rails.root.join('app', 'uploaders', '{**/}')]
config.autoload_paths += Dir[Rails.root.join('app', 'analytics', '{**/}')]
config.autoload_paths += Dir[Rails.root.join('app', 'authorizers', '{**/}')]
config.autoload_paths += Dir[Rails.root.join('app', 'workers', '{**/}')]
config.autoload_paths += Dir[Rails.root.join('app', 'jobs', '{**/}')]
config.autoload_paths += Dir[Rails.root.join('app', 'jobs','record_jobs', '{**/}')]
config.autoload_paths += Dir[Rails.root.join('app', 'jobs','email_jobs', '{**/}')]
config.autoload_paths += Dir[Rails.root.join('app', 'jobs','email_jobs','appointment_jobs' ,'{**/}')]
config.autoload_paths += Dir[Rails.root.join('app', 'jobs','sms_jobs', '{**/}')]
config.autoload_paths += Dir[Rails.root.join('app', 'jobs','sms_jobs','appointment_jobs' ,'{**/}')]
config.assets.paths << Rails.root.join("app", "assets", "patients")
config.time_zone = "Mumbai"
config.active_job.queue_adapter = :sidekiq
# config.active_job.queue_adapter = :sidekiq
end
end
任何人都可以告诉我问题出在哪里,如果我需要在此处添加更多文件以便更清楚地提出问题,请建议 我的caarierwave intializer文件是
CarrierWave.configure do |config|
if Rails.env.development? or Rails.env.test?
config.storage = :file
config.asset_host = Rails.application.config.ip
else
config.fog_provider = 'fog/aws'
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: 'xxxxxxxxxxxxxxxxxxx',
aws_secret_access_key: 'xxxxxxxxxxxxxxxx',
region: 'xxxxxxxxxxxx',
}
config.fog_directory = 'xxxxxxxx'
end
end
答案 0 :(得分:3)
因此,错误消息的前两行是:
/home/aditya/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `ip' for #<Rails::Application::Configuration:0x0000000443d038> (NoMethodError)
from /home/aditya/orthoweb/config/initializers/carrierwave.rb:4:in `block in <top (required)>'
您指的是某个方法ip
在某个方法Rails::Application::Configuration
上调用了没有该方法的内容。
当您在指定的行(:4:)查看您的carrierwave初始化程序文件时。第4行是你打电话:
config.asset_host = Rails.application.config.ip
所以,问题在于没有ip
方法可用。
您可能只想将其设置为:
config.asset_host = '0.0.0.0'