@sp = FactoryGirl.create :system_picture
@lg = FactoryGirl.create :license_group
@license = FactoryGirl.create :license, :license_group_id => @lg.id, :system_picture_id => @sp.id
+ @speech_balloon_template = FactoryGirl.create :speech_balloon_template, "name" => "circle@pettan.com", "classname" => "CircleSpeechBalloon", "caption" => "cc", "system_picture_id" => @sp.id, "settings" => '{}'
+ @writing_format = FactoryGirl.create :writing_format
@user = FactoryGirl.create( :user_yas)
@author = FactoryGirl.create :author, :user_id => @user.id
@artist = FactoryGirl.create :artist_yas, :author_id => @author.id
- @color = FactoryGirl.create :color
@op = FactoryGirl.create :original_picture, :artist_id => @artist.id
@p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @artist.id
@rp = FactoryGirl.create :resource_picture, :artist_id => @artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id
end
context 'パラメータpageについて' do
it '@pageに値が入る' do
- get :comic, :page => 5
+ get :comics, :page => 5
assigns(:page).should eq 5
end
it '省略されると@pageに1値が入る' do
- get :comic
+ get :comics
assigns(:page).should eq 1
end
it '与えられたpage_sizeがセットされている' do
- get :comic, :page_size => 15
+ get :comics, :page_size => 15
assigns(:page_size).should eq 15
end
it '省略されると@page_sizeにデフォルト値が入る' do
- get :comic
+ get :comics
assigns(:page_size).should eq Author.default_comic_page_size
end
it '最大を超えると@page_sizeにデフォルト最大値が入る' do
- get :comic, :page_size => 1500
+ get :comics, :page_size => 1500
assigns(:page_size).should eq Author.comic_max_page_size
end
it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do
- get :comic, :page_size => 0
+ get :comics, :page_size => 0
assigns(:page_size).should eq Author.default_comic_page_size
end
end
context 'つつがなく終わるとき' do
it 'ステータスコード200 OKを返す' do
- get :comic
+ get :comics
response.should be_success
end
it 'コミックモデルに一覧を問い合わせている' do
Comic.should_receive(:mylist).exactly(1)
- get :comic
+ get :comics
end
it '@comicsにリストを取得している' do
- get :comic
+ get :comics
assigns(:comics).should have_at_least(3).items
end
context 'html形式' do
- it 'comicテンプレートを描画する' do
- get :comic
- response.should render_template("comic")
+ it '@paginateにページ制御を取得している' do
+ get :comics
+ assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+ end
+ it 'comicsテンプレートを描画する' do
+ get :comics
+ response.should render_template("comics")
end
end
context 'json形式' do
it 'jsonデータを返す' do
- get :comic, :format => :json
+ get :comics, :format => :json
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
end
it 'コミックモデルにjson一覧出力オプションを問い合わせている' do
Comic.should_receive(:list_json_opt).exactly(1)
- get :comic, :format => :json
+ get :comics, :format => :json
end
it 'データがリスト構造になっている' do
- get :comic, :format => :json
+ get :comics, :format => :json
json = JSON.parse response.body
json.should have_at_least(3).items
end
it 'リストの先頭くらいはコミックっぽいものであって欲しい' do
- get :comic, :format => :json
+ get :comics, :format => :json
json = JSON.parse response.body
json.first.has_key?("title").should be_true
json.first.has_key?("visible").should be_true
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :comic
+ get :comics
response.status.should eq 302
end
it 'サインインページへ遷移する' do
- get :comic
+ get :comics
response.should redirect_to '/users/sign_in'
end
end
context 'json形式' do
it 'ステータスコード401 Unauthorizedを返す' do
- get :comic, :format => :json
+ get :comics, :format => :json
response.status.should eq 401
end
it '応答メッセージにUnauthorizedを返す' do
- get :comic, :format => :json
+ get :comics, :format => :json
response.message.should match(/Unauthorized/)
end
end
end
context 'パラメータpageについて' do
it '@pageに値が入る' do
- get :panel, :page => 5
+ get :panels, :page => 5
assigns(:page).should eq 5
end
it '省略されると@pageに1値が入る' do
- get :panel
+ get :panels
assigns(:page).should eq 1
end
it '与えられたpage_sizeがセットされている' do
- get :panel, :page_size => 15
+ get :panels, :page_size => 15
assigns(:page_size).should eq 15
end
it '省略されると@page_sizeにデフォルト値が入る' do
- get :panel
+ get :panels
assigns(:page_size).should eq Author.default_panel_page_size
end
it '最大を超えると@page_sizeにデフォルト最大値が入る' do
- get :panel, :page_size => 1500
+ get :panels, :page_size => 1500
assigns(:page_size).should eq Author.panel_max_page_size
end
it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do
- get :panel, :page_size => 0
+ get :panels, :page_size => 0
assigns(:page_size).should eq Author.default_panel_page_size
end
end
context 'つつがなく終わるとき' do
it 'コマモデルに一覧を問い合わせている' do
Panel.should_receive(:mylist).exactly(1)
- get :panel
+ get :panels
end
it '@panelsにリストを取得している' do
- get :panel
+ get :panels
assigns(:panels).should have_at_least(3).items
end
context 'html形式' do
+ it '@paginateにページ制御を取得している' do
+ get :panels
+ assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+ end
it 'ステータスコード200 OKを返す' do
- get :panel
+ get :panels
response.should be_success
end
- it 'panelテンプレートを描画する' do
- get :panel
- response.should render_template("panel")
+ it 'panelsテンプレートを描画する' do
+ get :panels
+ response.should render_template("panels")
end
end
context 'json形式' do
it 'ステータスコード200 OKを返す' do
- get :panel, :format => :json
+ get :panels, :format => :json
response.should be_success
end
it 'jsonデータを返す' do
- get :panel, :format => :json
+ get :panels, :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
+ get :panels, :format => :json
end
it 'データがリスト構造になっている' do
- get :panel, :format => :json
+ get :panels, :format => :json
json = JSON.parse response.body
json.should have_at_least(3).items
end
it 'リストの先頭くらいはコマっぽいものであって欲しい' do
- get :panel, :format => :json
+ get :panels, :format => :json
json = JSON.parse response.body
json.first.has_key?("z").should be_true
end
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :panel
+ get :panels
response.status.should eq 302
end
it 'サインインページへ遷移する' do
- get :panel
+ get :panels
response.should redirect_to '/users/sign_in'
end
end
context 'json形式' do
it 'ステータスコード401 Unauthorizedを返す' do
- get :panel, :format => :json
+ get :panels, :format => :json
response.status.should eq 401
end
it '応答メッセージにUnauthorizedを返す' do
- get :panel, :format => :json
+ get :panels, :format => :json
response.message.should match(/Unauthorized/)
end
end
end
context 'パラメータpageについて' do
it '@pageに値が入る' do
- get :panel_picture, :page => 5
+ get :panel_pictures, :page => 5
assigns(:page).should eq 5
end
it '省略されると@pageに1値が入る' do
- get :panel_picture
+ get :panel_pictures
assigns(:page).should eq 1
end
it '与えられたpage_sizeがセットされている' do
- get :panel_picture, :page_size => 15
+ get :panel_pictures, :page_size => 15
assigns(:page_size).should eq 15
end
it '省略されると@page_sizeにデフォルト値が入る' do
- get :panel_picture
+ get :panel_pictures
assigns(:page_size).should eq Author.default_panel_picture_page_size
end
it '最大を超えると@page_sizeにデフォルト最大値が入る' do
- get :panel_picture, :page_size => 1500
+ get :panel_pictures, :page_size => 1500
assigns(:page_size).should eq Author.panel_picture_max_page_size
end
it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do
- get :panel_picture, :page_size => 0
+ get :panel_pictures, :page_size => 0
assigns(:page_size).should eq Author.default_panel_picture_page_size
end
end
context 'つつがなく終わるとき' do
it 'ステータスコード200 OKを返す' do
- get :panel_picture
response.should be_success
end
it 'コマ絵モデルに一覧を問い合わせている' do
PanelPicture.should_receive(:mylist).exactly(1)
- get :panel_picture
+ get :panel_pictures
end
it '@panel_picturesにリストを取得している' do
- get :panel_picture
+ get :panel_pictures
assigns(:panel_pictures).should have_at_least(3).items
end
context 'html形式' do
- it 'panel_pictureテンプレートを描画する' do
- get :panel_picture
- response.should render_template("panel_picture")
+ it '@paginateにページ制御を取得している' do
+ get :panel_pictures
+ assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+ end
+ it 'panel_picturesテンプレートを描画する' do
+ get :panel_pictures
+ response.should render_template("panel_pictures")
end
end
context 'json形式' do
it 'jsonデータを返す' do
- get :panel_picture, :format => :json
+ get :panel_pictures, :format => :json
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
end
it 'コマ絵モデルにjson一覧出力オプションを問い合わせている' do
PanelPicture.should_receive(:list_json_opt).exactly(1)
- get :panel_picture, :format => :json
+ get :panel_pictures, :format => :json
end
it 'データがリスト構造になっている' do
- get :panel_picture, :format => :json
+ get :panel_pictures, :format => :json
json = JSON.parse response.body
json.should have_at_least(3).items
end
it 'リストの先頭くらいはコマ絵っぽいものであって欲しい' do
- get :panel_picture, :format => :json
+ get :panel_pictures, :format => :json
json = JSON.parse response.body
json.first.has_key?("link").should be_true
json.first.has_key?("x").should be_true
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :panel_picture
+ get :panel_pictures
response.status.should eq 302
end
it 'サインインページへ遷移する' do
- get :panel_picture
+ get :panel_pictures
response.should redirect_to '/users/sign_in'
end
end
context 'json形式' do
it 'ステータスコード401 Unauthorizedを返す' do
- get :panel_picture, :format => :json
+ get :panel_pictures, :format => :json
response.status.should eq 401
end
it '応答メッセージにUnauthorizedを返す' do
- get :panel_picture, :format => :json
+ get :panel_pictures, :format => :json
response.message.should match(/Unauthorized/)
end
end
end
end
- describe 'è\87ªå\88\86ã\81®ã\82³ã\83\9eã\81®è\89²è\83\8cæ\99¯一覧表示に於いて' do
+ describe 'è\87ªå\88\86ã\81®ã\83\95ã\82ã\83\80ã\82·一覧表示に於いて' do
before do
- @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
+ @sb = FactoryGirl.build :speech_balloon, :panel_id => @panel.id, :speech_balloon_template_id => @speech_balloon_template.id
+ @speech = @sb.build_speech(
+ FactoryGirl.attributes_for(:speech, :writing_format_id => @writing_format.id)
+ )
+ @balloon = @sb.build_balloon(
+ FactoryGirl.attributes_for(:balloon, :system_picture_id => @sp.id)
+ )
+ @sb.boost
+ @sb.save!
sign_in @user
- PanelColor.stub(:mylist).and_return([@pc, @pc, @pc])
+ SpeechBalloon.stub(:mylist).and_return([@sb, @sb, @sb])
end
context 'パラメータpageについて' do
it '@pageに値が入る' do
- get :panel_color, :page => 5
+ get :speech_balloons, :page => 5
assigns(:page).should eq 5
end
it '省略されると@pageに1値が入る' do
- get :panel_color
+ get :speech_balloons
assigns(:page).should eq 1
end
it '与えられたpage_sizeがセットされている' do
- get :panel_color, :page_size => 15
+ get :speech_balloons, :page_size => 15
assigns(:page_size).should eq 15
end
it '省略されると@page_sizeにデフォルト値が入る' do
- get :panel_color
- assigns(:page_size).should eq PanelColor.default_page_size
+ get :speech_balloons
+ assigns(:page_size).should eq Author.default_speech_balloon_page_size
end
it '最大を超えると@page_sizeにデフォルト最大値が入る' do
- get :panel_color, :page_size => 1500
- assigns(:page_size).should eq PanelColor.max_page_size
+ get :speech_balloons, :page_size => 1500
+ assigns(:page_size).should eq Author.speech_balloon_max_page_size
end
it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do
- get :panel_color, :page_size => 0
- assigns(:page_size).should eq PanelColor.default_page_size
+ get :speech_balloons, :page_size => 0
+ assigns(:page_size).should eq Author.default_speech_balloon_page_size
end
end
context 'つつがなく終わるとき' do
it 'ステータスコード200 OKを返す' do
- get :panel_color
response.should be_success
end
- it 'ã\82³ã\83\9eã\81®è\89²è\83\8cæ\99¯モデルに一覧を問い合わせている' do
- PanelColor.should_receive(:mylist).exactly(1)
- get :panel_color
+ it 'ã\83\95ã\82ã\83\80ã\82·モデルに一覧を問い合わせている' do
+ SpeechBalloon.should_receive(:mylist).exactly(1)
+ get :speech_balloons
end
- it '@panel_colorsにリストを取得している' do
- get :panel_color
- assigns(:panel_colors).should have_at_least(3).items
+ it '@speech_balloonsにリストを取得している' do
+ get :speech_balloons
+ assigns(:speech_balloons).should have_at_least(3).items
end
context 'html形式' do
- it 'panel_colorテンプレートを描画する' do
- get :panel_color
- response.should render_template("panel_color")
+ it '@paginateにページ制御を取得している' do
+ get :speech_balloons
+ assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+ end
+ it 'speech_balloonsテンプレートを描画する' do
+ get :speech_balloons
+ response.should render_template("speech_balloons")
end
end
context 'json形式' do
it 'jsonデータを返す' do
- get :panel_color, :format => :json
+ get :speech_balloons, :format => :json
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
end
- it 'ã\82³ã\83\9eã\81®è\89²è\83\8cæ\99¯モデルにjson一覧出力オプションを問い合わせている' do
- PanelColor.should_receive(:list_json_opt).exactly(1)
- get :panel_color, :format => :json
+ it 'ã\83\95ã\82ã\83\80ã\82·モデルにjson一覧出力オプションを問い合わせている' do
+ SpeechBalloon.should_receive(:list_json_opt).exactly(1)
+ get :speech_balloons, :format => :json
end
it 'データがリスト構造になっている' do
- get :panel_color, :format => :json
+ get :speech_balloons, :format => :json
json = JSON.parse response.body
json.should have_at_least(3).items
end
- it 'ã\83ªã\82¹ã\83\88ã\81®å\85\88é ã\81\8fã\82\89ã\81\84ã\81¯ã\82³ã\83\9eã\81®è\89²è\83\8cæ\99¯っぽいものであって欲しい' do
- get :panel_color, :format => :json
+ it 'ã\83ªã\82¹ã\83\88ã\81®å\85\88é ã\81\8fã\82\89ã\81\84ã\81¯ã\83\95ã\82ã\83\80ã\82·っぽいものであって欲しい' do
+ get :speech_balloons, :format => :json
json = JSON.parse response.body
- json.first.has_key?("panel_id").should be_true
- json.first.has_key?("code").should be_true
+ json.first.has_key?("speech_balloon_template_id").should be_true
json.first.has_key?("z").should be_true
+ json.first.has_key?("t").should be_true
end
end
end
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :panel_color
+ get :speech_balloons
response.status.should eq 302
end
it 'サインインページへ遷移する' do
- get :panel_color
+ get :speech_balloons
response.should redirect_to '/users/sign_in'
end
end
context 'json形式' do
it 'ステータスコード401 Unauthorizedを返す' do
- get :panel_color, :format => :json
+ get :speech_balloons, :format => :json
response.status.should eq 401
end
it '応答メッセージにUnauthorizedを返す' do
- get :panel_color, :format => :json
+ get :speech_balloons, :format => :json
response.message.should match(/Unauthorized/)
end
end
end
end
- describe 'è\87ªå\88\86ã\81®ã\82³ã\83\9eã\81®ç\94»å\83\8fè\83\8cæ\99¯一覧表示に於いて' do
+ describe 'è\87ªå\88\86ã\81®ã\82³ã\83\9eã\81®çµµå\9c°一覧表示に於いて' do
before do
@gp = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :picture_id => @p.id
sign_in @user
end
context 'パラメータpageについて' do
it '@pageに値が入る' do
- get :ground_picture, :page => 5
+ get :ground_pictures, :page => 5
assigns(:page).should eq 5
end
it '省略されると@pageに1値が入る' do
- get :ground_picture
+ get :ground_pictures
assigns(:page).should eq 1
end
it '与えられたpage_sizeがセットされている' do
- get :ground_picture, :page_size => 15
+ get :ground_pictures, :page_size => 15
assigns(:page_size).should eq 15
end
it '省略されると@page_sizeにデフォルト値が入る' do
- get :ground_picture
- assigns(:page_size).should eq GroundPicture.default_page_size
+ get :ground_pictures
+ assigns(:page_size).should eq Author.default_ground_picture_page_size
end
it '最大を超えると@page_sizeにデフォルト最大値が入る' do
- get :ground_picture, :page_size => 1500
- assigns(:page_size).should eq GroundPicture.max_page_size
+ get :ground_pictures, :page_size => 1500
+ assigns(:page_size).should eq Author.ground_picture_max_page_size
end
it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do
- get :ground_picture, :page_size => 0
- assigns(:page_size).should eq GroundPicture.default_page_size
+ get :ground_pictures, :page_size => 0
+ assigns(:page_size).should eq Author.default_ground_picture_page_size
end
end
context 'つつがなく終わるとき' do
it 'ステータスコード200 OKを返す' do
- get :ground_picture
+ get :ground_pictures
response.should be_success
end
- it 'コマの画像背景モデルに一覧を問い合わせている' do
+ it '絵地モデルに一覧を問い合わせている' do
GroundPicture.should_receive(:mylist).exactly(1)
- get :ground_picture
+ get :ground_pictures
end
it '@ground_picturesにリストを取得している' do
- get :ground_picture
+ get :ground_pictures
assigns(:ground_pictures).should have_at_least(3).items
end
context 'html形式' do
- it 'ground_pictureテンプレートを描画する' do
- get :ground_picture
- response.should render_template("ground_picture")
+ it '@paginateにページ制御を取得している' do
+ get :ground_pictures
+ assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+ end
+ it 'ground_picturesテンプレートを描画する' do
+ get :ground_pictures
+ response.should render_template("ground_pictures")
end
end
context 'json形式' do
it 'jsonデータを返す' do
- get :ground_picture, :format => :json
+ get :ground_pictures, :format => :json
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
end
- it 'コマの画像背景モデルにjson一覧出力オプションを問い合わせている' do
+ it '絵地モデルにjson一覧出力オプションを問い合わせている' do
GroundPicture.should_receive(:list_json_opt).exactly(1)
- get :ground_picture, :format => :json
+ get :ground_pictures, :format => :json
end
it 'データがリスト構造になっている' do
- get :ground_picture, :format => :json
+ get :ground_pictures, :format => :json
json = JSON.parse response.body
json.should have_at_least(3).items
end
- it 'リストの先頭くらいはコマの画像背景っぽいものであって欲しい' do
- get :ground_picture, :format => :json
+ it 'リストの先頭くらいは絵地っぽいものであって欲しい' do
+ get :ground_pictures, :format => :json
json = JSON.parse response.body
json.first.has_key?("panel_id").should be_true
json.first.has_key?("picture_id").should be_true
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :ground_picture
+ get :ground_pictures
response.status.should eq 302
end
it 'サインインページへ遷移する' do
- get :ground_picture
+ get :ground_pictures
response.should redirect_to '/users/sign_in'
end
end
context 'json形式' do
it 'ステータスコード401 Unauthorizedを返す' do
- get :ground_picture, :format => :json
+ get :ground_pictures, :format => :json
response.status.should eq 401
end
it '応答メッセージにUnauthorizedを返す' do
- get :ground_picture, :format => :json
+ get :ground_pictures, :format => :json
response.message.should match(/Unauthorized/)
end
end
end
end
- describe '自分の間接背景一覧表示に於いて' do
+ describe '自分の色地一覧表示に於いて' do
before do
@gc = FactoryGirl.create :ground_color
sign_in @user
end
context 'パラメータpageについて' do
it '@pageに値が入る' do
- get :ground_color, :page => 5
+ get :ground_colors, :page => 5
assigns(:page).should eq 5
end
it '省略されると@pageに1値が入る' do
- get :ground_color
+ get :ground_colors
assigns(:page).should eq 1
end
it '与えられたpage_sizeがセットされている' do
- get :ground_color, :page_size => 15
+ get :ground_colors, :page_size => 15
assigns(:page_size).should eq 15
end
it '省略されると@page_sizeにデフォルト値が入る' do
- get :ground_color
- assigns(:page_size).should eq GroundColor.default_page_size
+ get :ground_colors
+ assigns(:page_size).should eq Author.default_ground_color_page_size
end
it '最大を超えると@page_sizeにデフォルト最大値が入る' do
- get :ground_color, :page_size => 1500
- assigns(:page_size).should eq GroundColor.max_page_size
+ get :ground_colors, :page_size => 1500
+ assigns(:page_size).should eq Author.ground_color_max_page_size
end
it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do
- get :ground_color, :page_size => 0
- assigns(:page_size).should eq GroundColor.default_page_size
+ get :ground_colors, :page_size => 0
+ assigns(:page_size).should eq Author.default_ground_color_page_size
end
end
context 'つつがなく終わるとき' do
it 'ステータスコード200 OKを返す' do
- get :ground_color
+ get :ground_colors
response.should be_success
end
- it '間接背景モデルに一覧を問い合わせている' do
+ it '色地モデルに一覧を問い合わせている' do
GroundColor.should_receive(:mylist).exactly(1)
- get :ground_color
+ get :ground_colors
end
it '@ground_colorsにリストを取得している' do
- get :ground_color
+ get :ground_colors
assigns(:ground_colors).should have_at_least(3).items
end
context 'html形式' do
- it 'ground_colorテンプレートを描画する' do
- get :ground_color
- response.should render_template("ground_color")
+ it '@paginateにページ制御を取得している' do
+ get :ground_colors
+ assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+ end
+ it 'ground_colorsテンプレートを描画する' do
+ get :ground_colors
+ response.should render_template("ground_colors")
end
end
context 'json形式' do
it 'jsonデータを返す' do
- get :ground_color, :format => :json
+ get :ground_colors, :format => :json
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
end
- it '間接背景モデルにjson一覧出力オプションを問い合わせている' do
+ it '色地モデルにjson一覧出力オプションを問い合わせている' do
GroundColor.should_receive(:list_json_opt).exactly(1)
- get :ground_color, :format => :json
+ get :ground_colors, :format => :json
end
it 'データがリスト構造になっている' do
- get :ground_color, :format => :json
+ get :ground_colors, :format => :json
json = JSON.parse response.body
json.should have_at_least(3).items
end
- it 'リストの先頭くらいは間接背景っぽいものであって欲しい' do
- get :ground_color, :format => :json
+ it 'リストの先頭くらいは色地っぽいものであって欲しい' do
+ get :ground_colors, :format => :json
json = JSON.parse response.body
json.first.has_key?("panel_id").should be_true
- json.first.has_key?("color_id").should be_true
+ json.first.has_key?("code").should be_true
json.first.has_key?("z").should be_true
end
end
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :ground_color
+ get :ground_colors
response.status.should eq 302
end
it 'サインインページへ遷移する' do
- get :ground_color
+ get :ground_colors
response.should redirect_to '/users/sign_in'
end
end
context 'json形式' do
it 'ステータスコード401 Unauthorizedを返す' do
- get :ground_color, :format => :json
+ get :ground_colors, :format => :json
response.status.should eq 401
end
it '応答メッセージにUnauthorizedを返す' do
- get :ground_color, :format => :json
+ get :ground_colors, :format => :json
response.message.should match(/Unauthorized/)
end
end
end
context 'パラメータpageについて' do
it '@pageに値が入る' do
- get :resource_picture, :page => 5
+ get :resource_pictures, :page => 5
assigns(:page).should eq 5
end
it '省略されると@pageに1値が入る' do
- get :resource_picture
+ get :resource_pictures
assigns(:page).should eq 1
end
it '与えられたpage_sizeがセットされている' do
- get :resource_picture, :page_size => 15
+ get :resource_pictures, :page_size => 15
assigns(:page_size).should eq 15
end
it '省略されると@page_sizeにデフォルト値が入る' do
- get :resource_picture
- assigns(:page_size).should eq Author.default_comic_page_size
+ get :resource_pictures
+ assigns(:page_size).should eq Author.default_resource_picture_page_size
end
it '最大を超えると@page_sizeにデフォルト最大値が入る' do
- get :resource_picture, :page_size => 1500
- assigns(:page_size).should eq Author.comic_max_page_size
+ get :resource_pictures, :page_size => 1500
+ assigns(:page_size).should eq Author.resource_picture_max_page_size
end
it '不正な値が入ると@page_sizeにデフォルト最大値が入る' do
- get :resource_picture, :page_size => 0
- assigns(:page_size).should eq Author.default_comic_page_size
+ get :resource_pictures, :page_size => 0
+ assigns(:page_size).should eq Author.default_resource_picture_page_size
end
end
context 'つつがなく終わるとき' do
it 'ステータスコード200 OKを返す' do
- get :resource_picture
+ get :resource_pictures
response.should be_success
end
it '素材モデルに一覧を問い合わせている' do
ResourcePicture.should_receive(:mylist).exactly(1)
- get :resource_picture
+ get :resource_pictures
end
it '@resource_picturesにリストを取得している' do
- get :resource_picture
+ get :resource_pictures
assigns(:resource_pictures).should have_at_least(3).items
end
context 'html形式' do
- it 'resource_pictureテンプレートを描画する' do
- get :resource_picture
- response.should render_template("resource_picture")
+ it '@paginateにページ制御を取得している' do
+ get :resource_pictures
+ assigns(:paginate).is_a?(Kaminari::PaginatableArray).should be_true
+ end
+ it 'resource_picturesテンプレートを描画する' do
+ get :resource_pictures
+ response.should render_template("resource_pictures")
end
end
context 'json形式' do
it 'jsonデータを返す' do
- get :resource_picture, :format => :json
+ get :resource_pictures, :format => :json
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
end
it '素材モデルにjson一覧出力オプションを問い合わせている' do
ResourcePicture.should_receive(:list_json_opt).exactly(1)
- get :resource_picture, :format => :json
+ get :resource_pictures, :format => :json
end
it 'データがリスト構造になっている' do
- get :resource_picture, :format => :json
+ get :resource_pictures, :format => :json
json = JSON.parse response.body
json.should have_at_least(3).items
end
it 'リストの先頭くらいは素材っぽいものであって欲しい' do
- get :resource_picture, :format => :json
+ get :resource_pictures, :format => :json
json = JSON.parse response.body
json.first.has_key?("original_picture_id").should be_true
json.first.has_key?("license_id").should be_true
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :resource_picture
+ get :resource_pictures
response.status.should eq 302
end
it 'サインインページへ遷移する' do
- get :resource_picture
+ get :resource_pictures
response.should redirect_to '/users/sign_in'
end
end
context 'json形式' do
it 'ステータスコード401 Unauthorizedを返す' do
- get :resource_picture, :format => :json
+ get :resource_pictures, :format => :json
response.status.should eq 401
end
it '応答メッセージにUnauthorizedを返す' do
- get :resource_picture, :format => :json
+ get :resource_pictures, :format => :json
response.message.should match(/Unauthorized/)
end
end
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :resource_picture
+ get :resource_pictures
response.status.should eq 302
end
it '絵師登録ページへ遷移する' do
- get :resource_picture
+ get :resource_pictures
response.should redirect_to new_artist_path
end
end
context 'json形式' do
it '例外403 forbiddenを返す' do
lambda{
- get :resource_picture, :format => :json
+ get :resource_pictures, :format => :json
}.should raise_error(ActiveRecord::Forbidden)
end
end
end
context 'つつがなく終わるとき' do
it 'ステータスコード200 OKを返す' do
- get :comic
+ get :comics
response.should be_success
end
context 'html形式' do
- it 'comicテンプレートを描画する' do
- get :comic
- response.should render_template("comic")
+ it 'comicsテンプレートを描画する' do
+ get :comics
+ response.should render_template("comics")
end
end
context 'json形式' do
it 'jsonデータを返す' do
- get :comic, :format => :json
+ get :comics, :format => :json
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
end
end
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :comic
+ get :comics
response.status.should eq 302
end
it 'サインインページへ遷移する' do
- get :comic
+ get :comics
response.should redirect_to '/users/sign_in'
end
end
context 'json形式' do
it 'ステータスコード401 Unauthorizedを返す' do
- get :comic, :format => :json
+ get :comics, :format => :json
response.status.should eq 401
end
it '応答メッセージにUnauthorizedを返す' do
- get :comic, :format => :json
+ get :comics, :format => :json
response.message.should match(/Unauthorized/)
end
end
context 'つつがなく終わるとき' do
context 'html形式' do
it 'ステータスコード200 OKを返す' do
- get :panel
+ get :panels
response.should be_success
end
- it 'panelテンプレートを描画する' do
- get :panel
- response.should render_template("panel")
+ it 'panelsテンプレートを描画する' do
+ get :panels
+ response.should render_template("panels")
end
end
context 'json形式' do
it 'ステータスコード200 OKを返す' do
- get :panel, :format => :json
+ get :panels, :format => :json
response.should be_success
end
it 'jsonデータを返す' do
- get :panel, :format => :json
+ get :panels, :format => :json
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
end
end
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :panel
+ get :panels
response.status.should eq 302
end
it 'サインインページへ遷移する' do
- get :panel
+ get :panels
response.should redirect_to '/users/sign_in'
end
end
context 'json形式' do
it 'ステータスコード401 Unauthorizedを返す' do
- get :panel, :format => :json
+ get :panels, :format => :json
response.status.should eq 401
end
it '応答メッセージにUnauthorizedを返す' do
- get :panel, :format => :json
+ get :panels, :format => :json
response.message.should match(/Unauthorized/)
end
end
end
context 'つつがなく終わるとき' do
it 'ステータスコード200 OKを返す' do
- get :panel_picture
+ get :panel_pictures
response.should be_success
end
context 'html形式' do
- it 'panel_pictureテンプレートを描画する' do
- get :panel_picture
- response.should render_template("panel_picture")
+ it 'panel_picturesテンプレートを描画する' do
+ get :panel_pictures
+ response.should render_template("panel_pictures")
end
end
context 'json形式' do
it 'jsonデータを返す' do
- get :panel_picture, :format => :json
+ get :panel_pictures, :format => :json
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
end
end
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :panel_picture
+ get :panel_pictures
response.status.should eq 302
end
it 'サインインページへ遷移する' do
- get :panel_picture
+ get :panel_pictures
response.should redirect_to '/users/sign_in'
end
end
context 'json形式' do
it 'ステータスコード401 Unauthorizedを返す' do
- get :panel_picture, :format => :json
+ get :panel_pictures, :format => :json
response.status.should eq 401
end
it '応答メッセージにUnauthorizedを返す' do
- get :panel_picture, :format => :json
+ get :panel_pictures, :format => :json
response.message.should match(/Unauthorized/)
end
end
end
end
- describe '自分のコマの色背景一覧表示に於いて' do
- before do
- @pc = FactoryGirl.create :panel_color, :panel_id => @panel.id
- sign_in @user
- PanelColor.stub(:mylist).and_return([@pc, @pc, @pc])
- end
- context 'つつがなく終わるとき' do
- it 'ステータスコード200 OKを返す' do
- get :panel_color
- response.should be_success
- end
- context 'html形式' do
- it 'panel_colorテンプレートを描画する' do
- get :panel_color
- response.should render_template("panel_color")
- end
- end
- context 'json形式' do
- it 'jsonデータを返す' do
- get :panel_color, :format => :json
- lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
- end
- end
- end
- context '作家権限がないとき' do
- before do
- sign_out @user
- end
- context 'html形式' do
- it 'ステータスコード302 Foundを返す' do
- get :panel_color
- response.status.should eq 302
- end
- it 'サインインページへ遷移する' do
- get :panel_color
- response.should redirect_to '/users/sign_in'
- end
- end
- context 'json形式' do
- it 'ステータスコード401 Unauthorizedを返す' do
- get :panel_color, :format => :json
- response.status.should eq 401
- end
- it '応答メッセージにUnauthorizedを返す' do
- get :panel_color, :format => :json
- response.message.should match(/Unauthorized/)
- end
- end
- end
- end
- describe 'è\87ªå\88\86ã\81®ã\82³ã\83\9eã\81®ç\94»å\83\8fè\83\8cæ\99¯一覧表示に於いて' do
+ describe 'è\87ªå\88\86ã\81®ã\82³ã\83\9eã\81®çµµå\9c°一覧表示に於いて' do
before do
@gp = FactoryGirl.create :ground_picture, :panel_id => @panel.id, :picture_id => @p.id
sign_in @user
end
context 'つつがなく終わるとき' do
it 'ステータスコード200 OKを返す' do
- get :ground_picture
+ get :ground_pictures
response.should be_success
end
context 'html形式' do
- it 'ground_pictureテンプレートを描画する' do
- get :ground_picture
- response.should render_template("ground_picture")
+ it 'ground_picturesテンプレートを描画する' do
+ get :ground_pictures
+ response.should render_template("ground_pictures")
end
end
context 'json形式' do
it 'jsonデータを返す' do
- get :ground_picture, :format => :json
+ get :ground_pictures, :format => :json
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
end
end
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :ground_picture
+ get :ground_pictures
response.status.should eq 302
end
it 'サインインページへ遷移する' do
- get :ground_picture
+ get :ground_pictures
response.should redirect_to '/users/sign_in'
end
end
context 'json形式' do
it 'ステータスコード401 Unauthorizedを返す' do
- get :ground_picture, :format => :json
+ get :ground_pictures, :format => :json
response.status.should eq 401
end
it '応答メッセージにUnauthorizedを返す' do
- get :ground_picture, :format => :json
+ get :ground_pictures, :format => :json
response.message.should match(/Unauthorized/)
end
end
end
end
- describe '自分の間接背景一覧表示に於いて' do
+ describe '自分の色地一覧表示に於いて' do
before do
@gc = FactoryGirl.create :ground_color
sign_in @user
end
context 'つつがなく終わるとき' do
it 'ステータスコード200 OKを返す' do
- get :ground_color
+ get :ground_colors
response.should be_success
end
context 'html形式' do
- it 'ground_colorテンプレートを描画する' do
- get :ground_color
- response.should render_template("ground_color")
+ it 'ground_colorsテンプレートを描画する' do
+ get :ground_colors
+ response.should render_template("ground_colors")
end
end
context 'json形式' do
it 'jsonデータを返す' do
- get :ground_color, :format => :json
+ get :ground_colors, :format => :json
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
end
end
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :ground_color
+ get :ground_colors
response.status.should eq 302
end
it 'サインインページへ遷移する' do
- get :ground_color
+ get :ground_colors
response.should redirect_to '/users/sign_in'
end
end
context 'json形式' do
it 'ステータスコード401 Unauthorizedを返す' do
- get :ground_color, :format => :json
+ get :ground_colors, :format => :json
response.status.should eq 401
end
it '応答メッセージにUnauthorizedを返す' do
- get :ground_color, :format => :json
+ get :ground_colors, :format => :json
response.message.should match(/Unauthorized/)
end
end
end
context 'つつがなく終わるとき' do
it 'ステータスコード200 OKを返す' do
- get :resource_picture
+ get :resource_pictures
response.should be_success
end
context 'html形式' do
- it 'resource_pictureテンプレートを描画する' do
- get :resource_picture
- response.should render_template("resource_picture")
+ it 'resource_picturesテンプレートを描画する' do
+ get :resource_pictures
+ response.should render_template("resource_pictures")
end
end
context 'json形式' do
it 'jsonデータを返す' do
- get :resource_picture, :format => :json
+ get :resource_pictures, :format => :json
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
end
end
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :resource_picture
+ get :resource_pictures
response.status.should eq 302
end
it 'サインインページへ遷移する' do
- get :resource_picture
+ get :resource_pictures
response.should redirect_to '/users/sign_in'
end
end
context 'json形式' do
it 'ステータスコード401 Unauthorizedを返す' do
- get :resource_picture, :format => :json
+ get :resource_pictures, :format => :json
response.status.should eq 401
end
it '応答メッセージにUnauthorizedを返す' do
- get :resource_picture, :format => :json
+ get :resource_pictures, :format => :json
response.message.should match(/Unauthorized/)
end
end
end
context 'html形式' do
it 'ステータスコード302 Foundを返す' do
- get :resource_picture
+ get :resource_pictures
response.status.should eq 302
end
it '絵師登録ページへ遷移する' do
- get :resource_picture
+ get :resource_pictures
response.should redirect_to new_artist_path
end
end
context 'json形式' do
it '例外403 forbiddenを返す' do
lambda{
- get :resource_picture, :format => :json
+ get :resource_pictures, :format => :json
}.should raise_error(ActiveRecord::Forbidden)
end
end