Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add spec

  • Loading branch information...
commit 88aaadd53b4311aaec0952144a0c794485fecffa 1 parent 067ce2f
@amesel amesel authored
Showing with 959 additions and 428 deletions.
  1. +1 −0  .gitignore
  2. +164 −0 spec/controllers/comments_controller_spec.rb
  3. +164 −0 spec/controllers/joins_controller_spec.rb
  4. +164 −0 spec/controllers/parties_controller_spec.rb
  5. +167 −0 spec/controllers/tasks_controller_spec.rb
  6. +27 −0 spec/controllers/users_controller_spec.rb
  7. +9 −0 spec/factories/comments.rb
  8. +13 −0 spec/factories/joins.rb
  9. +9 −0 spec/factories/parties.rb
  10. +12 −0 spec/factories/tasks.rb
  11. +10 −0 spec/factories/users.rb
  12. +10 −0 spec/models/comment_spec.rb
  13. +17 −0 spec/models/join_spec.rb
  14. +23 −0 spec/models/party_spec.rb
  15. +62 −0 spec/models/task_spec.rb
  16. +20 −0 spec/models/user_spec.rb
  17. +11 −0 spec/requests/comments_spec.rb
  18. +11 −0 spec/requests/joins_spec.rb
  19. +11 −0 spec/requests/parties_spec.rb
  20. +11 −0 spec/requests/tasks_spec.rb
  21. +11 −0 spec/requests/users_spec.rb
  22. +32 −0 spec/spec_helper.rb
  23. 0  test/fixtures/.gitkeep
  24. +0 −9 test/fixtures/activities.yml
  25. +0 −7 test/fixtures/authentications.yml
  26. +0 −9 test/fixtures/joins.yml
  27. +0 −11 test/fixtures/parties.yml
  28. +0 −15 test/fixtures/tasks.yml
  29. +0 −9 test/fixtures/users.yml
  30. 0  test/functional/.gitkeep
  31. +0 −49 test/functional/activities_controller_test.rb
  32. +0 −49 test/functional/joins_controller_test.rb
  33. +0 −49 test/functional/parties_controller_test.rb
  34. +0 −14 test/functional/sessions_controller_test.rb
  35. +0 −14 test/functional/settings_controller_test.rb
  36. +0 −49 test/functional/tasks_controller_test.rb
  37. +0 −49 test/functional/users_controller_test.rb
  38. 0  test/integration/.gitkeep
  39. +0 −12 test/performance/browsing_test.rb
  40. +0 −13 test/test_helper.rb
  41. 0  test/unit/.gitkeep
  42. +0 −7 test/unit/activity_test.rb
  43. +0 −7 test/unit/authentication_test.rb
  44. +0 −4 test/unit/helpers/activities_helper_test.rb
  45. +0 −4 test/unit/helpers/joins_helper_test.rb
  46. +0 −4 test/unit/helpers/parties_helper_test.rb
  47. +0 −4 test/unit/helpers/sessions_helper_test.rb
  48. +0 −4 test/unit/helpers/settings_helper_test.rb
  49. +0 −4 test/unit/helpers/tasks_helper_test.rb
  50. +0 −4 test/unit/helpers/users_helper_test.rb
  51. +0 −7 test/unit/join_test.rb
  52. +0 −7 test/unit/party_test.rb
  53. +0 −7 test/unit/task_test.rb
  54. +0 −7 test/unit/user_test.rb
