From: yasushiito <%= t '.title' -%>
+
+
+
diff --git a/app/views/artists/show.html.erb b/app/views/artists/show.html.erb
index 6c58138c..96cc8f2c 100644
--- a/app/views/artists/show.html.erb
+++ b/app/views/artists/show.html.erb
@@ -17,6 +17,10 @@
<%= l @ar.updated_at %>
+
+<% @resource_pictures.each do |resource_picture| %>
+
+
+ <%= t_m 'ResourcePicture.artist_id' -%>
+ <%= t_m 'ResourcePicture.ext' -%>
+ <%= t_m 'ResourcePicture.width' -%>
+ <%= t_m 'ResourcePicture.height' -%>
+ <%= t_m 'ResourcePicture.filesize' -%>
+
+
+<% end %>
+
+ <%= link_to tag(:img, resource_picture.tmb_opt_img_tag), resource_picture_path(resource_picture) %>
+
+
+ <%= render resource_picture.credit_template, :picture => resource_picture %>
+
+
+ <%= link_to(h(truncate(resource_picture.artist.name, :length => 8)), artist_path(resource_picture.artist)) %>
+
+
+ <%= h resource_picture.ext %>
+
+
+ <%= resource_picture.width %>px
+
+
+ <%= resource_picture.height %>px
+
+
+ <%= resource_picture.filesize %>bytes
+
+
+ <%= link_to t('artists.show.to_resource_pictures'), resource_pictures_artist_path(@ar) %> +
+ <% if @ar.own?(@artist) %> <%= link_to t('link.edit'), edit_artist_path(@ar) %> <% end %> diff --git a/app/views/authors/_list_item.html.erb b/app/views/authors/_list_item.html.erb new file mode 100644 index 00000000..1bf947a0 --- /dev/null +++ b/app/views/authors/_list_item.html.erb @@ -0,0 +1,20 @@ ++ <%= link_to comic_icon(:object => comic, :size => 25), comic_path(comic) %> + <%= link_to h(truncate(comic.title, :length => 40)), :controller => 'stories', :action => :comic, :id => comic.id %> + (<%= comic.stories.size -%>) + | ++ <%= distance_of_time_in_words_to_now comic.updated_at %> + | ++ <%= link_to author_icon(:object => comic.author, :size => 25), comic_path(comic.author) %> + <%= link_to h(truncate(comic.author.name, :length => 12)), author_path(comic.author) %> + | ++ <% if comic.own? @author %> + <%= link_to t('link.edit'), edit_comic_path(comic) %> + <%= link_to t('link.destroy'), comic_path(comic), :method => :delete %> + <% end %> + | +
+ <%= link_to t('authors.show.to_comics'), comics_author_path(@au) %> +
+ ++ <%= link_to t('authors.show.to_panels'), panels_author_path(@au) %> +
+ <% if @au.own?(@author) %> <%= link_to t('link.edit'), edit_author_path(@au) %> <% end %> diff --git a/config/locales/pettanr.ja.yml b/config/locales/pettanr.ja.yml index 39a025a8..ee9fc453 100644 --- a/config/locales/pettanr.ja.yml +++ b/config/locales/pettanr.ja.yml @@ -668,6 +668,12 @@ ja: title: ä½å®¶ä¸è¦§ show: title: ä½å®¶è©³ç´° + to_comics: æè¿æ´æ°ããã³ãã㯠+ to_panels: æè¿æ´æ°ããã³ã + comics: + title: æè¿æ´æ°ããã³ãã㯠+ panels: + title: æè¿æ´æ°ããã³ã new: title: ä½å®¶ç»é² announce: ä½å®¶ç»é²ãã¦ãã ãã @@ -688,6 +694,9 @@ ja: title: 絵師ä¸è¦§ show: title: 絵師詳細 + to_resource_pictures: æè¿æ´æ°ããç´ æ + resource_pictures: + title: æè¿æ´æ°ããç´ æ new: title: 絵師ç»é² edit: diff --git a/config/routes.rb b/config/routes.rb index 003ea567..3c48f086 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -23,6 +23,8 @@ Pettanr::Application.routes.draw do put :update delete :destroy get :browse + get :comics + get :panels end end resources :artists do @@ -40,6 +42,7 @@ Pettanr::Application.routes.draw do put :update delete :destroy get :browse + get :resource_pictures end end resources :speech_balloon_templates do diff --git a/spec/controllers/artists_controller_spec.rb b/spec/controllers/artists_controller_spec.rb index d1f7a3a2..f36d7542 100644 --- a/spec/controllers/artists_controller_spec.rb +++ b/spec/controllers/artists_controller_spec.rb @@ -256,6 +256,134 @@ if MagicNumber['run_mode'] == 1 =end end + describe '対象絵師ã®ç´ æä¸è¦§è¡¨ç¤ºã«æ¼ãã¦' do + before do + @other_user = FactoryGirl.create( :user_yas) + @other_author = FactoryGirl.create :author, :user_id => @other_user.id + @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id + @op = FactoryGirl.create :original_picture, :artist_id => @other_artist.id + @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @other_artist.id + @rp = FactoryGirl.create :resource_picture, :artist_id => @other_artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id + ResourcePicture.stub(:mylist).and_return([@rp, @rp, @rp]) + sign_in @user + end + context 'ãã©ã¡ã¼ã¿pageã«ã¤ãã¦' do + it '@pageã«å¤ãå ¥ã' do + get :resource_pictures, :id => @other_artist.id, :page => 5 + assigns(:page).should eq 5 + end + it 'çç¥ãããã¨@pageã«1å¤ãå ¥ã' do + get :resource_pictures, :id => @other_artist.id + assigns(:page).should eq 1 + end + it 'ä¸ããããpage_sizeãã»ããããã¦ãã' do + get :resource_pictures, :id => @other_artist.id, :page_size => 15 + assigns(:page_size).should eq 15 + end + it 'çç¥ãããã¨@page_sizeã«ããã©ã«ãå¤ãå ¥ã' do + get :resource_pictures, :id => @other_artist.id + assigns(:page_size).should eq Author.default_resource_picture_page_size + end + it 'æ大ãè¶ ããã¨@page_sizeã«ããã©ã«ãæ大å¤ãå ¥ã' do + get :resource_pictures, :id => @other_artist.id, :page_size => 1500 + assigns(:page_size).should eq Author.resource_picture_max_page_size + end + it 'ä¸æ£ãªå¤ãå ¥ãã¨@page_sizeã«ããã©ã«ãæ大å¤ãå ¥ã' do + get :resource_pictures, :id => @other_artist.id, :page_size => 0 + assigns(:page_size).should eq Author.default_resource_picture_page_size + end + end + context 'ã¤ã¤ããªãçµããã¨ã' do + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :resource_pictures, :id => @other_artist.id + response.should be_success + end + it '絵師ã¢ãã«ã«åä½åå¾ãåãåããã¦ãã' do + Artist.should_receive(:show).exactly(1) + get :resource_pictures, :id => @other_artist.id + end + it 'ç´ æã¢ãã«ã«ä¸è¦§ãåãåããã¦ãã' do + ResourcePicture.should_receive(:mylist).exactly(1) + get :resource_pictures, :id => @other_artist.id + end + it '@resource_picturesã«ãªã¹ããåå¾ãã¦ãã' do + get :resource_pictures, :id => @other_artist.id + assigns(:resource_pictures).should have_at_least(3).items + end + context 'htmlå½¢å¼' do + it 'resource_pictureãã³ãã¬ã¼ããæç»ãã' do + get :resource_pictures, :id => @other_artist.id + response.should render_template("resource_pictures") + end + end + context 'jsonå½¢å¼' do + it 'jsonãã¼ã¿ãè¿ã' do + get :resource_pictures, :id => @other_artist.id, :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_pictures, :id => @other_artist.id, :format => :json + end + it 'ãã¼ã¿ããªã¹ãæ§é ã«ãªã£ã¦ãã' do + get :resource_pictures, :id => @other_artist.id, :format => :json + json = JSON.parse response.body + json.should have_at_least(3).items + end + it 'ãªã¹ãã®å é ãããã¯ç´ æã£ã½ããã®ã§ãã£ã¦æ¬²ãã' do + get :resource_pictures, :id => @other_artist.id, :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 + end + end + context 'ã¦ã¼ã¶æ¨©éããªãã¨ã' do + before do + sign_out @user + end + context 'htmlå½¢å¼' do + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã302 Foundãè¿ã' do + get :resource_pictures, :id => @other_artist.id + response.status.should eq 302 + end + it 'ãµã¤ã³ã¤ã³ãã¼ã¸ã¸é·ç§»ãã' do + get :resource_pictures, :id => @other_artist.id + response.should redirect_to '/users/sign_in' + end + end + context 'jsonå½¢å¼' do + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã401 Unauthorizedãè¿ã' do + get :resource_pictures, :id => @other_artist.id, :format => :json + response.status.should eq 401 + end + it 'å¿çã¡ãã»ã¼ã¸ã«Unauthorizedãè¿ã' do + get :resource_pictures, :id => @other_artist.id, :format => :json + response.message.should match(/Unauthorized/) + end + end + end + context 'ã¦ã¼ã¶æ¨©éã¯ãªãã管çè 権éãããã¨ã' do + before do + sign_out @user + sign_in @admin + end + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :resource_pictures, :id => @other_artist.id + response.should be_success + end + end + context 'ã¦ã¼ã¶ã ãä½å®¶ç»é²ãã¦ããªãã¨ã' do + before do + @artist.destroy + end + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :resource_pictures, :id => @other_artist.id + response.should be_success + end + end + end + describe '絵師æ°åå¾ã«æ¼ãã¦' do before do Artist.should_receive(:visible_count).and_return(3) @@ -857,6 +985,58 @@ else end end + describe '対象絵師ã®ç´ æä¸è¦§è¡¨ç¤ºã«æ¼ãã¦' do + before do + @other_user = FactoryGirl.create( :user_yas) + @other_author = FactoryGirl.create :author, :user_id => @other_user.id + @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id + @op = FactoryGirl.create :original_picture, :artist_id => @other_artist.id + @p = FactoryGirl.create :picture, :original_picture_id => @op.id, :license_id => @license.id, :artist_id => @other_artist.id + @rp = FactoryGirl.create :resource_picture, :artist_id => @other_artist.id, :license_id => @license.id, :original_picture_id => @op.id, :picture_id => @p.id + ResourcePicture.stub(:mylist).and_return([@rp, @rp, @rp]) + sign_in @user + end + context 'ã¤ã¤ããªãçµããã¨ã' do + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :resource_pictures, :id => @other_artist.id + response.should be_success + end + context 'htmlå½¢å¼' do + it 'resource_pictureãã³ãã¬ã¼ããæç»ãã' do + get :resource_pictures, :id => @other_artist.id + response.should render_template("resource_pictures") + end + end + context 'jsonå½¢å¼' do + it 'jsonãã¼ã¿ãè¿ã' do + get :resource_pictures, :id => @other_artist.id, :format => :json + lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError) + end + end + end + context 'ã¦ã¼ã¶æ¨©éããªãã¨ã' do + before do + sign_out @user + end + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :resource_pictures, :id => @other_artist.id + response.should be_success + end + context 'htmlå½¢å¼' do + it 'resource_pictureãã³ãã¬ã¼ããæç»ãã' do + get :resource_pictures, :id => @other_artist.id + response.should render_template("resource_pictures") + end + end + context 'jsonå½¢å¼' do + it 'jsonãã¼ã¿ãè¿ã' do + get :resource_pictures, :id => @other_artist.id, :format => :json + lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError) + end + end + end + end + describe '絵師æ°åå¾ã«æ¼ãã¦' do before do Artist.should_receive(:visible_count).and_return(3) diff --git a/spec/controllers/authors_controller_spec.rb b/spec/controllers/authors_controller_spec.rb index b0e68170..2ef27019 100644 --- a/spec/controllers/authors_controller_spec.rb +++ b/spec/controllers/authors_controller_spec.rb @@ -238,6 +238,257 @@ if MagicNumber['run_mode'] == 1 =end end + describe '対象ä½å®¶ã®ã³ããã¯ä¸è¦§è¡¨ç¤ºã«æ¼ãã¦' do + before do + @other_user = FactoryGirl.create( :user_yas) + @other_author = FactoryGirl.create :author, :user_id => @other_user.id + @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id + @comic = FactoryGirl.create :comic, :author_id => @other_user.author.id + Comic.stub(:mylist).and_return([@comic, @comic, @comic]) + sign_in @user + end + context 'ãã©ã¡ã¼ã¿pageã«ã¤ãã¦' do + it '@pageã«å¤ãå ¥ã' do + get :comics, :id => @other_author.id, :page => 5 + assigns(:page).should eq 5 + end + it 'çç¥ãããã¨@pageã«1å¤ãå ¥ã' do + get :comics, :id => @other_author.id + assigns(:page).should eq 1 + end + it 'ä¸ããããpage_sizeãã»ããããã¦ãã' do + get :comics, :id => @other_author.id, :page_size => 15 + assigns(:page_size).should eq 15 + end + it 'çç¥ãããã¨@page_sizeã«ããã©ã«ãå¤ãå ¥ã' do + get :comics, :id => @other_author.id + assigns(:page_size).should eq Author.default_comic_page_size + end + it 'æ大ãè¶ ããã¨@page_sizeã«ããã©ã«ãæ大å¤ãå ¥ã' do + get :comics, :id => @other_author.id, :page_size => 1500 + assigns(:page_size).should eq Author.comic_max_page_size + end + it 'ä¸æ£ãªå¤ãå ¥ãã¨@page_sizeã«ããã©ã«ãæ大å¤ãå ¥ã' do + get :comics, :id => @other_author.id, :page_size => 0 + assigns(:page_size).should eq Author.default_comic_page_size + end + end + context 'ã¤ã¤ããªãçµããã¨ã' do + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :comics, :id => @other_author.id + response.should be_success + end + it 'ä½å®¶ã¢ãã«ã«åä½åå¾ãåãåããã¦ãã' do + Author.should_receive(:show).exactly(1) + get :comics, :id => @other_author.id + end + it 'ã³ããã¯ã¢ãã«ã«ä¸è¦§ãåãåããã¦ãã' do + Comic.should_receive(:mylist).exactly(1) + get :comics, :id => @other_author.id + end + it '@comicsã«ãªã¹ããåå¾ãã¦ãã' do + get :comics, :id => @other_author.id + assigns(:comics).should have_at_least(3).items + end + context 'htmlå½¢å¼' do + it 'comicãã³ãã¬ã¼ããæç»ãã' do + get :comics, :id => @other_author.id + response.should render_template("comic") + end + end + context 'jsonå½¢å¼' do + it 'jsonãã¼ã¿ãè¿ã' do + get :comics, :id => @other_author.id, :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 :comics, :id => @other_author.id, :format => :json + end + it 'ãã¼ã¿ããªã¹ãæ§é ã«ãªã£ã¦ãã' do + get :comics, :id => @other_author.id, :format => :json + json = JSON.parse response.body + json.should have_at_least(3).items + end + it 'ãªã¹ãã®å é ãããã¯ã³ããã¯ã£ã½ããã®ã§ãã£ã¦æ¬²ãã' do + get :comics, :id => @other_author.id, :format => :json + json = JSON.parse response.body + json.first.has_key?("title").should be_true + json.first.has_key?("visible").should be_true + end + end + end + context 'ã¦ã¼ã¶æ¨©éããªãã¨ã' do + before do + sign_out @user + end + context 'htmlå½¢å¼' do + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã302 Foundãè¿ã' do + get :comics, :id => @other_author.id + response.status.should eq 302 + end + it 'ãµã¤ã³ã¤ã³ãã¼ã¸ã¸é·ç§»ãã' do + get :comics, :id => @other_author.id + response.should redirect_to '/users/sign_in' + end + end + context 'jsonå½¢å¼' do + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã401 Unauthorizedãè¿ã' do + get :comics, :id => @other_author.id, :format => :json + response.status.should eq 401 + end + it 'å¿çã¡ãã»ã¼ã¸ã«Unauthorizedãè¿ã' do + get :comics, :id => @other_author.id, :format => :json + response.message.should match(/Unauthorized/) + end + end + end + context 'ã¦ã¼ã¶æ¨©éã¯ãªãã管çè 権éãããã¨ã' do + before do + sign_out @user + sign_in @admin + end + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :comics, :id => @other_author.id + response.should be_success + end + end + context 'ã¦ã¼ã¶ã ãä½å®¶ç»é²ãã¦ããªãã¨ã' do + before do + @author.destroy + end + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :comics, :id => @other_author.id + response.should be_success + end + end + end + + describe '対象ä½å®¶ã®ã³ãä¸è¦§è¡¨ç¤ºã«æ¼ãã¦' do + before do + @other_user = FactoryGirl.create( :user_yas) + @other_author = FactoryGirl.create :author, :user_id => @other_user.id + @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id + @panel = FactoryGirl.create :panel, :author_id => @other_author.id + Panel.stub(:mylist).and_return([@panel, @panel, @panel]) + sign_in @user + end + context 'ãã©ã¡ã¼ã¿pageã«ã¤ãã¦' do + it '@pageã«å¤ãå ¥ã' do + get :panels, :id => @other_author.id, :page => 5 + assigns(:page).should eq 5 + end + it 'çç¥ãããã¨@pageã«1å¤ãå ¥ã' do + get :panels, :id => @other_author.id + assigns(:page).should eq 1 + end + it 'ä¸ããããpage_sizeãã»ããããã¦ãã' do + get :panels, :id => @other_author.id, :page_size => 15 + assigns(:page_size).should eq 15 + end + it 'çç¥ãããã¨@page_sizeã«ããã©ã«ãå¤ãå ¥ã' do + get :panels, :id => @other_author.id + assigns(:page_size).should eq Author.default_panel_page_size + end + it 'æ大ãè¶ ããã¨@page_sizeã«ããã©ã«ãæ大å¤ãå ¥ã' do + get :panels, :id => @other_author.id, :page_size => 1500 + assigns(:page_size).should eq Author.panel_max_page_size + end + it 'ä¸æ£ãªå¤ãå ¥ãã¨@page_sizeã«ããã©ã«ãæ大å¤ãå ¥ã' do + get :panels, :id => @other_author.id, :page_size => 0 + assigns(:page_size).should eq Author.default_panel_page_size + end + end + context 'ã¤ã¤ããªãçµããã¨ã' do + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :panels, :id => @other_author.id + response.should be_success + end + it 'ä½å®¶ã¢ãã«ã«åä½åå¾ãåãåããã¦ãã' do + Author.should_receive(:show).exactly(1) + get :panels, :id => @other_author.id + end + it 'ã³ãã¢ãã«ã«ä¸è¦§ãåãåããã¦ãã' do + Panel.should_receive(:mylist).exactly(1) + get :panels, :id => @other_author.id + end + it '@panelsã«ãªã¹ããåå¾ãã¦ãã' do + get :panels, :id => @other_author.id + assigns(:panels).should have_at_least(3).items + end + context 'htmlå½¢å¼' do + it 'comicãã³ãã¬ã¼ããæç»ãã' do + get :panels, :id => @other_author.id + response.should render_template("panels") + end + end + context 'jsonå½¢å¼' do + it 'jsonãã¼ã¿ãè¿ã' do + get :panels, :id => @other_author.id, :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 :panels, :id => @other_author.id, :format => :json + end + it 'ãã¼ã¿ããªã¹ãæ§é ã«ãªã£ã¦ãã' do + get :panels, :id => @other_author.id, :format => :json + json = JSON.parse response.body + json.should have_at_least(3).items + end + it 'ãªã¹ãã®å é ãããã¯ã³ãã£ã½ããã®ã§ãã£ã¦æ¬²ãã' do + get :panels, :id => @other_author.id, :format => :json + json = JSON.parse response.body + json.first.has_key?("z").should be_true + end + end + end + context 'ã¦ã¼ã¶æ¨©éããªãã¨ã' do + before do + sign_out @user + end + context 'htmlå½¢å¼' do + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã302 Foundãè¿ã' do + get :panels, :id => @other_author.id + response.status.should eq 302 + end + it 'ãµã¤ã³ã¤ã³ãã¼ã¸ã¸é·ç§»ãã' do + get :panels, :id => @other_author.id + response.should redirect_to '/users/sign_in' + end + end + context 'jsonå½¢å¼' do + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã401 Unauthorizedãè¿ã' do + get :panels, :id => @other_author.id, :format => :json + response.status.should eq 401 + end + it 'å¿çã¡ãã»ã¼ã¸ã«Unauthorizedãè¿ã' do + get :panels, :id => @other_author.id, :format => :json + response.message.should match(/Unauthorized/) + end + end + end + context 'ã¦ã¼ã¶æ¨©éã¯ãªãã管çè 権éãããã¨ã' do + before do + sign_out @user + sign_in @admin + end + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :panels, :id => @other_author.id + response.should be_success + end + end + context 'ã¦ã¼ã¶ã ãä½å®¶ç»é²ãã¦ããªãã¨ã' do + before do + @author.destroy + end + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :panels, :id => @other_author.id + response.should be_success + end + end + end + describe 'ä½å®¶æ°åå¾ã«æ¼ãã¦' do before do Author.should_receive(:visible_count).and_return(3) @@ -828,6 +1079,106 @@ else end end + describe '対象ä½å®¶ã®ã³ããã¯ä¸è¦§è¡¨ç¤ºã«æ¼ãã¦' do + before do + @other_user = FactoryGirl.create( :user_yas) + @other_author = FactoryGirl.create :author, :user_id => @other_user.id + @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id + @comic = FactoryGirl.create :comic, :author_id => @other_user.author.id + Comic.stub(:mylist).and_return([@comic, @comic, @comic]) + sign_in @user + end + context 'ã¤ã¤ããªãçµããã¨ã' do + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :comics, :id => @other_author.id + response.should be_success + end + context 'htmlå½¢å¼' do + it 'comicãã³ãã¬ã¼ããæç»ãã' do + get :comics, :id => @other_author.id + response.should render_template("comic") + end + end + context 'jsonå½¢å¼' do + it 'jsonãã¼ã¿ãè¿ã' do + get :comics, :id => @other_author.id, :format => :json + lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError) + end + end + end + context 'ã¦ã¼ã¶æ¨©éããªãã¨ã' do + before do + sign_out @user + end + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :comics, :id => @other_author.id + response.should be_success + end + context 'htmlå½¢å¼' do + it 'comicãã³ãã¬ã¼ããæç»ãã' do + get :comics, :id => @other_author.id + response.should render_template("comic") + end + end + context 'jsonå½¢å¼' do + it 'jsonãã¼ã¿ãè¿ã' do + get :comics, :id => @other_author.id, :format => :json + lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError) + end + end + end + end + + describe '対象ä½å®¶ã®ã³ãä¸è¦§è¡¨ç¤ºã«æ¼ãã¦' do + before do + @other_user = FactoryGirl.create( :user_yas) + @other_author = FactoryGirl.create :author, :user_id => @other_user.id + @other_artist = FactoryGirl.create :artist_yas, :author_id => @other_author.id + @panel = FactoryGirl.create :panel, :author_id => @other_author.id + Panel.stub(:mylist).and_return([@panel, @panel, @panel]) + sign_in @user + end + context 'ã¤ã¤ããªãçµããã¨ã' do + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :panels, :id => @other_author.id + response.should be_success + end + context 'htmlå½¢å¼' do + it 'comicãã³ãã¬ã¼ããæç»ãã' do + get :panels, :id => @other_author.id + response.should render_template("panels") + end + end + context 'jsonå½¢å¼' do + it 'jsonãã¼ã¿ãè¿ã' do + get :panels, :id => @other_author.id, :format => :json + lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError) + end + end + end + context 'ã¦ã¼ã¶æ¨©éããªãã¨ã' do + before do + sign_out @user + end + it 'ã¹ãã¼ã¿ã¹ã³ã¼ã200 OKãè¿ã' do + get :panels, :id => @other_author.id + response.should be_success + end + context 'htmlå½¢å¼' do + it 'comicãã³ãã¬ã¼ããæç»ãã' do + get :panels, :id => @other_author.id + response.should render_template("panels") + end + end + context 'jsonå½¢å¼' do + it 'jsonãã¼ã¿ãè¿ã' do + get :panels, :id => @other_author.id, :format => :json + lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError) + end + end + end + end + describe 'ä½å®¶æ°åå¾ã«æ¼ãã¦' do before do Author.should_receive(:visible_count).and_return(3) diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index feba48d5..ac609e44 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -345,15 +345,15 @@ if MagicNumber['run_mode'] == 1 end it 'çç¥ãããã¨@page_sizeã«ããã©ã«ãå¤ãå ¥ã' do get :panel_color - assigns(:page_size).should eq PanelColor.default_page_size + assigns(:page_size).should eq Author.default_panel_color_page_size end it 'æ大ãè¶ ããã¨@page_sizeã«ããã©ã«ãæ大å¤ãå ¥ã' do get :panel_color, :page_size => 1500 - assigns(:page_size).should eq PanelColor.max_page_size + assigns(:page_size).should eq Author.panel_color_max_page_size end it 'ä¸æ£ãªå¤ãå ¥ãã¨@page_sizeã«ããã©ã«ãæ大å¤ãå ¥ã' do get :panel_color, :page_size => 0 - assigns(:page_size).should eq PanelColor.default_page_size + assigns(:page_size).should eq Author.default_panel_color_page_size end end context 'ã¤ã¤ããªãçµããã¨ã' do @@ -446,15 +446,15 @@ if MagicNumber['run_mode'] == 1 end it 'çç¥ãããã¨@page_sizeã«ããã©ã«ãå¤ãå ¥ã' do get :ground_picture - assigns(:page_size).should eq GroundPicture.default_page_size + 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 + 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 + assigns(:page_size).should eq Author.default_ground_picture_page_size end end context 'ã¤ã¤ããªãçµããã¨ã' do @@ -547,15 +547,15 @@ if MagicNumber['run_mode'] == 1 end it 'çç¥ãããã¨@page_sizeã«ããã©ã«ãå¤ãå ¥ã' do get :ground_color - assigns(:page_size).should eq GroundColor.default_page_size + 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 + 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 + assigns(:page_size).should eq Author.default_ground_color_page_size end end context 'ã¤ã¤ããªãçµããã¨ã' do @@ -650,15 +650,15 @@ if MagicNumber['run_mode'] == 1 end it 'çç¥ãããã¨@page_sizeã«ããã©ã«ãå¤ãå ¥ã' do get :resource_picture - assigns(:page_size).should eq Author.default_comic_page_size + 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 + 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 + assigns(:page_size).should eq Author.default_resource_picture_page_size end end context 'ã¤ã¤ããªãçµããã¨ã' do