end
end
context 'つつがなく終わるとき' do
- it 'ステータスコード200 OKを返す' do
- get :panel
- response.should be_success
- end
it 'コマモデルに一覧を問い合わせている' do
Panel.should_receive(:mylist).exactly(1)
get :panel
assigns(:panels).should have_at_least(3).items
end
context 'html形式' do
+ it 'ステータスコード200 OKを返す' do
+ get :panel
+ response.should be_success
+ end
it 'panelテンプレートを描画する' do
get :panel
response.should render_template("panel")
end
end
context 'json形式' do
+ it 'ステータスコード200 OKを返す' do
+ get :panel, :format => :json
+ response.should be_success
+ end
it 'jsonデータを返す' do
get :panel, :format => :json
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
end
+ it 'コマモデルにコマリストのjson出力を問い合わせている' do
+ Panel.should_receive(:list_as_json_text).exactly(1)
+ get :panel, :format => :json
+ end
it 'データがリスト構造になっている' do
get :panel, :format => :json
json = JSON.parse response.body