Skip to content

Commit

Permalink
Remove shoulda-matchers dependency
Browse files Browse the repository at this point in the history
It was used very marginally, so not worth using it.
  • Loading branch information
deivid-rodriguez committed Oct 15, 2018
1 parent bc87f4e commit 7d7a95f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 20 deletions.
1 change: 0 additions & 1 deletion Gemfile.common
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ group :test do
gem 'rails-i18n' # Provides default i18n for many languages
gem 'rspec-rails'
gem 'i18n-spec'
gem 'shoulda-matchers', '<= 2.8.0'
gem 'sqlite3', platforms: :mri
gem 'selenium-webdriver'
end
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,6 @@ GEM
selenium-webdriver (3.14.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
Expand Down Expand Up @@ -435,7 +433,6 @@ DEPENDENCIES
rspec-rails
rubocop (= 0.59.2)
selenium-webdriver
shoulda-matchers (<= 2.8.0)
simplecov
sqlite3
yard
Expand Down
3 changes: 0 additions & 3 deletions gemfiles/rails_42.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,6 @@ GEM
selenium-webdriver (3.14.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
Expand Down Expand Up @@ -407,7 +405,6 @@ DEPENDENCIES
rspec-rails
rubocop (= 0.59.2)
selenium-webdriver
shoulda-matchers (<= 2.8.0)
simplecov
sqlite3
yard
Expand Down
3 changes: 0 additions & 3 deletions gemfiles/rails_50.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,6 @@ GEM
selenium-webdriver (3.14.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
Expand Down Expand Up @@ -421,7 +419,6 @@ DEPENDENCIES
rspec-rails
rubocop (= 0.59.2)
selenium-webdriver
shoulda-matchers (<= 2.8.0)
simplecov
sqlite3
yard
Expand Down
3 changes: 0 additions & 3 deletions gemfiles/rails_51.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,6 @@ GEM
selenium-webdriver (3.14.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
Expand Down Expand Up @@ -420,7 +418,6 @@ DEPENDENCIES
rspec-rails
rubocop (= 0.59.2)
selenium-webdriver
shoulda-matchers (<= 2.8.0)
simplecov
sqlite3
yard
Expand Down
29 changes: 22 additions & 7 deletions spec/unit/comments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,28 @@

let(:user) { User.create!(first_name: "John", last_name: "Doe") }

it "has valid Associations and Validations" do
expect(comment).to belong_to :resource
expect(comment).to belong_to :author
expect(comment).to validate_presence_of :resource
expect(comment).to validate_presence_of :body
expect(comment).to validate_presence_of :namespace
let(:post) { Post.create!(title: "Hello World") }

it "belongs to a resource" do
comment.assign_attributes(resource_type: "Post", resource_id: post.id)

expect(comment.resource).to eq(post)
end

it "belongs to an author" do
comment.assign_attributes(author_type: "User", author_id: user.id)

expect(comment.author).to eq(user)
end

it "needs a body" do
expect(comment).to_not be_valid
expect(comment.errors[:body]).to eq(["can't be blank"])
end

it "needs a namespace" do
expect(comment).to_not be_valid
expect(comment.errors[:namespace]).to eq(["can't be blank"])
end

it "needs a resource" do
Expand All @@ -22,7 +38,6 @@
end

describe ".find_for_resource_in_namespace" do
let(:post) { Post.create!(title: "Hello World") }
let(:namespace_name) { "admin" }

before do
Expand Down

0 comments on commit 7d7a95f

Please sign in to comment.