업데이트 : 나는이 컨트롤러 테스트를 실행하는거야 내가 해요 내가 테스트하고있어 컨트롤러와 내 보석 파일LoadError은 : 이러한 파일을로드 할 수 없습니다 - .../advertisement_controller_spec.rb
를 추가했습니다 이 LoadError를 가져 오면 어디서 오는지 알 수 없습니다. 나는 내 응용 프로그램에서 다른 테스트를 실행 했으므로 rspec이 올바르게 실행되고 있음을 확신합니다.
관련이있을 수 있습니다 어떤 다른 문제
: 내가 처음 내 레일 서버는 터미널 I 설치 번들을 실행Could not find proper version of railties (4.2.5) in any of the sources Run bundle install' to install missing gems.
을 반환 시작했을 때와 터미널이
An error occurred while installing pg (0.18.4), and Bundler cannot continue. Make sure that gem install pg -v '0.18.4' succeeds before bundling.
어떤 도움을 반환 크게 감사합니다!
제어기 규격 :
require 'rails_helper'
include RandomData
RSpec.describe AdvertisementsController, type: :controller do
let (:my_ad) do
Advertisement.create(
id: 1,
title: RandomData.random_sentence,
copy: RandomData.random_paragraph,
price: 99
)
end
describe "GET #index" do
it "returns http success" do
get :index
expect(response).to have_http_status(:success)
end
it "assigns [my_ad] to @advertisements" do
get :index
expect(assigns(:advertisements)).to eq([my_ad])
end
end
end
스택 트레이스 :
4DV3R54RYs-MBP:Development D35TR0Y3R$ rspec spec/controllers/advertisement_controller_spec.rb
/Users/a666/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.5.3/lib/rspec/core/configuration.rb:1435:in load: cannot load such file -- /Users/a666/Development/spec/controllers/advertisement_controller_spec.rb (LoadError)
from /Users/a666/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.5.3/lib/rspec/core/configuration.rb:1435:in block in load_spec_files
from /Users/a666/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.5.3/lib/rspec/core/configuration.rb:1433:in each
from /Users/a666/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.5.3/lib/rspec/core/configuration.rb:1433:in load_spec_files
from /Users/a666/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.5.3/lib/rspec/core/runner.rb:100:in setup
from /Users/a666/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.5.3/lib/rspec/core/runner.rb:86:in run
from /Users/a666/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.5.3/lib/rspec/core/runner.rb:71:in run
from /Users/a666/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.5.3/lib/rspec/core/runner.rb:45:in invoke
from /Users/a666/.rvm/gems/ruby-2.3.3/gems/rspec-core-3.5.3/exe/rspec:4:in <top (required)>
from /Users/a666/.rvm/gems/ruby-2.3.3/bin/rspec:22:in load
from /Users/a666/.rvm/gems/ruby-2.3.3/bin/rspec:22:in <main>
from /Users/a666/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in eval
from /Users/a666/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in <main>
컨트롤러 :
class AdvertisementsController < ApplicationController
def index
end
def show
end
def new
end
def create
end
end
Gemfile :
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# #1
group :production do
gem 'pg'
gem 'rails_12factor'
end
# #2
group :development do
gem 'sqlite3'
end
group :development, :test do
gem 'rspec-rails', '~> 3.0'
end
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'turbolinks'
gem 'bootstrap-sass'
gem 'pry-rails'
당신은 시스템에 Postgres를 설치 했습니까? –
gemfile과 컨트롤러를 모두 포함 할 수 있다면 도움이 될 것입니다. –
postgres가 있는지 모르겠지만 제가 설치 한 마지막 패키지 중 하나가 postgresql이었습니다. 나는 w/gem 파일 & 컨트롤러를 업데이트 할 것이다. –