diff --git a/app/assets/javascripts/profiles.coffee b/app/assets/javascripts/profiles.coffee
new file mode 100644
index 00000000..24f83d18
--- /dev/null
+++ b/app/assets/javascripts/profiles.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/application.css.sass b/app/assets/stylesheets/application.css.sass
index 954b31a8..98dbf196 100644
--- a/app/assets/stylesheets/application.css.sass
+++ b/app/assets/stylesheets/application.css.sass
@@ -207,4 +207,9 @@ textarea
background: #00ff0060
border-radius: 0 0 0 79em
+.contain
+ width: 100%
+ max-width: 1200px
+ padding: 1em
+
@import doodads
diff --git a/app/assets/stylesheets/profiles.scss b/app/assets/stylesheets/profiles.scss
new file mode 100644
index 00000000..4d63f1a3
--- /dev/null
+++ b/app/assets/stylesheets/profiles.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the Profiles controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: https://sass-lang.com/
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 58347d6a..0fda6566 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base
before_action :get_footer_tokens
if (Rails.env.development? || Rails.env.test?)
- include Pundit
+ include Pundit::Authorization
after_action :verify_authorized, unless: -> { devise_controller? }
# after_action :verify_policy_scoped, only: :index
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb
new file mode 100644
index 00000000..c790f0a3
--- /dev/null
+++ b/app/controllers/profiles_controller.rb
@@ -0,0 +1,74 @@
+class ProfilesController < ApplicationController
+ before_action :set_profile, only: %i[ show edit update destroy ]
+
+ # GET /profiles or /profiles.json
+ def index
+ @profiles = policy_scope Profile.all
+ authorize @profiles
+ end
+
+ # GET /profiles/1 or /profiles/1.json
+ def show
+ authorize @profile
+ end
+
+ # GET /profiles/new
+ def new
+ authorize @profile = current_user.profiles.new
+ end
+
+ # GET /profiles/1/edit
+ def edit
+ authorize @profile
+ end
+
+ # POST /profiles or /profiles.json
+ def create
+ authorize @profile = Profile.new(profile_params)
+
+ respond_to do |format|
+ if @profile.save
+ format.html { redirect_to profile_url(@profile), notice: "Profile was successfully created." }
+ format.json { render :show, status: :created, location: @profile }
+ else
+ format.html { render :new, status: :unprocessable_entity }
+ format.json { render json: @profile.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PATCH/PUT /profiles/1 or /profiles/1.json
+ def update
+ authorize @profile
+ respond_to do |format|
+ if @profile.update(profile_params)
+ format.html { redirect_to profile_url(@profile), notice: "Profile was successfully updated." }
+ format.json { render :show, status: :ok, location: @profile }
+ else
+ format.html { render :edit, status: :unprocessable_entity }
+ format.json { render json: @profile.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /profiles/1 or /profiles/1.json
+ def destroy
+ @profile.destroy
+
+ respond_to do |format|
+ format.html { redirect_to profiles_url, notice: "Profile was successfully destroyed." }
+ format.json { head :no_content }
+ end
+ end
+
+ private
+ # Use callbacks to share common setup or constraints between actions.
+ def set_profile
+ @profile = Profile.find(params[:id])
+ end
+
+ # Only allow a list of trusted parameters through.
+ def profile_params
+ params.require(:profile).permit(:user_id, :name, :summary, :about)
+ end
+end
diff --git a/app/helpers/profiles_helper.rb b/app/helpers/profiles_helper.rb
new file mode 100644
index 00000000..4e430508
--- /dev/null
+++ b/app/helpers/profiles_helper.rb
@@ -0,0 +1,2 @@
+module ProfilesHelper
+end
diff --git a/app/models/profile.rb b/app/models/profile.rb
new file mode 100644
index 00000000..9e534f1e
--- /dev/null
+++ b/app/models/profile.rb
@@ -0,0 +1,3 @@
+class Profile < ActiveRecord::Base
+ belongs_to :user
+end
diff --git a/app/models/user.rb b/app/models/user.rb
index 0941e0b6..bd949a7c 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -6,6 +6,7 @@ class User < ActiveRecord::Base
has_many :canisters
has_many :doodads
has_many :projects
+ has_many :profiles
def icid
stp = SoftTokenPrincipal.where(soft_token: self.soft_token).first_or_initialize
diff --git a/app/policies/profile_policy.rb b/app/policies/profile_policy.rb
new file mode 100644
index 00000000..7b7b9b37
--- /dev/null
+++ b/app/policies/profile_policy.rb
@@ -0,0 +1,55 @@
+class ProfilePolicy
+ attr_reader :user, :model
+
+ def initialize(user, model)
+ @user = user || User.new
+ @profile = model
+ end
+
+ class Scope
+ def initialize(user, scope)
+ @user = user
+ @scope = scope
+ end
+
+ def resolve
+ if user.admin?
+ scope.all
+ else
+ scope.all
+ end
+ end
+
+ private
+
+ attr_reader :user, :scope
+ end
+
+ def index?
+ @user.admin? || true
+ end
+
+ def show?
+ @user.admin? || true
+ end
+
+ def new?
+ @user.signed_in?
+ end
+
+ def create?
+ @user.signed_in?
+ end
+
+ def edit?
+ update?
+ end
+
+ def update?
+ @user.admin? || @user == @profile.user
+ end
+
+ def destroy?
+ @user.admin? || @user == @profile.user
+ end
+end
diff --git a/app/views/layouts/_navigation_links.html.erb b/app/views/layouts/_navigation_links.html.erb
index 90e2af71..6f7cc08c 100644
--- a/app/views/layouts/_navigation_links.html.erb
+++ b/app/views/layouts/_navigation_links.html.erb
@@ -2,7 +2,7 @@
- <%= link_to 'Public', root_path, data: { turbo: false } %>
- <%= link_to 'Tokens', tokens_path %>
- - <%= link_to 'People', users_path %>
+ - <%= link_to 'People', profiles_path %>
- <%= link_to 'Projects', projects_path %>
- <%= link_to 'Doodads', doodads_path, data: { turbo: false } %>
<% if !request.base_url.match(/pin|my|fireside/) %>
diff --git a/app/views/profiles/_form.html.haml b/app/views/profiles/_form.html.haml
new file mode 100644
index 00000000..8889ad59
--- /dev/null
+++ b/app/views/profiles/_form.html.haml
@@ -0,0 +1,12 @@
+= simple_form_for(@profile) do |f|
+ = f.error_notification
+
+ .form-inputs
+ = f.hidden_field :user_id
+ = f.input :name
+ = f.label :summary
+ = f.input :summary, as: :string, label: false, input_html: { style: "width: 100%;"}
+ = f.input :about
+
+ .form-actions
+ = f.button :submit
diff --git a/app/views/profiles/_profile.json.jbuilder b/app/views/profiles/_profile.json.jbuilder
new file mode 100644
index 00000000..6fb72d37
--- /dev/null
+++ b/app/views/profiles/_profile.json.jbuilder
@@ -0,0 +1,2 @@
+json.extract! profile, :id, :user_id, :name, :summary, :about, :created_at, :updated_at
+json.url profile_url(profile, format: :json)
diff --git a/app/views/profiles/edit.html.haml b/app/views/profiles/edit.html.haml
new file mode 100644
index 00000000..33b36f0c
--- /dev/null
+++ b/app/views/profiles/edit.html.haml
@@ -0,0 +1,3 @@
+%h1 Editing profile
+
+= render 'form'
diff --git a/app/views/profiles/index.html.haml b/app/views/profiles/index.html.haml
new file mode 100644
index 00000000..800edd66
--- /dev/null
+++ b/app/views/profiles/index.html.haml
@@ -0,0 +1,31 @@
+%h1 Listing profiles
+
+%p
+ - if policy(Profile).new?
+ = link_to '+ New Profile', new_profile_path
+ - else
+ = link_to 'Sign In', new_user_session_path
+ to create a new Profile
+
+%table
+ %thead
+ %tr
+ -# %th User
+ %th Name
+ %th Summary
+ %th About
+ -# - if policy(Profile).destroy?
+ -# %th
+ -# %th
+
+ %tbody
+ - @profiles.each do |profile|
+ %tr
+ -# %td= profile.user
+ %td= link_to profile.name, profile
+ %td= profile.summary
+ %td= profile.about
+ -# - if policy(profile).destroy?
+ -# %td= link_to 'Edit', edit_profile_path(profile)
+ -# %td= link_to 'Destroy', profile, method: :delete, data: { confirm: 'Are you sure?' }
+
diff --git a/app/views/profiles/index.json.jbuilder b/app/views/profiles/index.json.jbuilder
new file mode 100644
index 00000000..927f05fc
--- /dev/null
+++ b/app/views/profiles/index.json.jbuilder
@@ -0,0 +1 @@
+json.array! @profiles, partial: "profiles/profile", as: :profile
diff --git a/app/views/profiles/new.html.haml b/app/views/profiles/new.html.haml
new file mode 100644
index 00000000..1ce592a2
--- /dev/null
+++ b/app/views/profiles/new.html.haml
@@ -0,0 +1,5 @@
+%h1 New profile
+
+= render 'form'
+
+= link_to 'Back', profiles_path
diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml
new file mode 100644
index 00000000..1211c723
--- /dev/null
+++ b/app/views/profiles/show.html.haml
@@ -0,0 +1,14 @@
+- if policy(@profile).edit?
+ .contain
+ = link_to 'Edit', edit_profile_path(@profile)
+
+%p
+ = @profile.name
+%p
+ = @profile.summary
+
+%h2 About #{@profile.name}
+
+.about
+ = @profile.about
+
diff --git a/app/views/profiles/show.json.jbuilder b/app/views/profiles/show.json.jbuilder
new file mode 100644
index 00000000..1a092f97
--- /dev/null
+++ b/app/views/profiles/show.json.jbuilder
@@ -0,0 +1 @@
+json.partial! "profiles/profile", profile: @profile
diff --git a/config/initializers/postgresql_database_tasks.rb b/config/initializers/postgresql_database_tasks.rb
index b617cf28..b7ad20b7 100644
--- a/config/initializers/postgresql_database_tasks.rb
+++ b/config/initializers/postgresql_database_tasks.rb
@@ -1,11 +1,11 @@
-module ActiveRecord
- module Tasks
- class PostgreSQLDatabaseTasks
- def drop
- establish_master_connection
- connection.select_all "select pg_terminate_backend(pg_stat_activity.pid) from pg_stat_activity where datname='#{configuration['database']}' AND state='idle';"
- connection.drop_database configuration['database']
- end
- end
- end
-end
+# module ActiveRecord
+# module Tasks
+# class PostgreSQLDatabaseTasks
+# def drop
+# establish_master_connection
+# connection.select_all "select pg_terminate_backend(pg_stat_activity.pid) from pg_stat_activity where datname='#{configuration['database']}' AND state='idle';"
+# connection.drop_database configuration['database']
+# end
+# end
+# end
+# end
diff --git a/config/locales/pundit.en.yml b/config/locales/pundit.en.yml
index 2d6e3661..34009c3f 100644
--- a/config/locales/pundit.en.yml
+++ b/config/locales/pundit.en.yml
@@ -1,6 +1,8 @@
en:
pundit:
default: 'You cannot perform this action.'
+ profile_policy:
+ new?: 'You must sign in to create a new Profile!'
project_policy:
new?: 'You must sign in to create a new Project!'
post_policy:
diff --git a/config/routes.rb b/config/routes.rb
index 9eb347dc..bd4b0046 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,5 @@
Rails.application.routes.draw do
+ resources :profiles
resources :tokens
resources :projects
resources :doodads
diff --git a/db/migrate/20231106161052_create_profiles.rb b/db/migrate/20231106161052_create_profiles.rb
new file mode 100644
index 00000000..21aa9d2c
--- /dev/null
+++ b/db/migrate/20231106161052_create_profiles.rb
@@ -0,0 +1,12 @@
+class CreateProfiles < ActiveRecord::Migration[6.1]
+ def change
+ create_table :profiles do |t|
+ t.belongs_to :user, null: false, foreign_key: true
+ t.string :name
+ t.string :summary
+ t.text :about
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index ce92e262..57bfaed8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2023_10_27_042335) do
+ActiveRecord::Schema.define(version: 2023_11_06_161052) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -96,6 +96,16 @@ ActiveRecord::Schema.define(version: 2023_10_27_042335) do
t.index ["player_id"], name: "index_plays_on_player_id"
end
+ create_table "profiles", force: :cascade do |t|
+ t.bigint "user_id", null: false
+ t.string "name"
+ t.string "summary"
+ t.text "about"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["user_id"], name: "index_profiles_on_user_id"
+ end
+
create_table "projects", force: :cascade do |t|
t.string "title"
t.text "description"
@@ -185,5 +195,6 @@ ActiveRecord::Schema.define(version: 2023_10_27_042335) do
add_foreign_key "canisters", "users"
add_foreign_key "doodads", "users"
+ add_foreign_key "profiles", "users"
add_foreign_key "projects", "users"
end
diff --git a/spec/factories/profiles.rb b/spec/factories/profiles.rb
new file mode 100644
index 00000000..0aad822a
--- /dev/null
+++ b/spec/factories/profiles.rb
@@ -0,0 +1,8 @@
+FactoryGirl.define do
+ factory :profile do
+ user nil
+ name "MyString"
+ summary "MyString"
+ about "MyText"
+ end
+end
diff --git a/spec/helpers/profiles_helper_spec.rb b/spec/helpers/profiles_helper_spec.rb
new file mode 100644
index 00000000..114cf67e
--- /dev/null
+++ b/spec/helpers/profiles_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the ProfilesHelper. For example:
+#
+# describe ProfilesHelper 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 ProfilesHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/profile_spec.rb b/spec/models/profile_spec.rb
new file mode 100644
index 00000000..335bd891
--- /dev/null
+++ b/spec/models/profile_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe Profile, type: :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/requests/profiles_spec.rb b/spec/requests/profiles_spec.rb
new file mode 100644
index 00000000..6fd116d4
--- /dev/null
+++ b/spec/requests/profiles_spec.rb
@@ -0,0 +1,135 @@
+require 'rails_helper'
+
+# This spec was generated by rspec-rails when you ran the scaffold generator.
+# It demonstrates how one might use RSpec to test the controller code that
+# was generated by Rails when you ran the scaffold generator.
+#
+# It assumes that the implementation code is generated by the rails scaffold
+# generator. If you are using any extension libraries to generate different
+# controller code, this generated spec may or may not pass.
+#
+# It only uses APIs available in rails and/or rspec-rails. There are a number
+# of tools you can use to make these specs even more expressive, but we're
+# sticking to rails and rspec-rails APIs to keep things simple and stable.
+
+RSpec.describe "/profiles", type: :request do
+
+ # This should return the minimal set of attributes required to create a valid
+ # Profile. As you add validations to Profile, be sure to
+ # adjust the attributes here as well.
+ let(:valid_attributes) {
+ skip("Add a hash of attributes valid for your model")
+ }
+
+ let(:invalid_attributes) {
+ skip("Add a hash of attributes invalid for your model")
+ }
+
+ describe "GET /index" do
+ it "renders a successful response" do
+ Profile.create! valid_attributes
+ get profiles_url
+ expect(response).to be_successful
+ end
+ end
+
+ describe "GET /show" do
+ it "renders a successful response" do
+ profile = Profile.create! valid_attributes
+ get profile_url(profile)
+ expect(response).to be_successful
+ end
+ end
+
+ describe "GET /new" do
+ it "renders a successful response" do
+ get new_profile_url
+ expect(response).to be_successful
+ end
+ end
+
+ describe "GET /edit" do
+ it "renders a successful response" do
+ profile = Profile.create! valid_attributes
+ get edit_profile_url(profile)
+ expect(response).to be_successful
+ end
+ end
+
+ describe "POST /create" do
+ context "with valid parameters" do
+ it "creates a new Profile" do
+ expect {
+ post profiles_url, params: { profile: valid_attributes }
+ }.to change(Profile, :count).by(1)
+ end
+
+ it "redirects to the created profile" do
+ post profiles_url, params: { profile: valid_attributes }
+ expect(response).to redirect_to(profile_url(Profile.last))
+ end
+ end
+
+ context "with invalid parameters" do
+ it "does not create a new Profile" do
+ expect {
+ post profiles_url, params: { profile: invalid_attributes }
+ }.to change(Profile, :count).by(0)
+ end
+
+
+ it "renders a successful response (i.e. to display the 'new' template)" do
+ post profiles_url, params: { profile: invalid_attributes }
+ expect(response).to be_successful
+ end
+
+ end
+ end
+
+ describe "PATCH /update" do
+ context "with valid parameters" do
+ let(:new_attributes) {
+ skip("Add a hash of attributes valid for your model")
+ }
+
+ it "updates the requested profile" do
+ profile = Profile.create! valid_attributes
+ patch profile_url(profile), params: { profile: new_attributes }
+ profile.reload
+ skip("Add assertions for updated state")
+ end
+
+ it "redirects to the profile" do
+ profile = Profile.create! valid_attributes
+ patch profile_url(profile), params: { profile: new_attributes }
+ profile.reload
+ expect(response).to redirect_to(profile_url(profile))
+ end
+ end
+
+ context "with invalid parameters" do
+
+ it "renders a successful response (i.e. to display the 'edit' template)" do
+ profile = Profile.create! valid_attributes
+ patch profile_url(profile), params: { profile: invalid_attributes }
+ expect(response).to be_successful
+ end
+
+ end
+ end
+
+ describe "DELETE /destroy" do
+ it "destroys the requested profile" do
+ profile = Profile.create! valid_attributes
+ expect {
+ delete profile_url(profile)
+ }.to change(Profile, :count).by(-1)
+ end
+
+ it "redirects to the profiles list" do
+ profile = Profile.create! valid_attributes
+ delete profile_url(profile)
+ expect(response).to redirect_to(profiles_url)
+ end
+ end
+end
diff --git a/spec/routing/profiles_routing_spec.rb b/spec/routing/profiles_routing_spec.rb
new file mode 100644
index 00000000..236fd3e4
--- /dev/null
+++ b/spec/routing/profiles_routing_spec.rb
@@ -0,0 +1,38 @@
+require "rails_helper"
+
+RSpec.describe ProfilesController, type: :routing do
+ describe "routing" do
+ it "routes to #index" do
+ expect(get: "/profiles").to route_to("profiles#index")
+ end
+
+ it "routes to #new" do
+ expect(get: "/profiles/new").to route_to("profiles#new")
+ end
+
+ it "routes to #show" do
+ expect(get: "/profiles/1").to route_to("profiles#show", id: "1")
+ end
+
+ it "routes to #edit" do
+ expect(get: "/profiles/1/edit").to route_to("profiles#edit", id: "1")
+ end
+
+
+ it "routes to #create" do
+ expect(post: "/profiles").to route_to("profiles#create")
+ end
+
+ it "routes to #update via PUT" do
+ expect(put: "/profiles/1").to route_to("profiles#update", id: "1")
+ end
+
+ it "routes to #update via PATCH" do
+ expect(patch: "/profiles/1").to route_to("profiles#update", id: "1")
+ end
+
+ it "routes to #destroy" do
+ expect(delete: "/profiles/1").to route_to("profiles#destroy", id: "1")
+ end
+ end
+end
diff --git a/spec/views/profiles/edit.html.haml_spec.rb b/spec/views/profiles/edit.html.haml_spec.rb
new file mode 100644
index 00000000..a7fc2f37
--- /dev/null
+++ b/spec/views/profiles/edit.html.haml_spec.rb
@@ -0,0 +1,31 @@
+require 'rails_helper'
+
+RSpec.describe "profiles/edit", type: :view do
+ let(:profile) {
+ Profile.create!(
+ user: nil,
+ name: "MyString",
+ summary: "MyString",
+ about: "MyText"
+ )
+ }
+
+ before(:each) do
+ assign(:profile, profile)
+ end
+
+ it "renders the edit profile form" do
+ render
+
+ assert_select "form[action=?][method=?]", profile_path(profile), "post" do
+
+ assert_select "input[name=?]", "profile[user_id]"
+
+ assert_select "input[name=?]", "profile[name]"
+
+ assert_select "input[name=?]", "profile[summary]"
+
+ assert_select "textarea[name=?]", "profile[about]"
+ end
+ end
+end
diff --git a/spec/views/profiles/index.html.haml_spec.rb b/spec/views/profiles/index.html.haml_spec.rb
new file mode 100644
index 00000000..43716dec
--- /dev/null
+++ b/spec/views/profiles/index.html.haml_spec.rb
@@ -0,0 +1,29 @@
+require 'rails_helper'
+
+RSpec.describe "profiles/index", type: :view do
+ before(:each) do
+ assign(:profiles, [
+ Profile.create!(
+ user: nil,
+ name: "Name",
+ summary: "Summary",
+ about: "MyText"
+ ),
+ Profile.create!(
+ user: nil,
+ name: "Name",
+ summary: "Summary",
+ about: "MyText"
+ )
+ ])
+ end
+
+ it "renders a list of profiles" do
+ render
+ cell_selector = Rails::VERSION::STRING >= '7' ? 'div>p' : 'tr>td'
+ assert_select cell_selector, text: Regexp.new(nil.to_s), count: 2
+ assert_select cell_selector, text: Regexp.new("Name".to_s), count: 2
+ assert_select cell_selector, text: Regexp.new("Summary".to_s), count: 2
+ assert_select cell_selector, text: Regexp.new("MyText".to_s), count: 2
+ end
+end
diff --git a/spec/views/profiles/new.html.haml_spec.rb b/spec/views/profiles/new.html.haml_spec.rb
new file mode 100644
index 00000000..74ff8cd6
--- /dev/null
+++ b/spec/views/profiles/new.html.haml_spec.rb
@@ -0,0 +1,27 @@
+require 'rails_helper'
+
+RSpec.describe "profiles/new", type: :view do
+ before(:each) do
+ assign(:profile, Profile.new(
+ user: nil,
+ name: "MyString",
+ summary: "MyString",
+ about: "MyText"
+ ))
+ end
+
+ it "renders new profile form" do
+ render
+
+ assert_select "form[action=?][method=?]", profiles_path, "post" do
+
+ assert_select "input[name=?]", "profile[user_id]"
+
+ assert_select "input[name=?]", "profile[name]"
+
+ assert_select "input[name=?]", "profile[summary]"
+
+ assert_select "textarea[name=?]", "profile[about]"
+ end
+ end
+end
diff --git a/spec/views/profiles/show.html.haml_spec.rb b/spec/views/profiles/show.html.haml_spec.rb
new file mode 100644
index 00000000..e9fbce21
--- /dev/null
+++ b/spec/views/profiles/show.html.haml_spec.rb
@@ -0,0 +1,20 @@
+require 'rails_helper'
+
+RSpec.describe "profiles/show", type: :view do
+ before(:each) do
+ assign(:profile, Profile.create!(
+ user: nil,
+ name: "Name",
+ summary: "Summary",
+ about: "MyText"
+ ))
+ end
+
+ it "renders attributes in " do
+ render
+ expect(rendered).to match(//)
+ expect(rendered).to match(/Name/)
+ expect(rendered).to match(/Summary/)
+ expect(rendered).to match(/MyText/)
+ end
+end