Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/project management #4

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.2'
gem 'rails', '4.1.4'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
Expand Down
56 changes: 28 additions & 28 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.2)
actionpack (= 4.1.2)
actionview (= 4.1.2)
actionmailer (4.1.4)
actionpack (= 4.1.4)
actionview (= 4.1.4)
mail (~> 2.5.4)
actionpack (4.1.2)
actionview (= 4.1.2)
activesupport (= 4.1.2)
actionpack (4.1.4)
actionview (= 4.1.4)
activesupport (= 4.1.4)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
actionview (4.1.2)
activesupport (= 4.1.2)
actionview (4.1.4)
activesupport (= 4.1.4)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.2)
activesupport (= 4.1.2)
activemodel (4.1.4)
activesupport (= 4.1.4)
builder (~> 3.1)
activerecord (4.1.2)
activemodel (= 4.1.2)
activesupport (= 4.1.2)
activerecord (4.1.4)
activemodel (= 4.1.4)
activesupport (= 4.1.4)
arel (~> 5.0.0)
activesupport (4.1.2)
activesupport (4.1.4)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
Expand Down Expand Up @@ -96,7 +96,7 @@ GEM
posix-spawn (~> 0.3.6)
hike (1.2.3)
hirb (0.7.2)
i18n (0.6.9)
i18n (0.6.11)
jbuilder (2.1.1)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
Expand All @@ -110,7 +110,7 @@ GEM
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.6.0)
minitest (5.3.5)
minitest (5.4.0)
monetize (0.3.0)
money (~> 6.1.0.beta1)
money (6.1.1)
Expand Down Expand Up @@ -154,19 +154,19 @@ GEM
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.1.2)
actionmailer (= 4.1.2)
actionpack (= 4.1.2)
actionview (= 4.1.2)
activemodel (= 4.1.2)
activerecord (= 4.1.2)
activesupport (= 4.1.2)
rails (4.1.4)
actionmailer (= 4.1.4)
actionpack (= 4.1.4)
actionview (= 4.1.4)
activemodel (= 4.1.4)
activerecord (= 4.1.4)
activesupport (= 4.1.4)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.2)
railties (= 4.1.4)
sprockets-rails (~> 2.0)
railties (4.1.2)
actionpack (= 4.1.2)
activesupport (= 4.1.2)
railties (4.1.4)
actionpack (= 4.1.4)
activesupport (= 4.1.4)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.3.2)
Expand Down Expand Up @@ -246,7 +246,7 @@ DEPENDENCIES
pg
pry-byebug
quiet_assets
rails (= 4.1.2)
rails (= 4.1.4)
rspec-rails (~> 3.0.0)
sass-rails (~> 4.0.3)
sdoc (~> 0.4.0)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
paymii
======

[ ![Codeship Status for codemy/paymii](https://codeship.io/projects/a8cff080-f523-0131-fff6-126686c2871f/status)](https://codeship.io/projects/28254)

Invoicing Application used as a demo for Rails from Scratch Course
3 changes: 3 additions & 0 deletions app/assets/javascripts/projects.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/projects.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the projects controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
5 changes: 5 additions & 0 deletions app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ProjectsController < ApplicationController
def index
@projects = Project.all
end
end
2 changes: 2 additions & 0 deletions app/helpers/projects_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module ProjectsHelper
end
3 changes: 3 additions & 0 deletions app/models/comment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Comment < ActiveRecord::Base
belongs_to :commentable, polymorphic: true
end
2 changes: 2 additions & 0 deletions app/models/project.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Project < ActiveRecord::Base
end
3 changes: 3 additions & 0 deletions app/models/task.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Task < ActiveRecord::Base
belongs_to :user
end
3 changes: 3 additions & 0 deletions app/views/projects/_project.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= div_for project do %>
<h2><%= project.name %></h2>
<% end %>
1 change: 1 addition & 0 deletions app/views/projects/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= render @projects %>
8 changes: 8 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

resources :contacts

resources :projects do
resources :tasks
end

resources :tasks do
resources :comments
end

resources :settings

root to: "contacts#index"
Expand Down
10 changes: 10 additions & 0 deletions db/migrate/20140724041417_create_projects.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateProjects < ActiveRecord::Migration
def change
create_table :projects do |t|
t.string :name
t.string :description

t.timestamps
end
end
end
11 changes: 11 additions & 0 deletions db/migrate/20140724041707_create_tasks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class CreateTasks < ActiveRecord::Migration
def change
create_table :tasks do |t|
t.text :name
t.references :user, index: true
t.references :project

t.timestamps
end
end
end
10 changes: 10 additions & 0 deletions db/migrate/20140724041728_create_comments.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.text :body
t.references :commentable, index: true, polymorphic: true

t.timestamps
end
end
end
29 changes: 28 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20140703173037) do
ActiveRecord::Schema.define(version: 20140724041728) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
enable_extension "hstore"

create_table "comments", force: true do |t|
t.text "body"
t.integer "commentable_id"
t.string "commentable_type"
t.datetime "created_at"
t.datetime "updated_at"
end

add_index "comments", ["commentable_id", "commentable_type"], name: "index_comments_on_commentable_id_and_commentable_type", using: :btree

create_table "configurables", force: true do |t|
t.string "name"
t.string "slug"
Expand Down Expand Up @@ -56,6 +66,13 @@

add_index "line_items", ["invoice_id"], name: "index_line_items_on_invoice_id", using: :btree

create_table "projects", force: true do |t|
t.string "name"
t.string "description"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "settings", force: true do |t|
t.string "company"
t.text "address"
Expand All @@ -69,6 +86,16 @@
t.hstore "invoice", default: {}
end

create_table "tasks", force: true do |t|
t.text "name"
t.integer "user_id"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
end

add_index "tasks", ["user_id"], name: "index_tasks_on_user_id", using: :btree

create_table "users", force: true do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
Expand Down
14 changes: 14 additions & 0 deletions spec/controllers/projects_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'rails_helper'

RSpec.describe ProjectsController, :type => :controller do
fixtures :projects

let(:project) { projects(:project_1) }

describe "GET index" do
it "should be success" do
get :index
expect(response.status).to eq(200)
end
end
end
15 changes: 15 additions & 0 deletions spec/features/application_layout_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'rails_helper'

feature "Application layout" do

scenario "User should see main nav" do
visit root_path

expect(page).to have_text("Contacts")
expect(page).to have_text("Invoices")
expect(page).to have_text("Projects")
expect(page).to have_text("Team")
expect(page).to have_text("Settings")
end

end
13 changes: 13 additions & 0 deletions spec/features/projects_management_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'rails_helper'

feature "Project Management" do
fixtures :projects

let(:project) { projects(:project_1) }

scenario "Project list" do
visit projects_path

expect(page).to have_content(project.name)
end
end
3 changes: 3 additions & 0 deletions spec/fixtures/projects.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
project_1:
name: "Test Project"
description: "Project used for the test suite"
7 changes: 7 additions & 0 deletions spec/fixtures/tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
task_1:
name: "Test Task"
project: project_1

task_2:
name: "Test task 2"
project: project_1
15 changes: 15 additions & 0 deletions spec/helpers/projects_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'rails_helper'

# Specs in this file have access to a helper object that includes
# the ProjectsHelper. For example:
#
# describe ProjectsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe ProjectsHelper, :type => :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
5 changes: 5 additions & 0 deletions spec/models/comment_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe Comment, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end
5 changes: 5 additions & 0 deletions spec/models/project_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe Project, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end
5 changes: 5 additions & 0 deletions spec/models/task_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe Task, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end