View
1  .gitignore
@@ -15,6 +15,7 @@
/tmp
.rvmrc
+.rspec
.sass-cache/
public/assets/
View
164 spec/controllers/comments_controller_spec.rb
@@ -0,0 +1,164 @@
+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 CommentsController do
+
+ # This should return the minimal set of attributes required to create a valid
+ # Comment. As you add validations to Comment, be sure to
+ # update the return value of this method accordingly.
+ def valid_attributes
+ {}
+ end
+
+ # This should return the minimal set of values that should be in the session
+ # in order to pass any filters (e.g. authentication) defined in
+ # CommentsController. Be sure to keep this updated too.
+ def valid_session
+ {}
+ end
+
+ describe "GET index" do
+ it "assigns all comments as @comments" do
+ comment = Comment.create! valid_attributes
+ get :index, {}, valid_session
+ assigns(:comments).should eq([comment])
+ end
+ end
+
+ describe "GET show" do
+ it "assigns the requested comment as @comment" do
+ comment = Comment.create! valid_attributes
+ get :show, {:id => comment.to_param}, valid_session
+ assigns(:comment).should eq(comment)
+ end
+ end
+
+ describe "GET new" do
+ it "assigns a new comment as @comment" do
+ get :new, {}, valid_session
+ assigns(:comment).should be_a_new(Comment)
+ end
+ end
+
+ describe "GET edit" do
+ it "assigns the requested comment as @comment" do
+ comment = Comment.create! valid_attributes
+ get :edit, {:id => comment.to_param}, valid_session
+ assigns(:comment).should eq(comment)
+ end
+ end
+
+ describe "POST create" do
+ describe "with valid params" do
+ it "creates a new Comment" do
+ expect {
+ post :create, {:comment => valid_attributes}, valid_session
+ }.to change(Comment, :count).by(1)
+ end
+
+ it "assigns a newly created comment as @comment" do
+ post :create, {:comment => valid_attributes}, valid_session
+ assigns(:comment).should be_a(Comment)
+ assigns(:comment).should be_persisted
+ end
+
+ it "redirects to the created comment" do
+ post :create, {:comment => valid_attributes}, valid_session
+ response.should redirect_to(Comment.last)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns a newly created but unsaved comment as @comment" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Comment.any_instance.stub(:save).and_return(false)
+ post :create, {:comment => {}}, valid_session
+ assigns(:comment).should be_a_new(Comment)
+ end
+
+ it "re-renders the 'new' template" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Comment.any_instance.stub(:save).and_return(false)
+ post :create, {:comment => {}}, valid_session
+ response.should render_template("new")
+ end
+ end
+ end
+
+ describe "PUT update" do
+ describe "with valid params" do
+ it "updates the requested comment" do
+ comment = Comment.create! valid_attributes
+ # Assuming there are no other comments in the database, this
+ # specifies that the Comment created on the previous line
+ # receives the :update_attributes message with whatever params are
+ # submitted in the request.
+ Comment.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
+ put :update, {:id => comment.to_param, :comment => {'these' => 'params'}}, valid_session
+ end
+
+ it "assigns the requested comment as @comment" do
+ comment = Comment.create! valid_attributes
+ put :update, {:id => comment.to_param, :comment => valid_attributes}, valid_session
+ assigns(:comment).should eq(comment)
+ end
+
+ it "redirects to the comment" do
+ comment = Comment.create! valid_attributes
+ put :update, {:id => comment.to_param, :comment => valid_attributes}, valid_session
+ response.should redirect_to(comment)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns the comment as @comment" do
+ comment = Comment.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Comment.any_instance.stub(:save).and_return(false)
+ put :update, {:id => comment.to_param, :comment => {}}, valid_session
+ assigns(:comment).should eq(comment)
+ end
+
+ it "re-renders the 'edit' template" do
+ comment = Comment.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Comment.any_instance.stub(:save).and_return(false)
+ put :update, {:id => comment.to_param, :comment => {}}, valid_session
+ response.should render_template("edit")
+ end
+ end
+ end
+
+ describe "DELETE destroy" do
+ it "destroys the requested comment" do
+ comment = Comment.create! valid_attributes
+ expect {
+ delete :destroy, {:id => comment.to_param}, valid_session
+ }.to change(Comment, :count).by(-1)
+ end
+
+ it "redirects to the comments list" do
+ comment = Comment.create! valid_attributes
+ delete :destroy, {:id => comment.to_param}, valid_session
+ response.should redirect_to(comments_url)
+ end
+ end
+
+end
View
164 spec/controllers/joins_controller_spec.rb
@@ -0,0 +1,164 @@
+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 JoinsController do
+
+ # This should return the minimal set of attributes required to create a valid
+ # Join. As you add validations to Join, be sure to
+ # update the return value of this method accordingly.
+ def valid_attributes
+ {}
+ end
+
+ # This should return the minimal set of values that should be in the session
+ # in order to pass any filters (e.g. authentication) defined in
+ # JoinsController. Be sure to keep this updated too.
+ def valid_session
+ {}
+ end
+
+ describe "GET index" do
+ it "assigns all joins as @joins" do
+ join = Join.create! valid_attributes
+ get :index, {}, valid_session
+ assigns(:joins).should eq([join])
+ end
+ end
+
+ describe "GET show" do
+ it "assigns the requested join as @join" do
+ join = Join.create! valid_attributes
+ get :show, {:id => join.to_param}, valid_session
+ assigns(:join).should eq(join)
+ end
+ end
+
+ describe "GET new" do
+ it "assigns a new join as @join" do
+ get :new, {}, valid_session
+ assigns(:join).should be_a_new(Join)
+ end
+ end
+
+ describe "GET edit" do
+ it "assigns the requested join as @join" do
+ join = Join.create! valid_attributes
+ get :edit, {:id => join.to_param}, valid_session
+ assigns(:join).should eq(join)
+ end
+ end
+
+ describe "POST create" do
+ describe "with valid params" do
+ it "creates a new Join" do
+ expect {
+ post :create, {:join => valid_attributes}, valid_session
+ }.to change(Join, :count).by(1)
+ end
+
+ it "assigns a newly created join as @join" do
+ post :create, {:join => valid_attributes}, valid_session
+ assigns(:join).should be_a(Join)
+ assigns(:join).should be_persisted
+ end
+
+ it "redirects to the created join" do
+ post :create, {:join => valid_attributes}, valid_session
+ response.should redirect_to(Join.last)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns a newly created but unsaved join as @join" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Join.any_instance.stub(:save).and_return(false)
+ post :create, {:join => {}}, valid_session
+ assigns(:join).should be_a_new(Join)
+ end
+
+ it "re-renders the 'new' template" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Join.any_instance.stub(:save).and_return(false)
+ post :create, {:join => {}}, valid_session
+ response.should render_template("new")
+ end
+ end
+ end
+
+ describe "PUT update" do
+ describe "with valid params" do
+ it "updates the requested join" do
+ join = Join.create! valid_attributes
+ # Assuming there are no other joins in the database, this
+ # specifies that the Join created on the previous line
+ # receives the :update_attributes message with whatever params are
+ # submitted in the request.
+ Join.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
+ put :update, {:id => join.to_param, :join => {'these' => 'params'}}, valid_session
+ end
+
+ it "assigns the requested join as @join" do
+ join = Join.create! valid_attributes
+ put :update, {:id => join.to_param, :join => valid_attributes}, valid_session
+ assigns(:join).should eq(join)
+ end
+
+ it "redirects to the join" do
+ join = Join.create! valid_attributes
+ put :update, {:id => join.to_param, :join => valid_attributes}, valid_session
+ response.should redirect_to(join)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns the join as @join" do
+ join = Join.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Join.any_instance.stub(:save).and_return(false)
+ put :update, {:id => join.to_param, :join => {}}, valid_session
+ assigns(:join).should eq(join)
+ end
+
+ it "re-renders the 'edit' template" do
+ join = Join.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Join.any_instance.stub(:save).and_return(false)
+ put :update, {:id => join.to_param, :join => {}}, valid_session
+ response.should render_template("edit")
+ end
+ end
+ end
+
+ describe "DELETE destroy" do
+ it "destroys the requested join" do
+ join = Join.create! valid_attributes
+ expect {
+ delete :destroy, {:id => join.to_param}, valid_session
+ }.to change(Join, :count).by(-1)
+ end
+
+ it "redirects to the joins list" do
+ join = Join.create! valid_attributes
+ delete :destroy, {:id => join.to_param}, valid_session
+ response.should redirect_to(joins_url)
+ end
+ end
+
+end
View
164 spec/controllers/parties_controller_spec.rb
@@ -0,0 +1,164 @@
+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 PartiesController do
+
+ # This should return the minimal set of attributes required to create a valid
+ # Party. As you add validations to Party, be sure to
+ # update the return value of this method accordingly.
+ def valid_attributes
+ {}
+ end
+
+ # This should return the minimal set of values that should be in the session
+ # in order to pass any filters (e.g. authentication) defined in
+ # PartiesController. Be sure to keep this updated too.
+ def valid_session
+ {}
+ end
+
+ describe "GET index" do
+ it "assigns all parties as @parties" do
+ party = Party.create! valid_attributes
+ get :index, {}, valid_session
+ assigns(:parties).should eq([party])
+ end
+ end
+
+ describe "GET show" do
+ it "assigns the requested party as @party" do
+ party = Party.create! valid_attributes
+ get :show, {:id => party.to_param}, valid_session
+ assigns(:party).should eq(party)
+ end
+ end
+
+ describe "GET new" do
+ it "assigns a new party as @party" do
+ get :new, {}, valid_session
+ assigns(:party).should be_a_new(Party)
+ end
+ end
+
+ describe "GET edit" do
+ it "assigns the requested party as @party" do
+ party = Party.create! valid_attributes
+ get :edit, {:id => party.to_param}, valid_session
+ assigns(:party).should eq(party)
+ end
+ end
+
+ describe "POST create" do
+ describe "with valid params" do
+ it "creates a new Party" do
+ expect {
+ post :create, {:party => valid_attributes}, valid_session
+ }.to change(Party, :count).by(1)
+ end
+
+ it "assigns a newly created party as @party" do
+ post :create, {:party => valid_attributes}, valid_session
+ assigns(:party).should be_a(Party)
+ assigns(:party).should be_persisted
+ end
+
+ it "redirects to the created party" do
+ post :create, {:party => valid_attributes}, valid_session
+ response.should redirect_to(Party.last)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns a newly created but unsaved party as @party" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Party.any_instance.stub(:save).and_return(false)
+ post :create, {:party => {}}, valid_session
+ assigns(:party).should be_a_new(Party)
+ end
+
+ it "re-renders the 'new' template" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Party.any_instance.stub(:save).and_return(false)
+ post :create, {:party => {}}, valid_session
+ response.should render_template("new")
+ end
+ end
+ end
+
+ describe "PUT update" do
+ describe "with valid params" do
+ it "updates the requested party" do
+ party = Party.create! valid_attributes
+ # Assuming there are no other parties in the database, this
+ # specifies that the Party created on the previous line
+ # receives the :update_attributes message with whatever params are
+ # submitted in the request.
+ Party.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
+ put :update, {:id => party.to_param, :party => {'these' => 'params'}}, valid_session
+ end
+
+ it "assigns the requested party as @party" do
+ party = Party.create! valid_attributes
+ put :update, {:id => party.to_param, :party => valid_attributes}, valid_session
+ assigns(:party).should eq(party)
+ end
+
+ it "redirects to the party" do
+ party = Party.create! valid_attributes
+ put :update, {:id => party.to_param, :party => valid_attributes}, valid_session
+ response.should redirect_to(party)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns the party as @party" do
+ party = Party.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Party.any_instance.stub(:save).and_return(false)
+ put :update, {:id => party.to_param, :party => {}}, valid_session
+ assigns(:party).should eq(party)
+ end
+
+ it "re-renders the 'edit' template" do
+ party = Party.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Party.any_instance.stub(:save).and_return(false)
+ put :update, {:id => party.to_param, :party => {}}, valid_session
+ response.should render_template("edit")
+ end
+ end
+ end
+
+ describe "DELETE destroy" do
+ it "destroys the requested party" do
+ party = Party.create! valid_attributes
+ expect {
+ delete :destroy, {:id => party.to_param}, valid_session
+ }.to change(Party, :count).by(-1)
+ end
+
+ it "redirects to the parties list" do
+ party = Party.create! valid_attributes
+ delete :destroy, {:id => party.to_param}, valid_session
+ response.should redirect_to(parties_url)
+ end
+ end
+
+end
View
167 spec/controllers/tasks_controller_spec.rb
@@ -0,0 +1,167 @@
+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 TasksController do
+
+ # This should return the minimal set of attributes required to create a valid
+ # Task. As you add validations to Task, be sure to
+ # update the return value of this method accordingly.
+ def valid_attributes
+ {}
+ end
+
+ # This should return the minimal set of values that should be in the session
+ # in order to pass any filters (e.g. authentication) defined in
+ # TasksController. Be sure to keep this updated too.
+ def valid_session
+ {}
+ end
+
+ describe "GET index" do
+ let!(:party) { Factory(:party) }
+ it "assigns all tasks as @tasks" do
+# task = Task.create! valid_attributes
+ task = Factory(:task)
+ get :index, {}, valid_session
+ response.should be_success
+# assigns(:tasks).should eq([task])
+ end
+ end
+
+ # describe "GET show" do
+ # it "assigns the requested task as @task" do
+ # task = Task.create! valid_attributes
+ # get :show, {:id => task.to_param}, valid_session
+ # assigns(:task).should eq(task)
+ # end
+ # end
+
+ # describe "GET new" do
+ # it "assigns a new task as @task" do
+ # get :new, {}, valid_session
+ # assigns(:task).should be_a_new(Task)
+ # end
+ # end
+
+ # describe "GET edit" do
+ # it "assigns the requested task as @task" do
+ # task = Task.create! valid_attributes
+ # get :edit, {:id => task.to_param}, valid_session
+ # assigns(:task).should eq(task)
+ # end
+ # end
+
+ # describe "POST create" do
+ # describe "with valid params" do
+ # it "creates a new Task" do
+ # expect {
+ # post :create, {:task => valid_attributes}, valid_session
+ # }.to change(Task, :count).by(1)
+ # end
+
+ # it "assigns a newly created task as @task" do
+ # post :create, {:task => valid_attributes}, valid_session
+ # assigns(:task).should be_a(Task)
+ # assigns(:task).should be_persisted
+ # end
+
+ # it "redirects to the created task" do
+ # post :create, {:task => valid_attributes}, valid_session
+ # response.should redirect_to(Task.last)
+ # end
+ # end
+
+ # describe "with invalid params" do
+ # it "assigns a newly created but unsaved task as @task" do
+ # # Trigger the behavior that occurs when invalid params are submitted
+ # Task.any_instance.stub(:save).and_return(false)
+ # post :create, {:task => {}}, valid_session
+ # assigns(:task).should be_a_new(Task)
+ # end
+
+ # it "re-renders the 'new' template" do
+ # # Trigger the behavior that occurs when invalid params are submitted
+ # Task.any_instance.stub(:save).and_return(false)
+ # post :create, {:task => {}}, valid_session
+ # response.should render_template("new")
+ # end
+ # end
+ # end
+
+ # describe "PUT update" do
+ # describe "with valid params" do
+ # it "updates the requested task" do
+ # task = Task.create! valid_attributes
+ # # Assuming there are no other tasks in the database, this
+ # # specifies that the Task created on the previous line
+ # # receives the :update_attributes message with whatever params are
+ # # submitted in the request.
+ # Task.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
+ # put :update, {:id => task.to_param, :task => {'these' => 'params'}}, valid_session
+ # end
+
+ # it "assigns the requested task as @task" do
+ # task = Task.create! valid_attributes
+ # put :update, {:id => task.to_param, :task => valid_attributes}, valid_session
+ # assigns(:task).should eq(task)
+ # end
+
+ # it "redirects to the task" do
+ # task = Task.create! valid_attributes
+ # put :update, {:id => task.to_param, :task => valid_attributes}, valid_session
+ # response.should redirect_to(task)
+ # end
+ # end
+
+ # describe "with invalid params" do
+ # it "assigns the task as @task" do
+ # task = Task.create! valid_attributes
+ # # Trigger the behavior that occurs when invalid params are submitted
+ # Task.any_instance.stub(:save).and_return(false)
+ # put :update, {:id => task.to_param, :task => {}}, valid_session
+ # assigns(:task).should eq(task)
+ # end
+
+ # it "re-renders the 'edit' template" do
+ # task = Task.create! valid_attributes
+ # # Trigger the behavior that occurs when invalid params are submitted
+ # Task.any_instance.stub(:save).and_return(false)
+ # put :update, {:id => task.to_param, :task => {}}, valid_session
+ # response.should render_template("edit")
+ # end
+ # end
+ # end
+
+ # describe "DELETE destroy" do
+ # it "destroys the requested task" do
+ # task = Task.create! valid_attributes
+ # expect {
+ # delete :destroy, {:id => task.to_param}, valid_session
+ # }.to change(Task, :count).by(-1)
+ # end
+
+ # it "redirects to the tasks list" do
+ # task = Task.create! valid_attributes
+ # delete :destroy, {:id => task.to_param}, valid_session
+ # response.should redirect_to(tasks_url)
+ # end
+ # end
+
+end
View
27 spec/controllers/users_controller_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+describe UsersController do
+
+ # This should return the minimal set of attributes required to create a valid
+ # User. As you add validations to User, be sure to
+ # update the return value of this method accordingly.
+ def valid_attributes
+ {}
+ end
+
+ # This should return the minimal set of values that should be in the session
+ # in order to pass any filters (e.g. authentication) defined in
+ # UsersController. Be sure to keep this updated too.
+ def valid_session
+ {}
+ end
+
+ describe "GET index" do
+ it "assigns all users as @users" do
+ user = User.create! valid_attributes
+ get :index, {}, valid_session
+ assigns(:users).should eq([user])
+ end
+ end
+
+end
View
9 spec/factories/comments.rb
@@ -0,0 +1,9 @@
+# Read about factories at http://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :comment do
+ task_id 1
+ user_id 1
+ content "My Comment"
+ end
+end
View
13 spec/factories/joins.rb
@@ -0,0 +1,13 @@
+# Read about factories at http://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :join do
+ user_id 1
+ party_id 1
+ state "chore"
+ started_at "2012-06-30 15:00:09"
+ finished_at "2012-06-30 15:00:09"
+ end_hour 1
+ end_min 1
+ end
+end
View
9 spec/factories/parties.rb
@@ -0,0 +1,9 @@
+# Read about factories at http://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :party do
+ name "My Party"
+ description "My Hackason"
+ user_id 1
+ end
+end
View
12 spec/factories/tasks.rb
@@ -0,0 +1,12 @@
+# Read about factories at http://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :task do
+ user_id 1
+ party_id 1
+ content "My Task"
+ state "backlog"
+ help false
+ finished_at "2012-06-30 15:01:11"
+ end
+end
View
10 spec/factories/users.rb
@@ -0,0 +1,10 @@
+# Read about factories at http://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :user do
+ name "user1"
+ image "user1.png"
+ email "user1@example.com"
+ password "testpass"
+ end
+end
View
10 spec/models/comment_spec.rb
@@ -0,0 +1,10 @@
+require 'spec_helper'
+
+describe Comment do
+
+ describe "associations" do
+ it { should belong_to(:task) }
+ it { should belong_to(:user) }
+ end
+
+end
View
17 spec/models/join_spec.rb
@@ -0,0 +1,17 @@
+require 'spec_helper'
+
+describe Join do
+
+ describe "associations" do
+ it { should belong_to(:party) }
+ it { should belong_to(:user) }
+ end
+
+ describe "validations" do
+ before { Factory(:join) }
+ it { should validate_presence_of(:party_id) }
+ it { should validate_presence_of(:user_id) }
+ it { should validate_uniqueness_of(:party_id).scoped_to(:user_id) }
+ end
+
+end
View
23 spec/models/party_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe Party do
+
+ describe "associations" do
+ it { should belong_to(:user) }
+ it { should have_many(:joins) }
+ it { should have_many(:members).through(:joins) }
+ end
+
+ describe "member_tokens" do
+ let(:party) { Factory(:party) }
+ (1..5).each do |i|
+ let!("user#{i}".to_sym) { Factory(:user, email: "user#{i}@example.com") }
+ end
+
+ it "should return array" do
+ party.member_tokens="#{user1.id},#{user5.id},#{user3.id}"
+ party.member_ids.should == [user1.id, user5.id, user3.id]
+ end
+ end
+
+end
View
62 spec/models/task_spec.rb
@@ -0,0 +1,62 @@
+require 'spec_helper'
+
+describe Task do
+
+ describe "associations" do
+ it { should belong_to(:user) }
+ it { should belong_to(:party) }
+ it { should have_many(:comments) }
+ end
+
+ describe "validations" do
+ it { should validate_presence_of(:user_id) }
+ it { should validate_presence_of(:content) }
+ end
+
+ describe "state" do
+ let!(:party) { Factory(:party) }
+ (1..3).each do |i|
+ let!("task#{i}".to_sym) { Factory(:task, party_id: party.id, state: "backlog") }
+ end
+
+ describe "start" do
+ before do
+ task1.start
+ task2.start
+ task3.start
+ end
+ it { Task.current(party.id).should include task1 }
+ it { Task.current(party.id).should_not include task2 }
+ it { Task.current(party.id).should_not include task3 }
+ end
+
+ describe "hold" do
+ before do
+ task1.start
+ task1.hold
+ end
+ it { Task.current(party.id).should_not include task1 }
+ it { Task.backlog(party.id).should include task1 }
+ end
+
+ describe "finish" do
+ before do
+ task1.start
+ task1.finish
+ end
+ it { Task.current(party.id).should_not include task1 }
+ it { Task.done(party.id).should include task1 }
+ end
+
+ describe "redo" do
+ before do
+ task1.start
+ task1.finish
+ task1.redo
+ end
+ it { Task.current(party.id).should_not include task1 }
+ it { Task.done(party.id).should_not include task1 }
+ it { Task.backlog(party.id).should include task1 }
+ end
+ end
+end
View
20 spec/models/user_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe User do
+
+ describe "associations" do
+ it { should have_many(:parties) }
+ it { should have_many(:joins) }
+ it { should have_many(:invited_parties).through(:joins) }
+ it { should have_many(:tasks) }
+ it { should have_many(:comments) }
+ end
+
+ describe "validations" do
+ before { Factory(:user) }
+ it { should validate_presence_of(:name) }
+ it { should validate_presence_of(:password) }
+ it { should validate_uniqueness_of(:email) }
+ end
+
+end
View
11 spec/requests/comments_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe "Comments" do
+ describe "GET /comments" do
+ it "works! (now write some real specs)" do
+ # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
+ get comments_path
+ response.status.should be(200)
+ end
+ end
+end
View
11 spec/requests/joins_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe "Joins" do
+ describe "GET /joins" do
+ it "works! (now write some real specs)" do
+ # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
+ get joins_path
+ response.status.should be(200)
+ end
+ end
+end
View
11 spec/requests/parties_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe "Parties" do
+ describe "GET /parties" do
+ it "works! (now write some real specs)" do
+ # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
+ get parties_path
+ response.status.should be(200)
+ end
+ end
+end
View
11 spec/requests/tasks_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe "Tasks" do
+ describe "GET /tasks" do
+ it "works! (now write some real specs)" do
+ # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
+ get tasks_path
+ response.status.should be(200)
+ end
+ end
+end
View
11 spec/requests/users_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe "Users" do
+ describe "GET /users" do
+ it "works! (now write some real specs)" do
+ # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
+ get users_path
+ response.status.should be(200)
+ end
+ end
+end
View
32 spec/spec_helper.rb
@@ -0,0 +1,32 @@
+# This file is copied to spec/ when you run 'rails generate rspec:install'
+ENV["RAILS_ENV"] ||= 'test'
+require File.expand_path("../../config/environment", __FILE__)
+require 'rspec/rails'
+require 'rspec/autorun'
+
+# Requires supporting ruby files with custom matchers and macros, etc,
+# in spec/support/ and its subdirectories.
+Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+
+RSpec.configure do |config|
+ # ## Mock Framework
+ #
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+
+ # If true, the base class of anonymous controllers will be inferred
+ # automatically. This will be the default behavior in future versions of
+ # rspec-rails.
+ config.infer_base_class_for_anonymous_controllers = false
+end
View
0  test/fixtures/.gitkeep
No changes.
View
9 test/fixtures/activities.yml
@@ -1,9 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
-
-one:
- user_id: 1
- content: MyText
-
-two:
- user_id: 1
- content: MyText
View
7 test/fixtures/authentications.yml
@@ -1,7 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
-
-one:
- user_id: 1
-
-two:
- user_id: 1
View
9 test/fixtures/joins.yml
@@ -1,9 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
-
-one:
- user_id: 1
- party_id: 1
-
-two:
- user_id: 1
- party_id: 1
View
11 test/fixtures/parties.yml
@@ -1,11 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
-
-one:
- name: MyString
- description: MyText
- end_at: 2012-04-29 11:08:48
-
-two:
- name: MyString
- description: MyText
- end_at: 2012-04-29 11:08:48
View
15 test/fixtures/tasks.yml
@@ -1,15 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
-
-one:
- user_id: 1
- content: MyText
- state: MyString
- start_time: 2012-04-29 13:50:06
- end_time: 2012-04-29 13:50:06
-
-two:
- user_id: 1
- content: MyText
- state: MyString
- start_time: 2012-04-29 13:50:06
- end_time: 2012-04-29 13:50:06
View
9 test/fixtures/users.yml
@@ -1,9 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
-
-one:
- name: MyString
- image: MyString
-
-two:
- name: MyString
- image: MyString
View
0  test/functional/.gitkeep
No changes.
View
49 test/functional/activities_controller_test.rb
@@ -1,49 +0,0 @@
-require 'test_helper'
-
-class CommentsControllerTest < ActionController::TestCase
- setup do
- @comment = comments(:one)
- end
-
- test "should get index" do
- get :index
- assert_response :success
- assert_not_nil assigns(:comments)
- end
-
- test "should get new" do
- get :new
- assert_response :success
- end
-
- test "should create comment" do
- assert_difference('Comment.count') do
- post :create, comment: { content: @comment.content, user_id: @comment.user_id }
- end
-
- assert_redirected_to comment_path(assigns(:comment))
- end
-
- test "should show comment" do
- get :show, id: @comment
- assert_response :success
- end
-
- test "should get edit" do
- get :edit, id: @comment
- assert_response :success
- end
-
- test "should update comment" do
- put :update, id: @comment, comment: { content: @comment.content, user_id: @comment.user_id }
- assert_redirected_to comment_path(assigns(:comment))
- end
-
- test "should destroy comment" do
- assert_difference('Comment.count', -1) do
- delete :destroy, id: @comment
- end
-
- assert_redirected_to comments_path
- end
-end
View
49 test/functional/joins_controller_test.rb
@@ -1,49 +0,0 @@
-require 'test_helper'
-
-class JoinsControllerTest < ActionController::TestCase
- setup do
- @join = joins(:one)
- end
-
- test "should get index" do
- get :index
- assert_response :success
- assert_not_nil assigns(:joins)
- end
-
- test "should get new" do
- get :new
- assert_response :success
- end
-
- test "should create join" do
- assert_difference('Join.count') do
- post :create, join: { party_id: @join.party_id, user_id: @join.user_id }
- end
-
- assert_redirected_to join_path(assigns(:join))
- end
-
- test "should show join" do
- get :show, id: @join
- assert_response :success
- end
-
- test "should get edit" do
- get :edit, id: @join
- assert_response :success
- end
-
- test "should update join" do
- put :update, id: @join, join: { party_id: @join.party_id, user_id: @join.user_id }
- assert_redirected_to join_path(assigns(:join))
- end
-
- test "should destroy join" do
- assert_difference('Join.count', -1) do
- delete :destroy, id: @join
- end
-
- assert_redirected_to joins_path
- end
-end
View
49 test/functional/parties_controller_test.rb
@@ -1,49 +0,0 @@
-require 'test_helper'
-
-class PartiesControllerTest < ActionController::TestCase
- setup do
- @party = parties(:one)
- end
-
- test "should get index" do
- get :index
- assert_response :success
- assert_not_nil assigns(:parties)
- end
-
- test "should get new" do
- get :new
- assert_response :success
- end
-
- test "should create party" do
- assert_difference('Party.count') do
- post :create, party: { description: @party.description, end_at: @party.end_at, name: @party.name }
- end
-
- assert_redirected_to party_path(assigns(:party))
- end
-
- test "should show party" do
- get :show, id: @party
- assert_response :success
- end
-
- test "should get edit" do
- get :edit, id: @party
- assert_response :success
- end
-
- test "should update party" do
- put :update, id: @party, party: { description: @party.description, end_at: @party.end_at, name: @party.name }
- assert_redirected_to party_path(assigns(:party))
- end
-
- test "should destroy party" do
- assert_difference('Party.count', -1) do
- delete :destroy, id: @party
- end
-
- assert_redirected_to parties_path
- end
-end
View
14 test/functional/sessions_controller_test.rb
@@ -1,14 +0,0 @@
-require 'test_helper'
-
-class SessionsControllerTest < ActionController::TestCase
- test "should get create" do
- get :create
- assert_response :success
- end
-
- test "should get destroy" do
- get :destroy
- assert_response :success
- end
-
-end
View
14 test/functional/settings_controller_test.rb
@@ -1,14 +0,0 @@
-require 'test_helper'
-
-class SettingsControllerTest < ActionController::TestCase
- test "should get edit" do
- get :edit
- assert_response :success
- end
-
- test "should get update" do
- get :update
- assert_response :success
- end
-
-end
View
49 test/functional/tasks_controller_test.rb
@@ -1,49 +0,0 @@
-require 'test_helper'
-
-class TasksControllerTest < ActionController::TestCase
- setup do
- @task = tasks(:one)
- end
-
- test "should get index" do
- get :index
- assert_response :success
- assert_not_nil assigns(:tasks)
- end
-
- test "should get new" do
- get :new
- assert_response :success
- end
-
- test "should create task" do
- assert_difference('Task.count') do
- post :create, task: { content: @task.content, end_time: @task.end_time, start_time: @task.start_time, state: @task.state, user_id: @task.user_id }
- end
-
- assert_redirected_to task_path(assigns(:task))
- end
-
- test "should show task" do
- get :show, id: @task
- assert_response :success
- end
-
- test "should get edit" do
- get :edit, id: @task
- assert_response :success
- end
-
- test "should update task" do
- put :update, id: @task, task: { content: @task.content, end_time: @task.end_time, start_time: @task.start_time, state: @task.state, user_id: @task.user_id }
- assert_redirected_to task_path(assigns(:task))
- end
-
- test "should destroy task" do
- assert_difference('Task.count', -1) do
- delete :destroy, id: @task
- end
-
- assert_redirected_to tasks_path
- end
-end
View
49 test/functional/users_controller_test.rb
@@ -1,49 +0,0 @@
-require 'test_helper'
-
-class UsersControllerTest < ActionController::TestCase
- setup do
- @user = users(:one)
- end
-
- test "should get index" do
- get :index
- assert_response :success
- assert_not_nil assigns(:users)
- end
-
- test "should get new" do
- get :new
- assert_response :success
- end
-
- test "should create user" do
- assert_difference('User.count') do
- post :create, user: { image: @user.image, name: @user.name }
- end
-
- assert_redirected_to user_path(assigns(:user))
- end
-
- test "should show user" do
- get :show, id: @user
- assert_response :success
- end
-
- test "should get edit" do
- get :edit, id: @user
- assert_response :success
- end
-
- test "should update user" do
- put :update, id: @user, user: { image: @user.image, name: @user.name }
- assert_redirected_to user_path(assigns(:user))
- end
-
- test "should destroy user" do
- assert_difference('User.count', -1) do
- delete :destroy, id: @user
- end
-
- assert_redirected_to users_path
- end
-end
View
0  test/integration/.gitkeep
No changes.
View
12 test/performance/browsing_test.rb
@@ -1,12 +0,0 @@
-require 'test_helper'
-require 'rails/performance_test_help'
-
-class BrowsingTest < ActionDispatch::PerformanceTest
- # Refer to the documentation for all available options
- # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
- # :output => 'tmp/performance', :formats => [:flat] }
-
- def test_homepage
- get '/'
- end
-end
View
13 test/test_helper.rb
@@ -1,13 +0,0 @@
-ENV["RAILS_ENV"] = "test"
-require File.expand_path('../../config/environment', __FILE__)
-require 'rails/test_help'
-
-class ActiveSupport::TestCase
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
- #
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
- # -- they do not yet inherit this setting
- fixtures :all
-
- # Add more helper methods to be used by all tests here...
-end
View
0  test/unit/.gitkeep
No changes.
View
7 test/unit/activity_test.rb
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class CommentTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end
View
7 test/unit/authentication_test.rb
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class AuthenticationTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end
View
4 test/unit/helpers/activities_helper_test.rb
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class CommentsHelperTest < ActionView::TestCase
-end
View
4 test/unit/helpers/joins_helper_test.rb
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class JoinsHelperTest < ActionView::TestCase
-end
View
4 test/unit/helpers/parties_helper_test.rb
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class PartiesHelperTest < ActionView::TestCase
-end
View
4 test/unit/helpers/sessions_helper_test.rb
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class SessionsHelperTest < ActionView::TestCase
-end
View
4 test/unit/helpers/settings_helper_test.rb
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class SettingsHelperTest < ActionView::TestCase
-end
View
4 test/unit/helpers/tasks_helper_test.rb
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class TasksHelperTest < ActionView::TestCase
-end
View
4 test/unit/helpers/users_helper_test.rb
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class UsersHelperTest < ActionView::TestCase
-end
View
7 test/unit/join_test.rb
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class JoinTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end
View
7 test/unit/party_test.rb
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class PartyTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end
View
7 test/unit/task_test.rb
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class TaskTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end
View
7 test/unit/user_test.rb
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class UserTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.