diff --git a/Gemfile b/Gemfile
index 805ee6e..6bf280e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -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
diff --git a/Gemfile.lock b/Gemfile.lock
index a198459..d088e9b 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
diff --git a/README.md b/README.md
index 77a04fd..2156565 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/app/assets/javascripts/projects.js.coffee b/app/assets/javascripts/projects.js.coffee
new file mode 100644
index 0000000..24f83d1
--- /dev/null
+++ b/app/assets/javascripts/projects.js.coffee
@@ -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/
diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss
new file mode 100644
index 0000000..d019266
--- /dev/null
+++ b/app/assets/stylesheets/projects.css.scss
@@ -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/
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
new file mode 100644
index 0000000..7daa6a6
--- /dev/null
+++ b/app/controllers/projects_controller.rb
@@ -0,0 +1,5 @@
+class ProjectsController < ApplicationController
+ def index
+ @projects = Project.all
+ end
+end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
new file mode 100644
index 0000000..db5c5ce
--- /dev/null
+++ b/app/helpers/projects_helper.rb
@@ -0,0 +1,2 @@
+module ProjectsHelper
+end
diff --git a/app/models/comment.rb b/app/models/comment.rb
new file mode 100644
index 0000000..edb397e
--- /dev/null
+++ b/app/models/comment.rb
@@ -0,0 +1,3 @@
+class Comment < ActiveRecord::Base
+ belongs_to :commentable, polymorphic: true
+end
diff --git a/app/models/project.rb b/app/models/project.rb
new file mode 100644
index 0000000..5bc7957
--- /dev/null
+++ b/app/models/project.rb
@@ -0,0 +1,2 @@
+class Project < ActiveRecord::Base
+end
diff --git a/app/models/task.rb b/app/models/task.rb
new file mode 100644
index 0000000..5c58542
--- /dev/null
+++ b/app/models/task.rb
@@ -0,0 +1,3 @@
+class Task < ActiveRecord::Base
+ belongs_to :user
+end
diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb
new file mode 100644
index 0000000..99e19e3
--- /dev/null
+++ b/app/views/projects/_project.html.erb
@@ -0,0 +1,3 @@
+<%= div_for project do %>
+
<%= project.name %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb
new file mode 100644
index 0000000..33236d7
--- /dev/null
+++ b/app/views/projects/index.html.erb
@@ -0,0 +1 @@
+<%= render @projects %>
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index c5eab7f..88127f3 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -3,6 +3,14 @@
resources :contacts
+ resources :projects do
+ resources :tasks
+ end
+
+ resources :tasks do
+ resources :comments
+ end
+
resources :settings
root to: "contacts#index"
diff --git a/db/migrate/20140724041417_create_projects.rb b/db/migrate/20140724041417_create_projects.rb
new file mode 100644
index 0000000..8c93aba
--- /dev/null
+++ b/db/migrate/20140724041417_create_projects.rb
@@ -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
diff --git a/db/migrate/20140724041707_create_tasks.rb b/db/migrate/20140724041707_create_tasks.rb
new file mode 100644
index 0000000..8d1207f
--- /dev/null
+++ b/db/migrate/20140724041707_create_tasks.rb
@@ -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
diff --git a/db/migrate/20140724041728_create_comments.rb b/db/migrate/20140724041728_create_comments.rb
new file mode 100644
index 0000000..f1f328f
--- /dev/null
+++ b/db/migrate/20140724041728_create_comments.rb
@@ -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
diff --git a/db/schema.rb b/db/schema.rb
index 3010b2d..deb8dac 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -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"
@@ -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"
@@ -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
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
new file mode 100644
index 0000000..39bd44f
--- /dev/null
+++ b/spec/controllers/projects_controller_spec.rb
@@ -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
diff --git a/spec/features/application_layout_spec.rb b/spec/features/application_layout_spec.rb
new file mode 100644
index 0000000..dc1d2d5
--- /dev/null
+++ b/spec/features/application_layout_spec.rb
@@ -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
\ No newline at end of file
diff --git a/spec/features/projects_management_spec.rb b/spec/features/projects_management_spec.rb
new file mode 100644
index 0000000..8b232a5
--- /dev/null
+++ b/spec/features/projects_management_spec.rb
@@ -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
\ No newline at end of file
diff --git a/spec/fixtures/projects.yml b/spec/fixtures/projects.yml
new file mode 100644
index 0000000..5f43d11
--- /dev/null
+++ b/spec/fixtures/projects.yml
@@ -0,0 +1,3 @@
+project_1:
+ name: "Test Project"
+ description: "Project used for the test suite"
\ No newline at end of file
diff --git a/spec/fixtures/tasks.yml b/spec/fixtures/tasks.yml
new file mode 100644
index 0000000..46c14df
--- /dev/null
+++ b/spec/fixtures/tasks.yml
@@ -0,0 +1,7 @@
+task_1:
+ name: "Test Task"
+ project: project_1
+
+task_2:
+ name: "Test task 2"
+ project: project_1
\ No newline at end of file
diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb
new file mode 100644
index 0000000..74b7b91
--- /dev/null
+++ b/spec/helpers/projects_helper_spec.rb
@@ -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
diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb
new file mode 100644
index 0000000..16c4a46
--- /dev/null
+++ b/spec/models/comment_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe Comment, :type => :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
new file mode 100644
index 0000000..cd90eec
--- /dev/null
+++ b/spec/models/project_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe Project, :type => :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/task_spec.rb b/spec/models/task_spec.rb
new file mode 100644
index 0000000..2c17e87
--- /dev/null
+++ b/spec/models/task_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe Task, :type => :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end