OSDN Git Service

t#31085:raise err when input invalid encoding string
[pettanr/pettanr.git] / spec / models / story_spec.rb
index 4c6baf6..089c437 100644 (file)
@@ -1448,26 +1448,32 @@ describe Story do
     end
     context 'コミックで引っかかるとき' do
       it 'falseを返す' do
-        @story.comic_id = nil
+        Panel.any_instance.stub(:usable?).with(any_args).and_return(true)
+        Comic.any_instance.stub(:own?).with(any_args).and_return(false)
         r = @story.allow?
         r.should be_false
       end
+    end
+    context 'コマで引っかかるとき' do
       it 'falseを返す' do
-        Comic.any_instance.stub(:own?).with(any_args).and_return(false)
+        Comic.any_instance.stub(:own?).with(any_args).and_return(true)
+        Panel.any_instance.stub(:usable?).with(any_args).and_return(false)
         r = @story.allow?
         r.should be_false
       end
     end
-    context 'コマで引っかかるとき' do
-      it 'falseを返す' do
+    context 'コミックまたはコマが指定されていなかったとき' do
+      it 'nilを返す' do
+        Comic.any_instance.stub(:own?).with(any_args).and_return(true)
         @story.panel_id = nil
         r = @story.allow?
-        r.should be_false
+        r.should eq nil
       end
-      it 'falseを返す' do
-        Panel.any_instance.stub(:usable?).with(any_args).and_return(false)
+      it 'nilを返す' do
+        Panel.any_instance.stub(:usable?).with(any_args).and_return(true)
+        @story.comic_id = nil
         r = @story.allow?
-        r.should be_false
+        r.should eq nil
       end
     end
   end