staticメソッド

describe "comment" do
  context "サービスがHOGEの場合" do
    before do
      allow(Global.application).to receive(:service).and_return("HOGE") #<= キモ
      ...
    end

    it 'hoge' do
      ...
    end
  end
end

[RSpec] allow、receive、and_return メソッドを使って特定のメソッドをスタブ化する - Qiita

ハッシュ

    before do
      allow(ENV).to receive(:[]).and_call_original
      allow(ENV).to receive(:[]).with("RAILS_ENV").and_return("development")
    end