Can i get RSpec to generate specs with expect syntax?
- by papirtiger
When generating specs with :
rails g controller Home index
A spec is generated with the older object.should syntax
require 'spec_helper'
describe HomeController do
describe "GET 'index'" do
it "returns http success" do
get 'index'
response.should be_success
end
end
end
Is it possible to configure the generator to use the expect syntax instead?
Desired output:
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
in config/application.rb:
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