Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

get cukes passing

  • Loading branch information...
commit 635479890b9a81d084ce1109896e2ba6a18e8d07 1 parent dda28a7
@21echoes authored
View
2  app/controllers/blog_controller.rb
@@ -3,7 +3,7 @@ class BlogController < ApplicationController
# GET /posts
# GET /posts.xml
def index
- @project = Project.find_by_name('Life')
+ @project = Project.find_or_create_by_name('Life')
@posts = @project.posts
respond_to do |format|
View
1  app/controllers/posts_controller.rb
@@ -28,6 +28,7 @@ def show
# GET /posts/new.xml
def new
@post = Post.new
+ @post.project_id = params[:project_id] if params[:project_id]
respond_to do |format|
format.html # new.html.erb
View
4 app/views/blog/index.html.erb
@@ -1,3 +1,3 @@
-<%= render 'posts/list', :locals => {:posts => @posts, :context => 'posts'} %>
+<%= render :partial => 'posts/list', :locals => {:posts => @posts, :context => 'posts'} %>
-<%= render 'posts/new_post_button', :locals => {:context => 'posts'} %>
+<%= render :partial => 'posts/new_post_button', :locals => {:context => 'posts', :project => @project} %>
View
4 app/views/posts/_list.html.erb
@@ -3,7 +3,7 @@
<ul class='post-list'>
<% @posts.each do |post| %>
<li>
- <%= render :partial => 'posts/post', :locals => {:post => post, :context => @context} %>
+ <%= render :partial => 'posts/post', :locals => {:post => post, :context => context} %>
</li>
<div class='splitter'>---=---</div>
<% end %>
@@ -14,7 +14,7 @@
<%= render :partial => 'shared/search', :locals => {:context => 'posts'} %>
</div>
<%=h will_paginate @posts, :previous_label => '', :next_label => '' %>
-<% elsif @context == 'project' %>
+<% elsif context == 'project' %>
<% if @project.posts and @project.posts.size > 0 %>
<p>
No matching updates were found!
View
4 app/views/posts/_new_post_button.html.erb
@@ -1,4 +1,4 @@
<% if can? :create, Post %>
- <!-- TODO:you're blocked on preselecting the project in new_post_path. once that's resolved, you can preselect Blog, and when you render you can check what's preselected, and alter the form accordingly -->
- <%= link_to 'New Post', new_post_path %>
+ <% parameters = @project ? {:project_id => @project.id} : {} %>
+ <%= link_to 'New Post', new_post_path(parameters) %>
<% end %>
View
2  app/views/posts/edit.html.erb
@@ -1,6 +1,6 @@
<h2>Editing post</h2>
-<%= render 'form' %>
+<%= render :partial => 'form' %>
<%= link_to 'Show', @post %> |
<%= link_to 'Back', posts_path %>
View
4 app/views/posts/index.html.erb
@@ -1,3 +1,3 @@
-<%= render 'posts/list', :locals => {:posts => @posts, :context => 'posts'} %>
+<%= render :partial => 'posts/list', :locals => {:posts => @posts, :context => 'posts'} %>
-<%= render 'posts/new_post_button', :locals => {:context => 'posts'} %>
+<%= render :partial => 'posts/new_post_button', :locals => {:context => 'posts'} %>
View
2  app/views/posts/new.html.erb
@@ -1,5 +1,5 @@
<h2>New post</h2>
-<%= render 'form' %>
+<%= render :partial => 'form' %>
<%= link_to 'Back', posts_path %>
View
2  app/views/projects/edit.html.erb
@@ -1,6 +1,6 @@
<h2>Editing project</h2>
-<%= render 'form' %>
+<%= render :partial => 'form' %>
<%= link_to 'Show', @project %> |
<%= link_to 'Back', projects_path %>
View
2  app/views/projects/new.html.erb
@@ -1,5 +1,5 @@
<h2>New project</h2>
-<%= render 'form' %>
+<%= render :partial => 'form' %>
<%= link_to 'Back', projects_path %>
View
2  app/views/projects/show.html.erb
@@ -4,6 +4,6 @@
<div class='splitter'>---=-+++-=---</div>
-<%= render :partial => 'posts/list', :locals => {:posts => @posts, :context => 'project' } %>
+<%= render :partial => 'posts/list', :locals => {:posts => @posts, :context => 'project'} %>
<%= render :partial => 'comments/disqus_thread', :locals => {:id => "project-#{@project.id}"} %>
View
4 db/seeds.rb
@@ -6,4 +6,6 @@
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name => 'Daley', :city => cities.first)
-admin = User.create(:email => 'david.b.kettler@gmail.com', :password => 'asdfjkl;', :admin => true)
+admin = User.create(:email => 'david.b.kettler@gmail.com', :password => 'asdfjkl;', :admin => true)
+
+blog = Project.create(:name => 'Life', :summary => 'A lot of stuff happens. Sometimes you can make some sense of it.')
View
6 features/administration/cant_manage_posts_or_projects.feature
@@ -1,6 +1,6 @@
#TODO(dk): test drive people being able to create projects but not edit/delete... approve users/projects first?
@wip
-Feature: Management Access for a normal user
+Feature: Management Access for non-admins
In order to maintain a portfolio site
As the administrator of the portfolio site
I want to make sure no one else can manage my content
@@ -25,4 +25,6 @@ Scenario: Cannot Hack to Creating Posts
Then I should not see "New post"
And I should see "not authorized"
-# TODO: no editing, deleting
+# TODO: no editing, deleting
+
+Scenario: Can
View
28 features/administration/create_posts.feature
@@ -0,0 +1,28 @@
+Feature: Create Posts
+ In order to describe activity on a project
+ As a designer/developer who works on the project
+ I want to create and manage updates about the project
+
+Background:
+ Given I am not an admin
+ And a project exists
+
+Scenario: Create Post
+ Given I am on the posts page
+ When I follow "New Post"
+ And I fill in "Name" with "App v1"
+ And I select "Release" from "Stage"
+ And I fill in "Summary" with "Releasing an app here, boss"
+ And I fill in "More" with "Nothing to see here, soldier"
+ And I press "Create"
+ Then a post should exist
+ And I should see "Post was successfully created."
+ And I should see "App v1"
+ And I should see "Release"
+ And I should see "Releasing an app here, boss"
+ And I should see "Nothing to see here, soldier"
+
+Scenario: Make a Post from Project page
+ Given I am on the project's page
+ When I follow "New Post"
+ Then I should be on the page "/posts/new"
View
22 features/administration/create_projects.feature
@@ -0,0 +1,22 @@
+Feature: Create Projects
+ In order to make a portfolio site
+ As the administrator of the portfolio site
+ I want to create and manage projects
+
+Background:
+ Given I am not an admin
+
+Scenario: Create Project
+ Given I am on the projects page
+ When I follow "New Project"
+ And I fill in "Name" with "Site"
+ And I select "Prototype" from "Stage"
+ And I fill in "Repository" with "http://github.com/21echoes/a-site"
+ And I fill in "Public URL" with "www.asite.com"
+ And I press "Create"
+ Then a project should exist
+ And I should see "Project was successfully created."
+ And I should see "Site"
+ And I should see "Prototype"
+ And I should see "http://github.com/21echoes/a-site"
+ And I should see "www.asite.com"
View
34 features/administration/manage_posts.feature
@@ -6,23 +6,23 @@ Feature: Manage Posts
Background:
Given I am an admin
And a project exists
+ And a post exists with project: the project
-Scenario: Create Post
- Given I am on the posts page
- When I follow "New Post"
- And I fill in "Name" with "App v1"
- And I select "Release" from "Stage"
- And I fill in "Summary" with "Releasing an app here, boss"
- And I fill in "More" with "Nothing to see here, soldier"
- And I press "Create"
- Then a post should exist
- And I should see "Post was successfully created."
- And I should see "App v1"
- And I should see "Release"
- And I should see "Releasing an app here, boss"
- And I should see "Nothing to see here, soldier"
+Scenario: Edit Post
+ Given I am on the post's page
+ When I follow "Edit"
+ And I fill in "Name" with "App v0.1"
+ And I select "Prototype" from "Stage"
+ And I fill in "Summary" with "Releasing a prototype here, boss"
+ And I fill in "More" with "Everything to see here, soldier"
+ And I press "Update"
+ Then I should see "Post was successfully updated."
+ And I should see "App v0.1"
+ And I should see "Prototype"
+ And I should see "Releasing a prototype here, boss"
+ And I should see "Everything to see here, soldier"
-Scenario: Make a Post from Project page
+Scenario: Edit Post from Project page
Given I am on the project's page
- When I follow "New Post"
- Then I should be on the page "/posts/new"
+ When I follow "Edit" within ".post-item"
+ Then I should be on the page "/posts/1/edit"
View
27 features/administration/manage_projects.feature
@@ -5,20 +5,21 @@ Feature: Manage Projects
Background:
Given I am an admin
+ And a project exists
Scenario: Create Project
- Given I am on the projects page
- When I follow "New Project"
- And I fill in "Name" with "Site"
- And I select "Prototype" from "Stage"
- And I fill in "Repository" with "http://github.com/21echoes/a-site"
- And I fill in "Public URL" with "www.asite.com"
- And I press "Create"
+ Given I am on the project's page
+ When I follow "Edit"
+ And I fill in "Name" with "Website"
+ And I select "Release" from "Stage"
+ And I fill in "Repository" with "http://github.com/21echoes/a-website"
+ And I fill in "Public URL" with "www.awebsite.com"
+ And I press "Update"
Then a project should exist
- And I should see "Project was successfully created."
- And I should see "Site"
- And I should see "Prototype"
- And I should see "http://github.com/21echoes/a-site"
- And I should see "www.asite.com"
+ And I should see "Project was successfully updated."
+ And I should see "Website"
+ And I should see "Release"
+ And I should see "http://github.com/21echoes/a-website"
+ And I should see "www.awebsite.com"
-# TODO: can edit, delete
+# TODO: can delete
View
5 features/blog/project-less_posts.feature
@@ -1,4 +1,5 @@
-Feature: Manage Posts
+@wip
+Feature: A blog is a special project without stages
In order to talk about my day to day life
As a person
I want to create and manage a blog
@@ -23,7 +24,7 @@ Scenario: Create Blog Post
Scenario: No cross-contamination
Given a project exists
And a post exists with project: the project, name: "An Update"
- And a post exists with name: "My Day"
+ And a post exists with project: blog, name: "My Day"
When I go to the blog page
Then I should see "My Day"
View
4 features/step_definitions/debug_steps.rb
@@ -0,0 +1,4 @@
+When 'I debug' do
+ debugger
+ true
+end
View
1  features/step_definitions/project_steps.rb
@@ -1 +0,0 @@
-
View
2  features/versions.feature
@@ -1,3 +1,4 @@
+@wip
Feature: versions
In order to organize the progress of a project
As a developer
@@ -21,7 +22,6 @@ Scenario: Choose existing version
And I should see "Public Beta" in "Version"
@javascript
-@focus
Scenario: new version
Given I am on the posts page
When I follow "New Post"
Please sign in to comment.
Something went wrong with that request. Please try again.