controllers フォルダーのサブドメインにいくつかのコントローラーがあります。
app/controllers/api/v1/offers_controller.rb
たとえば、次のようなコントローラーがあります。
class Api::V1::OffersController < ApplicationController
respond_to :json
def index
...some code here
end
end
spec/controllers/api/v1/offers_controller.rb
次のようなコントローラーを入れてみました。
「spec_helper」が必要
descripe Api::V1::OffersController do
describe "GET 'index'" do
it "returns http success" do
get 'index'
response.should be_success
end
end
end
ただし、実行するrspec spec
と、このテストはまったく実行されません。また、api_v1_offers_controller.rb という名前のディレクトリに配置しようとしましたがspec/controllers
、テストはまだ実行されていません。
これらのタイプのコントローラーの RSpec テストを作成するにはどうすればよいですか?