Skip to content

Commit

Permalink
code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikechavo committed Sep 28, 2023
1 parent d9d1ee4 commit c47e598
Show file tree
Hide file tree
Showing 43 changed files with 3,883 additions and 6 deletions.
6 changes: 5 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ gem "devise", "~> 4.9"

gem 'devise-jwt'

gem 'rack-cors'
gem 'rack-cors'

group :development, :test do
gem 'simplecov', require: false
end
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ GEM
devise (~> 4.0)
warden-jwt_auth (~> 0.8)
diff-lcs (1.5.0)
docile (1.4.0)
dry-auto_inject (1.0.1)
dry-core (~> 1.0)
zeitwerk (~> 2.6)
Expand Down Expand Up @@ -204,6 +205,12 @@ GEM
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-support (3.12.1)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
Expand Down Expand Up @@ -255,6 +262,7 @@ DEPENDENCIES
rack-cors
rails (~> 7.0.8)
rspec-rails (~> 6.0)
simplecov
sprockets-rails
stimulus-rails
turbo-rails
Expand Down
14 changes: 12 additions & 2 deletions app/models/beer.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
class Beer < ApplicationRecord
has_many :reviews
has_many :users, through: :reviews

validates :name, :style, :abv, :description, :image_url, presence: true
validates :description, length: {minimum: 5}
end
validates :description, length: { minimum: 5 }

validates :abv, numericality: { greater_than_or_equal_to: 0 }

validates :image_url, format: {
with: URI.regexp, # This uses a regular expression to validate URL format
message: "should be a valid URL"
}

validates :name, uniqueness: true
end
9 changes: 8 additions & 1 deletion app/models/review.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
class Review < ApplicationRecord
belongs_to :beer
belongs_to :user

validates :city, :state, :review_text, :rating, :beer_id, :user_id, :username, presence: true
end

validates :rating, numericality: { only_integer: true, greater_than_or_equal_to: 1, less_than_or_equal_to: 5 }

validates :review_text, length: { minimum: 5, maximum: 1000 }

validates :username, format: { with: /\A[a-zA-Z0-9]+\z/, message: "can only contain letters and numbers" }
end
3 changes: 3 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
require "active_support/core_ext/integer/time"

require 'simplecov'
load "#{Rails.root}/spec/support/simplecov.rb"

# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
Expand Down
5 changes: 5 additions & 0 deletions coverage/.last_run.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"result": {
"line": 60.16
}
}
275 changes: 275 additions & 0 deletions coverage/.resultset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
{
"RSpec": {
"coverage": {
"/Users/learnacademy/Desktop/pintpal-backend/app/models/user.rb": {
"lines": [
1,
1,
1,
1,
null,
null,
1,
null,
null
]
},
"/Users/learnacademy/Desktop/pintpal-backend/app/models/application_record.rb": {
"lines": [
1,
1,
null
]
},
"/Users/learnacademy/Desktop/pintpal-backend/app/models/jwt_denylist.rb": {
"lines": [
1,
null
]
},
"/Users/learnacademy/Desktop/pintpal-backend/app/helpers/application_helper.rb": {
"lines": [
1,
null
]
},
"/Users/learnacademy/Desktop/pintpal-backend/app/helpers/beers_helper.rb": {
"lines": [
1,
null
]
},
"/Users/learnacademy/Desktop/pintpal-backend/app/helpers/reviews_helper.rb": {
"lines": [
1,
null
]
},
"/Users/learnacademy/Desktop/pintpal-backend/app/models/beer.rb": {
"lines": [
1,
1,
1,
null,
1,
1,
null,
1,
null,
1,
null,
null,
null,
null,
1,
null
]
},
"/Users/learnacademy/Desktop/pintpal-backend/app/models/review.rb": {
"lines": [
1,
1,
1,
null,
1,
null,
1,
null,
1,
null,
1,
null
]
},
"/Users/learnacademy/Desktop/pintpal-backend/app/controllers/beers_controller.rb": {
"lines": [
1,
1,
1,
1,
null,
null,
1,
1,
1,
null,
null,
1,
3,
3,
3,
3,
null,
0,
null,
null,
null,
1,
0,
0,
0,
0,
null,
0,
null,
null,
null,
1,
1,
1,
1,
null,
0,
null,
null,
null,
1,
null,
1,
3,
null,
null,
null
]
},
"/Users/learnacademy/Desktop/pintpal-backend/app/controllers/application_controller.rb": {
"lines": [
1,
1,
1,
null,
1,
null,
0,
null,
0,
null,
null
]
},
"/Users/learnacademy/Desktop/pintpal-backend/app/controllers/reviews_controller.rb": {
"lines": [
1,
1,
2,
2,
null,
null,
1,
0,
0,
null,
null,
1,
3,
3,
3,
null,
0,
null,
null,
null,
1,
1,
1,
1,
1,
null,
0,
null,
null,
null,
1,
1,
1,
1,
null,
0,
null,
null,
null,
1,
1,
4,
null,
null
]
},
"/Users/learnacademy/Desktop/pintpal-backend/app/channels/application_cable/channel.rb": {
"lines": [
0,
0,
0,
0
],
"branches": {
}
},
"/Users/learnacademy/Desktop/pintpal-backend/app/channels/application_cable/connection.rb": {
"lines": [
0,
0,
0,
0
],
"branches": {
}
},
"/Users/learnacademy/Desktop/pintpal-backend/app/controllers/users/registrations_controller.rb": {
"lines": [
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"branches": {
}
},
"/Users/learnacademy/Desktop/pintpal-backend/app/controllers/users/sessions_controller.rb": {
"lines": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"branches": {
}
},
"/Users/learnacademy/Desktop/pintpal-backend/app/jobs/application_job.rb": {
"lines": [
0,
null,
null,
null,
null,
null,
0
],
"branches": {
}
},
"/Users/learnacademy/Desktop/pintpal-backend/app/mailers/application_mailer.rb": {
"lines": [
0,
0,
0,
0
],
"branches": {
}
}
},
"timestamp": 1695850145
}
}
Empty file added coverage/.resultset.json.lock
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions coverage/assets/0.12.3/application.css

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions coverage/assets/0.12.3/application.js

Large diffs are not rendered by default.

Binary file added coverage/assets/0.12.3/colorbox/border.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coverage/assets/0.12.3/colorbox/controls.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coverage/assets/0.12.3/colorbox/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coverage/assets/0.12.3/favicon_green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coverage/assets/0.12.3/favicon_red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coverage/assets/0.12.3/favicon_yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added coverage/assets/0.12.3/loading.gif
Binary file added coverage/assets/0.12.3/magnify.png
Loading

0 comments on commit c47e598

Please sign in to comment.