jpmobile を使っているプロジェクトの Rspec でスマートフォンのアクセスを行う
allow(request).to receive(:smart_phone?).and_return true
で request を スマートフォンのアクセスで stub する
describe ParentsController do def as_smart_phone_request! allow(request).to receive(:smart_phone?).and_return true end describe "GET #show" do context "スマートフォンの場合" do before(:each) do as_smart_phone_request! end it 'テストを書く' end end