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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ gem 'paperclip', :git=> 'https://github.com/thoughtbot/paperclip', :ref => '523b
gem 'dotenv-rails'
gem 'gmaps4rails'
gem 'font-awesome-rails'
gem 'paranoia', :github => 'rubysherpas/paranoia', :branch => 'rails4'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
Expand Down
148 changes: 76 additions & 72 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
GIT
remote: git://github.com/rubysherpas/paranoia.git
revision: bd3383729c790bf09e488f84221eaaea27c6597e
branch: rails4
specs:
paranoia (2.2.0.alpha)
activerecord (>= 4.0, < 5.1)

GIT
remote: https://github.com/thoughtbot/paperclip
revision: 523bd46c768226893f23889079a7aa9c73b57d68
Expand All @@ -13,51 +21,51 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.0.rc1)
actionpack (= 5.0.0.rc1)
actioncable (5.0.0)
actionpack (= 5.0.0)
nio4r (~> 1.2)
websocket-driver (~> 0.6.1)
actionmailer (5.0.0.rc1)
actionpack (= 5.0.0.rc1)
actionview (= 5.0.0.rc1)
activejob (= 5.0.0.rc1)
actionmailer (5.0.0)
actionpack (= 5.0.0)
actionview (= 5.0.0)
activejob (= 5.0.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (5.0.0.rc1)
actionview (= 5.0.0.rc1)
activesupport (= 5.0.0.rc1)
rack (~> 2.x)
rails-dom-testing (~> 2.0)
actionpack (5.0.0)
actionview (= 5.0.0)
activesupport (= 5.0.0)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.0.rc1)
activesupport (= 5.0.0.rc1)
actionview (5.0.0)
activesupport (= 5.0.0)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (5.0.0.rc1)
activesupport (= 5.0.0.rc1)
activejob (5.0.0)
activesupport (= 5.0.0)
globalid (>= 0.3.6)
activemodel (5.0.0.rc1)
activesupport (= 5.0.0.rc1)
activerecord (5.0.0.rc1)
activemodel (= 5.0.0.rc1)
activesupport (= 5.0.0.rc1)
activemodel (5.0.0)
activesupport (= 5.0.0)
activerecord (5.0.0)
activemodel (= 5.0.0)
activesupport (= 5.0.0)
arel (~> 7.0)
activesupport (5.0.0.rc1)
activesupport (5.0.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.4.0)
arel (7.0.0)
aws-sdk (2.3.14)
aws-sdk-resources (= 2.3.14)
aws-sdk-core (2.3.14)
aws-sdk (2.3.19)
aws-sdk-resources (= 2.3.19)
aws-sdk-core (2.3.19)
jmespath (~> 1.0)
aws-sdk-resources (2.3.14)
aws-sdk-core (= 2.3.14)
aws-sdk-resources (2.3.19)
aws-sdk-core (= 2.3.19)
bcrypt (3.1.11)
builder (3.2.2)
byebug (9.0.5)
Expand All @@ -76,7 +84,7 @@ GEM
coffee-script-source (1.10.0)
concurrent-ruby (1.0.2)
debug_inspector (0.0.2)
devise (4.1.1)
devise (4.2.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 5.1)
Expand Down Expand Up @@ -108,8 +116,7 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
json_pure (1.8.3)
json_pure (2.0.1)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.4.1)
Expand Down Expand Up @@ -141,42 +148,38 @@ GEM
method_source (~> 0.8.1)
slop (~> 3.4)
puma (3.4.0)
rack (2.0.0.rc1)
json
rack (2.0.1)
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.0.rc1)
actioncable (= 5.0.0.rc1)
actionmailer (= 5.0.0.rc1)
actionpack (= 5.0.0.rc1)
actionview (= 5.0.0.rc1)
activejob (= 5.0.0.rc1)
activemodel (= 5.0.0.rc1)
activerecord (= 5.0.0.rc1)
activesupport (= 5.0.0.rc1)
rails (5.0.0)
actioncable (= 5.0.0)
actionmailer (= 5.0.0)
actionpack (= 5.0.0)
actionview (= 5.0.0)
activejob (= 5.0.0)
activemodel (= 5.0.0)
activerecord (= 5.0.0)
activesupport (= 5.0.0)
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.0.rc1)
railties (= 5.0.0)
sprockets-rails (>= 2.0.0)
rails-controller-testing (0.1.1)
actionpack (~> 5.x)
actionview (~> 5.x)
activesupport (~> 5.x)
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
rails-dom-testing (2.0.1)
activesupport (>= 4.2.0, < 6.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (5.0.0.rc1)
actionpack (= 5.0.0.rc1)
activesupport (= 5.0.0.rc1)
railties (5.0.0)
actionpack (= 5.0.0)
activesupport (= 5.0.0)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
Expand All @@ -186,50 +189,50 @@ GEM
ffi (>= 0.5.0)
responders (2.2.0)
railties (>= 4.2.0, < 5.1)
rollbar (2.11.5)
rollbar (2.12.0)
multi_json
rspec-core (3.5.0.beta4)
rspec-support (= 3.5.0.beta4)
rspec-expectations (3.5.0.beta4)
rspec-core (3.5.0)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (= 3.5.0.beta4)
rspec-mocks (3.5.0.beta4)
rspec-support (~> 3.5.0)
rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (= 3.5.0.beta4)
rspec-rails (3.5.0.beta4)
rspec-support (~> 3.5.0)
rspec-rails (3.5.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (= 3.5.0.beta4)
rspec-expectations (= 3.5.0.beta4)
rspec-mocks (= 3.5.0.beta4)
rspec-support (= 3.5.0.beta4)
rspec-support (3.5.0.beta4)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
sass (3.4.22)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
sass-rails (5.0.5)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
slop (3.6.0)
spring (1.7.1)
spring (1.7.2)
spring-watcher-listen (2.0.0)
listen (>= 2.7, < 4.0)
spring (~> 1.2)
sprockets (3.6.1)
sprockets (3.6.3)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.0.4)
sprockets-rails (3.1.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.5)
turbolinks (5.0.0.beta2)
turbolinks-source
turbolinks-source (5.0.0.beta5)
turbolinks (5.0.0)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.0)
Expand Down Expand Up @@ -262,6 +265,7 @@ DEPENDENCIES
letter_opener
listen (~> 3.0.5)
paperclip!
paranoia!
pg (~> 0.18)
pry
puma (~> 3.0)
Expand Down
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class User < ApplicationRecord
acts_as_paranoid
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :invitable, :database_authenticatable, :registerable,
Expand Down
6 changes: 6 additions & 0 deletions db/migrate/20160701195916_add_deleted_at_to_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddDeletedAtToUsers < ActiveRecord::Migration[5.0]
def change
add_column :users, :deleted_at, :datetime
add_index :users, :deleted_at
end
end
47 changes: 37 additions & 10 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,54 @@
require 'rails_helper'

RSpec.describe User, type: :model do

it "can be valid" do
user = User.new(
let(:user) do
User.new(
email: "[email protected]",
name: "Michael Jordan",
role: "admin",
password: "password",
password_confirmation: "password"
)
end

it "can be valid" do
expect(user).to be_valid
end

it "can be an admin" do
user = User.new(
email: "[email protected]",
name: "Michael Jordan",
role: "admin",
password: "password",
password_confirmation: "password"
)
expect(user.is_admin?).to be(true)
end

describe "#destroy" do
let(:a_user) do
User.new(
email: "[email protected]",
name: "Michael Jordan",
role: "researcher",
password: "password",
password_confirmation: "password"
)
end

before do
a_user.save
end

it "can be destroyed" do
a_user.destroy
expect(a_user.paranoia_destroyed?).to eq(true)
end

it "can be restored" do
a_user.restore
expect(a_user.paranoia_destroyed?).to eq(false)
end

it "can be REALLY destroyed" do
a_user.really_destroy!
expect(a_user.destroyed?).to eq(true)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at block body end.

end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra empty line detected at block body end.

end
end