Skip to content
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
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ gem 'omniauth-soundcloud', '~> 1.0.0'
gem 'omniauth-live_connect'
gem 'omniauth-yahoo', '~> 0.0.5'
gem "pundit"
gem "rspec"
gem "rspec-core"
gem "rspec-rails"
gem "guard-rspec"
gem 'spring-commands-rspec'

# support for pg
gem 'pg'
Expand Down
57 changes: 57 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ GEM
bootstrap-sass (3.2.0.1)
sass (~> 3.2)
builder (3.2.2)
celluloid (0.15.2)
timers (~> 1.1.0)
coderay (1.1.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
Expand All @@ -48,12 +51,24 @@ GEM
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
diff-lcs (1.2.5)
erubis (2.7.0)
execjs (2.2.1)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
ffi (1.9.3)
font-awesome-sass (4.1.0)
sass (~> 3.2)
formatador (0.2.5)
guard (2.6.1)
formatador (>= 0.2.4)
listen (~> 2.7)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
guard-rspec (4.3.1)
guard (~> 2.1)
rspec (>= 2.14, < 4.0)
hashie (3.3.1)
hike (1.2.3)
i18n (0.6.11)
Expand All @@ -66,9 +81,15 @@ GEM
json (1.8.1)
jwt (1.0.0)
libv8 (3.16.14.3)
listen (2.7.9)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.9)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.8.2)
mime-types (1.25.1)
minitest (5.4.0)
multi_json (1.10.1)
Expand Down Expand Up @@ -108,6 +129,10 @@ GEM
orm_adapter (0.5.0)
pg (0.17.1)
polyglot (0.3.5)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pundit (0.3.0)
activesupport (>= 3.0.0)
rack (1.5.2)
Expand All @@ -129,9 +154,32 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.3.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rdoc (4.1.1)
json (~> 1.4)
ref (1.0.5)
rspec (3.0.0)
rspec-core (~> 3.0.0)
rspec-expectations (~> 3.0.0)
rspec-mocks (~> 3.0.0)
rspec-core (3.0.4)
rspec-support (~> 3.0.0)
rspec-expectations (3.0.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.0.0)
rspec-mocks (3.0.4)
rspec-support (~> 3.0.0)
rspec-rails (3.0.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.0.0)
rspec-expectations (~> 3.0.0)
rspec-mocks (~> 3.0.0)
rspec-support (~> 3.0.0)
rspec-support (3.0.4)
sass (3.2.19)
sass-rails (4.0.3)
railties (>= 4.0.0, < 5.0)
Expand All @@ -141,7 +189,10 @@ GEM
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
slop (3.6.0)
spring (1.1.3)
spring-commands-rspec (1.0.2)
spring (>= 0.9.1)
sprockets (2.11.0)
hike (~> 1.2)
multi_json (~> 1.0)
Expand All @@ -158,6 +209,7 @@ GEM
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timers (1.1.0)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
Expand All @@ -182,6 +234,7 @@ DEPENDENCIES
devise
execjs
font-awesome-sass
guard-rspec
hashie (~> 3.3.1)
jbuilder (~> 2.0)
jquery-rails
Expand All @@ -195,9 +248,13 @@ DEPENDENCIES
pg
pundit
rails (= 4.1.4)
rspec
rspec-core
rspec-rails
sass-rails (~> 4.0.3)
sdoc (~> 0.4.0)
spring
spring-commands-rspec
sqlite3
therubyracer
turbolinks
Expand Down
30 changes: 30 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Note: The cmd option is now required due to the increasing number of ways
# rspec may be run, below are examples of the most common uses.
# * bundler: 'bundle exec rspec'
# * bundler binstubs: 'bin/rspec'
# * spring: 'bin/rsspec' (This will use spring if running and you have
# installed the spring binstubs per the docs)
# * zeus: 'zeus rspec' (requires the server to be started separetly)
# * 'just' rspec: 'rspec'
guard :rspec, cmd: 'bundle exec rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }

# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
watch('spec/rails_helper.rb') { "spec" }

# Capybara features specs
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }

# Turnip features and steps
watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
end

4 changes: 4 additions & 0 deletions app/models/comment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Comment < ActiveRecord::Base
belongs_to :user
belongs_to :link
end
5 changes: 5 additions & 0 deletions app/models/like.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Like < ActiveRecord::Base
belongs_to :user
belongs_to :comment
belongs_to :link
end
4 changes: 4 additions & 0 deletions app/models/message.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Message < ActiveRecord::Base
belongs_to :sender, :class_name => "User"
belongs_to :receiver, :class_name => "User"
end
7 changes: 7 additions & 0 deletions bin/rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
require 'bundler/setup'
load Gem.bin_path('rspec-core', 'rspec')
12 changes: 12 additions & 0 deletions db/migrate/20140904201612_create_comments.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.text :comment
t.datetime :when
t.belongs_to :user
t.belongs_to :link

t.timestamps
end
end
end
10 changes: 10 additions & 0 deletions db/migrate/20140904201944_create_likes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateLikes < ActiveRecord::Migration
def change
create_table :likes do |t|
t.belongs_to :user
t.belongs_to :comment, null: true
t.belongs_to :link, null: true
t.timestamps
end
end
end
12 changes: 12 additions & 0 deletions db/migrate/20140904203245_create_messages.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateMessages < ActiveRecord::Migration
def change
create_table :messages do |t|
t.string :name
t.text :content
t.belongs_to :sender, :class_name => "User"
t.belongs_to :receiver, :class_name => "User"

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

ActiveRecord::Schema.define(version: 20140830165824) do
ActiveRecord::Schema.define(version: 20140904203245) do

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

create_table "comments", force: true do |t|
t.text "comment"
t.datetime "when"
t.integer "user_id"
t.integer "link_id"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "identities", force: true do |t|
t.integer "user_id"
t.string "provider"
t.string "uid"
t.datetime "created_at"
t.datetime "updated_at"
end

add_index "identities", ["user_id"], name: "index_identities_on_user_id", using: :btree

create_table "likes", force: true do |t|
t.integer "user_id"
t.integer "comment_id"
t.integer "link_id"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "links", force: true do |t|
t.integer "user_id"
t.string "name"
Expand All @@ -41,6 +68,15 @@
t.datetime "updated_at"
end

create_table "messages", force: true do |t|
t.string "name"
t.text "content"
t.integer "sender_id"
t.integer "receiver_id"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "music_types", force: true do |t|
t.string "name"
t.datetime "created_at"
Expand All @@ -60,8 +96,14 @@
t.inet "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.string "name"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
end

add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree

Expand Down
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/like_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require 'rails_helper'

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

RSpec.describe Message, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end
43 changes: 43 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require 'spec_helper'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'

# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
# in _spec.rb will both be required and run as specs, causing the specs to be
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!

RSpec.configure do |config|
# 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

# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and
# `post` in specs under `spec/controllers`.
#
# You can disable this behaviour by removing the line below, and instead
# explicitly tag your specs with their type, e.g.:
#
# RSpec.describe UsersController, :type => :controller do
# # ...
# end
#
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!
end
Loading