Newer
Older
# licensed under the Affero General Public License version 3 or later. See
Daniel Vincent Grippi
a validé
@user = Factory.create(:user)
@person = Factory.create(:person)
describe "#index" do
it "assigns @friends to all the user's friends" do
Factory.create :person
get :index
assigns[:friends].should == @user.friends
end
maxwell
a validé
describe "#create" do
describe "with valid params" do
it "creates an aspect" do
@user.aspects.count.should == 1
post :create, "aspect" => {"name" => "new aspect"}
@user.reload.aspects.count.should == 2
end
it "redirects to the aspect page" do
post :create, "aspect" => {"name" => "new aspect"}
response.should redirect_to(aspect_path(Aspect.find_by_name("new aspect")))
end
end
describe "with invalid params" do
it "does not create an aspect" do
@user.aspects.count.should == 1
post :create, "aspect" => {"name" => ""}
@user.reload.aspects.count.should == 1
end
it "goes back to manage aspects" do
post :create, "aspect" => {"name" => ""}
response.should redirect_to(aspects_manage_path)
end
end
end