생성 스펙 :RSpec에서 expect 구문을 사용하여 스펙을 생성 할 수 있습니까? 와
rails g controller Home index
스펙은 이전 object.should 구문
require 'spec_helper'
describe HomeController do
describe "GET 'index'" do
it "returns http success" do
get 'index'
response.should be_success
end
end
end
생성됩니다 그것은 대신 구문을 기대 사용하는 발전기를 구성 할 수 있습니까?
원하는 출력 : 설정/application.rb에
require 'spec_helper'
describe HomeController do
describe "GET 'index'" do
it "returns http success" do
get 'index'
expect(response).to be_success
end
end
end
:
config.generators do |g|
g.test_framework :rspec, fixture: true
g.fixture_replacement :factory_girl, dir: 'spec/factories'
g.view_specs false
g.stylesheets = false
g.javascripts = false
end
이 내용은 [commit] (https://github.com/rspec/rspec-rails/commit/652a77d24874d15feebce473dfb8de19d12708a)에 의해 수정되었으며 더 이상 관련이 없습니다. – max