def env_in_jp
return '本番環境' if Rails.env.production?
end
describe '環境別に処理を変える' do
it '本番環境' do
allow(Rails).to receive(:env).and_return('production'.inquiry)
expect(Rails.env.production?).to eq true
expect(env_in_jp).to eq '本番環境'
end
it '開発環境' do
allow(Rails).to receive(:env).and_return('development'.inquiry)
expect(Rails.env.development?).to eq true
expect(env_in_jp).to eq nil
end
end