+# -*- encoding: utf-8 -*-
+#フキダシ枠
require 'spec_helper'
-# This spec was generated by rspec-rails when you ran the scaffold generator.
-# It demonstrates how one might use RSpec to specify the controller code that
-# was generated by Rails when you ran the scaffold generator.
-#
-# It assumes that the implementation code is generated by the rails scaffold
-# generator. If you are using any extension libraries to generate different
-# controller code, this generated spec may or may not pass.
-#
-# It only uses APIs available in rails and/or rspec-rails. There are a number
-# of tools you can use to make these specs even more expressive, but we're
-# sticking to rails and rspec-rails APIs to keep things simple and stable.
-#
-# Compared to earlier versions of this generator, there is very limited use of
-# stubs and message expectations in this spec. Stubs are only used when there
-# is no simpler way to get a handle on the object needed for the example.
-# Message expectations are only used when there is no simpler way to specify
-# that an instance is receiving a specific message.
-
describe BalloonsController do
-
- # This should return the minimal set of attributes required to create a valid
- # Baloon. As you add validations to Baloon, be sure to
- # update the return value of this method accordingly.
- def valid_attributes
- {}
- end
-
describe "GET index" do
it "assigns all baloons as @baloons" do
baloon = Baloon.create! valid_attributes
assigns(:baloons).should eq([baloon])
end
end
-
- describe "GET show" do
- it "assigns the requested baloon as @baloon" do
- baloon = Baloon.create! valid_attributes
- get :show, :id => baloon.id
- assigns(:baloon).should eq(baloon)
- end
- end
-
- describe "GET new" do
- it "assigns a new baloon as @baloon" do
- get :new
- assigns(:baloon).should be_a_new(Baloon)
- end
- end
-
- describe "GET edit" do
- it "assigns the requested baloon as @baloon" do
- baloon = Baloon.create! valid_attributes
- get :edit, :id => baloon.id
- assigns(:baloon).should eq(baloon)
- end
- end
-
- describe "POST create" do
- describe "with valid params" do
- it "creates a new Baloon" do
- expect {
- post :create, :baloon => valid_attributes
- }.to change(Baloon, :count).by(1)
- end
-
- it "assigns a newly created baloon as @baloon" do
- post :create, :baloon => valid_attributes
- assigns(:baloon).should be_a(Baloon)
- assigns(:baloon).should be_persisted
- end
-
- it "redirects to the created baloon" do
- post :create, :baloon => valid_attributes
- response.should redirect_to(Baloon.last)
- end
- end
-
- describe "with invalid params" do
- it "assigns a newly created but unsaved baloon as @baloon" do
- # Trigger the behavior that occurs when invalid params are submitted
- Baloon.any_instance.stub(:save).and_return(false)
- post :create, :baloon => {}
- assigns(:baloon).should be_a_new(Baloon)
- end
-
- it "re-renders the 'new' template" do
- # Trigger the behavior that occurs when invalid params are submitted
- Baloon.any_instance.stub(:save).and_return(false)
- post :create, :baloon => {}
- response.should render_template("new")
- end
- end
- end
-
- describe "PUT update" do
- describe "with valid params" do
- it "updates the requested baloon" do
- baloon = Baloon.create! valid_attributes
- # Assuming there are no other baloons in the database, this
- # specifies that the Baloon created on the previous line
- # receives the :update_attributes message with whatever params are
- # submitted in the request.
- Baloon.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
- put :update, :id => baloon.id, :baloon => {'these' => 'params'}
- end
-
- it "assigns the requested baloon as @baloon" do
- baloon = Baloon.create! valid_attributes
- put :update, :id => baloon.id, :baloon => valid_attributes
- assigns(:baloon).should eq(baloon)
- end
-
- it "redirects to the baloon" do
- baloon = Baloon.create! valid_attributes
- put :update, :id => baloon.id, :baloon => valid_attributes
- response.should redirect_to(baloon)
- end
- end
-
- describe "with invalid params" do
- it "assigns the baloon as @baloon" do
- baloon = Baloon.create! valid_attributes
- # Trigger the behavior that occurs when invalid params are submitted
- Baloon.any_instance.stub(:save).and_return(false)
- put :update, :id => baloon.id, :baloon => {}
- assigns(:baloon).should eq(baloon)
- end
-
- it "re-renders the 'edit' template" do
- baloon = Baloon.create! valid_attributes
- # Trigger the behavior that occurs when invalid params are submitted
- Baloon.any_instance.stub(:save).and_return(false)
- put :update, :id => baloon.id, :baloon => {}
- response.should render_template("edit")
- end
- end
- end
-
- describe "DELETE destroy" do
- it "destroys the requested baloon" do
- baloon = Baloon.create! valid_attributes
- expect {
- delete :destroy, :id => baloon.id
- }.to change(Baloon, :count).by(-1)
- end
-
- it "redirects to the baloons list" do
- baloon = Baloon.create! valid_attributes
- delete :destroy, :id => baloon.id
- response.should redirect_to(baloons_url)
- end
- end
-
end