<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,6 +5,7 @@ class UserStoriesController &lt; ApplicationController
 
   def create
     if @user_story.save
+      flash[:notice] = 'UserStory created'
       redirect_to user_story_path(@user_story, 'html')
     else
       flash[:error] = @user_story.errors.full_messages.join(&quot;; &quot;)</diff>
      <filename>app/controllers/user_stories_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,12 +6,17 @@ class UserStoriesControllerTest &lt; ActionController::TestCase
 
   # INDEX
 
-  test &quot;can open index&quot; do
+  test 'can open index' do
     get :index
     assert_response :success
   end
 
-  test &quot;can see UserStory&quot; do
+  test 'index renders view index' do
+    get :new
+    assert_template 'new'
+  end
+
+  test 'can see UserStory' do
     user_story = user_stories(:see_user_stories)
     get :index
     [:as_a, :i_want, :so_that].each do |attribute|
@@ -21,4 +26,66 @@ class UserStoriesControllerTest &lt; ActionController::TestCase
     end
   end
 
+  # NEW
+
+  test 'can open new' do
+    get :new
+    assert_response :success
+  end
+
+  test 'new renders view new' do
+    get :new
+    assert_template 'new'
+  end
+
+  # CREATE
+
+  test 'can call create' do
+    post :create, :user_story =&gt; { :as_a    =&gt; 'TestCase',
+                                   :i_want  =&gt; 'to create a UserStory',
+                                   :so_that =&gt; 'i can succeed'}
+    assert_response :redirect
+  end
+
+  test 'successfull create redirects to new UserStory' do
+    post :create, :user_story =&gt; { :as_a    =&gt; 'TestCase',
+                                   :i_want  =&gt; 'to create a UserStory',
+                                   :so_that =&gt; 'i can succeed'}
+    new_user_story = UserStory.first(:order =&gt; 'created_at DESC')
+    assert_redirected_to user_story_path(new_user_story, 'html')
+  end
+
+  test 'successfull create fills Flash' do
+    post :create, :user_story =&gt; { :as_a    =&gt; 'TestCase',
+                                   :i_want  =&gt; 'to see the flash filled on success',
+                                   :so_that =&gt; 'i can succeed'}
+    assert_equal 'UserStory created', flash[:notice]
+  end
+
+  test 'can create UserStory' do
+    count = UserStory.count
+    post :create, :user_story =&gt; { :as_a    =&gt; 'TestCase',
+                                   :i_want  =&gt; 'to create a UserStory',
+                                   :so_that =&gt; 'i can succeed'}
+    assert_equal count + 1, UserStory.count
+  end
+
+  test 'call renders view new when not valid data' do
+    post :create
+    assert_response :success
+    assert_template 'new'
+  end
+
+  test 'no UserStory created when not valid data' do
+    count = UserStory.count
+    post :create
+    assert_equal count, UserStory.count
+  end
+
+  test 'invalud creation fills flash' do
+    count = UserStory.count
+    post :create
+    assert_not_nil flash[:error]
+  end
+
 end</diff>
      <filename>test/functional/user_stories_controller_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>919cb5ad9c3ef85af629b4f3353b99559f70a5aa</id>
    </parent>
  </parents>
  <author>
    <name>Rainer Jung</name>
    <email>Rainer.Jung@gmail.com</email>
  </author>
  <url>http://github.com/rjung/scrum/commit/199be89e743f0161618b9920ef6e68f51082e42d</url>
  <id>199be89e743f0161618b9920ef6e68f51082e42d</id>
  <committed-date>2009-10-01T09:01:46-07:00</committed-date>
  <authored-date>2009-10-01T09:01:46-07:00</authored-date>
  <message>Added tests to UserStories controller</message>
  <tree>c14a9238386795d4dfdda8dba5b56829eaf4b2c8</tree>
  <committer>
    <name>Rainer Jung</name>
    <email>Rainer.Jung@gmail.com</email>
  </committer>
</commit>
