From e97b39ec48bf750274abad4bebeef90fe55369c6 Mon Sep 17 00:00:00 2001 From: Nelson Jovel Date: Fri, 5 Jan 2024 12:47:54 -0800 Subject: [PATCH] chore: remove examples models and views --- .../dashboard/examples_controller.rb | 60 -------- app/helpers/dashboard/examples_helper.rb | 4 - .../dashboard/examples/_example.html.erb | 12 -- app/views/dashboard/examples/_form.html.erb | 27 ---- app/views/dashboard/examples/edit.html.erb | 10 -- app/views/dashboard/examples/index.html.erb | 14 -- app/views/dashboard/examples/new.html.erb | 9 -- app/views/dashboard/examples/show.html.erb | 10 -- config/routes.rb | 1 - spec/dummy/db/schema.rb | 85 +++++------ spec/factories/dashboard/examples.rb | 6 - .../helpers/dashboard/examples_helper_spec.rb | 17 --- spec/models/dashboard/example_spec.rb | 10 -- spec/rails_helper.rb | 2 + spec/requests/dashboard/examples_spec.rb | 138 ------------------ .../dashboard/examples_routing_spec.rb | 39 ----- .../dashboard/examples/edit.html.erb_spec.rb | 26 ---- .../dashboard/examples/index.html.erb_spec.rb | 27 ---- .../dashboard/examples/new.html.erb_spec.rb | 23 --- .../dashboard/examples/show.html.erb_spec.rb | 18 --- 20 files changed, 37 insertions(+), 501 deletions(-) delete mode 100644 app/controllers/dashboard/examples_controller.rb delete mode 100644 app/helpers/dashboard/examples_helper.rb delete mode 100644 app/views/dashboard/examples/_example.html.erb delete mode 100644 app/views/dashboard/examples/_form.html.erb delete mode 100644 app/views/dashboard/examples/edit.html.erb delete mode 100644 app/views/dashboard/examples/index.html.erb delete mode 100644 app/views/dashboard/examples/new.html.erb delete mode 100644 app/views/dashboard/examples/show.html.erb delete mode 100644 spec/factories/dashboard/examples.rb delete mode 100644 spec/helpers/dashboard/examples_helper_spec.rb delete mode 100644 spec/models/dashboard/example_spec.rb delete mode 100644 spec/requests/dashboard/examples_spec.rb delete mode 100644 spec/routing/dashboard/examples_routing_spec.rb delete mode 100644 spec/views/dashboard/examples/edit.html.erb_spec.rb delete mode 100644 spec/views/dashboard/examples/index.html.erb_spec.rb delete mode 100644 spec/views/dashboard/examples/new.html.erb_spec.rb delete mode 100644 spec/views/dashboard/examples/show.html.erb_spec.rb diff --git a/app/controllers/dashboard/examples_controller.rb b/app/controllers/dashboard/examples_controller.rb deleted file mode 100644 index c2b96dc..0000000 --- a/app/controllers/dashboard/examples_controller.rb +++ /dev/null @@ -1,60 +0,0 @@ -module Dashboard - class ExamplesController < ApplicationController - before_action :set_example, only: %i[ show edit update destroy ] - - # GET /examples - def index - @examples = Example.all - end - - # GET /examples/1 - def show - end - - # GET /examples/new - def new - @example = Example.new - end - - # GET /examples/1/edit - def edit - end - - # POST /examples - def create - @example = Example.new(example_params) - - if @example.save - redirect_to @example, notice: "Example was successfully created." - else - render :new, status: :unprocessable_entity - end - end - - # PATCH/PUT /examples/1 - def update - if @example.update(example_params) - redirect_to @example, notice: "Example was successfully updated.", status: :see_other - else - render :edit, status: :unprocessable_entity - end - end - - # DELETE /examples/1 - def destroy - @example.destroy! - redirect_to examples_url, notice: "Example was successfully destroyed.", status: :see_other - end - - private - # Use callbacks to share common setup or constraints between actions. - def set_example - @example = Example.find(params[:id]) - end - - # Only allow a list of trusted parameters through. - def example_params - params.require(:example).permit(:text, :body) - end - end -end diff --git a/app/helpers/dashboard/examples_helper.rb b/app/helpers/dashboard/examples_helper.rb deleted file mode 100644 index d7c4dbd..0000000 --- a/app/helpers/dashboard/examples_helper.rb +++ /dev/null @@ -1,4 +0,0 @@ -module Dashboard - module ExamplesHelper - end -end diff --git a/app/views/dashboard/examples/_example.html.erb b/app/views/dashboard/examples/_example.html.erb deleted file mode 100644 index 17eac30..0000000 --- a/app/views/dashboard/examples/_example.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -
-

- Text: - <%= example.text %> -

- -

- Body: - <%= example.body %> -

- -
diff --git a/app/views/dashboard/examples/_form.html.erb b/app/views/dashboard/examples/_form.html.erb deleted file mode 100644 index 7a3ee22..0000000 --- a/app/views/dashboard/examples/_form.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<%= form_with(model: example) do |form| %> - <% if example.errors.any? %> -
-

<%= pluralize(example.errors.count, "error") %> prohibited this example from being saved:

- - -
- <% end %> - -
- <%= form.label :text, style: "display: block" %> - <%= form.text_field :text %> -
- -
- <%= form.label :body, style: "display: block" %> - <%= form.text_area :body %> -
- -
- <%= form.submit %> -
-<% end %> diff --git a/app/views/dashboard/examples/edit.html.erb b/app/views/dashboard/examples/edit.html.erb deleted file mode 100644 index 92b1731..0000000 --- a/app/views/dashboard/examples/edit.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

Editing example

- -<%= render "form", example: @example %> - -
- -
- <%= link_to "Show this example", @example %> | - <%= link_to "Back to examples", examples_path %> -
diff --git a/app/views/dashboard/examples/index.html.erb b/app/views/dashboard/examples/index.html.erb deleted file mode 100644 index 6eed656..0000000 --- a/app/views/dashboard/examples/index.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -

<%= notice %>

- -

Examples

- -
- <% @examples.each do |example| %> - <%= render example %> -

- <%= link_to "Show this example", example %> -

- <% end %> -
- -<%= link_to "New example", new_example_path %> diff --git a/app/views/dashboard/examples/new.html.erb b/app/views/dashboard/examples/new.html.erb deleted file mode 100644 index 3986849..0000000 --- a/app/views/dashboard/examples/new.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -

New example

- -<%= render "form", example: @example %> - -
- -
- <%= link_to "Back to examples", examples_path %> -
diff --git a/app/views/dashboard/examples/show.html.erb b/app/views/dashboard/examples/show.html.erb deleted file mode 100644 index e58d608..0000000 --- a/app/views/dashboard/examples/show.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -

<%= notice %>

- -<%= render @example %> - -
- <%= link_to "Edit this example", edit_example_path(@example) %> | - <%= link_to "Back to examples", examples_path %> - - <%= button_to "Destroy this example", @example, method: :delete %> -
diff --git a/config/routes.rb b/config/routes.rb index 738745d..e09dc6f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,3 @@ Dashboard::Engine.routes.draw do - resources :examples get "/welcome", to: "home#index" end diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index 9992b75..a9d8770 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -10,18 +10,10 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_01_05_041641) do +ActiveRecord::Schema[7.1].define(version: 2024_01_04_192128) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" - create_table "children", force: :cascade do |t| - t.text "text" - t.bigint "parent_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["parent_id"], name: "index_children_on_parent_id" - end - create_table "dashboard_academic_years", force: :cascade do |t| t.string "range" t.datetime "created_at", null: false @@ -45,14 +37,14 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_05_041641) do create_table "dashboard_admin_data_values", force: :cascade do |t| t.float "likert_score" - t.bigint "school_id", null: false + t.bigint "dashboard_school_id", null: false t.bigint "dashboard_admin_data_item_id", null: false t.bigint "dashboard_academic_year_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["dashboard_academic_year_id"], name: "idx_on_dashboard_academic_year_id_1de27231d5" t.index ["dashboard_admin_data_item_id"], name: "idx_on_dashboard_admin_data_item_id_edae2faad3" - t.index ["school_id"], name: "index_dashboard_admin_data_values_on_school_id" + t.index ["dashboard_school_id"], name: "index_dashboard_admin_data_values_on_dashboard_school_id" end create_table "dashboard_categories", force: :cascade do |t| @@ -65,6 +57,14 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_05_041641) do t.datetime "updated_at", null: false end + create_table "dashboard_districts", force: :cascade do |t| + t.string "name" + t.string "slug" + t.integer "qualtrics_code" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "dashboard_ells", force: :cascade do |t| t.string "designation" t.string "slug" @@ -112,7 +112,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_05_041641) do end create_table "dashboard_respondents", force: :cascade do |t| - t.bigint "school_id", null: false + t.bigint "dashboard_school_id", null: false t.bigint "dashboard_academic_year_id", null: false t.integer "total_students" t.float "total_teachers" @@ -133,20 +133,20 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_05_041641) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["dashboard_academic_year_id"], name: "index_dashboard_respondents_on_dashboard_academic_year_id" - t.index ["school_id"], name: "index_dashboard_respondents_on_school_id" + t.index ["dashboard_school_id"], name: "index_dashboard_respondents_on_dashboard_school_id" end create_table "dashboard_response_rates", force: :cascade do |t| t.bigint "dashboard_subcategory_id", null: false - t.bigint "school_id", null: false + t.bigint "dashboard_school_id", null: false t.bigint "dashboard_academic_year_id", null: false t.float "school_response_rate" t.float "teacher_response_rate" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["dashboard_academic_year_id"], name: "index_dashboard_response_rates_on_dashboard_academic_year_id" + t.index ["dashboard_school_id"], name: "index_dashboard_response_rates_on_dashboard_school_id" t.index ["dashboard_subcategory_id"], name: "index_dashboard_response_rates_on_dashboard_subcategory_id" - t.index ["school_id"], name: "index_dashboard_response_rates_on_school_id" end create_table "dashboard_scales", force: :cascade do |t| @@ -157,6 +157,19 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_05_041641) do t.index ["dashboard_measure_id"], name: "index_dashboard_scales_on_dashboard_measure_id" end + create_table "dashboard_schools", force: :cascade do |t| + t.string "name" + t.bigint "dashboard_district_id", null: false + t.text "description" + t.string "slug" + t.integer "qualtrics_code" + t.integer "dese_id" + t.boolean "is_hs" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["dashboard_district_id"], name: "index_dashboard_schools_on_dashboard_district_id" + end + create_table "dashboard_scores", force: :cascade do |t| t.float "average" t.boolean "meets_teacher_threshold" @@ -201,7 +214,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_05_041641) do create_table "dashboard_survey_item_responses", force: :cascade do |t| t.integer "likert_score" - t.bigint "school_id", null: false + t.bigint "dashboard_school_id", null: false t.bigint "dashboard_survey_item_id", null: false t.bigint "dashboard_academic_year_id", null: false t.bigint "dashboard_student_id" @@ -218,10 +231,10 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_05_041641) do t.index ["dashboard_ell_id"], name: "index_dashboard_survey_item_responses_on_dashboard_ell_id" t.index ["dashboard_gender_id"], name: "index_dashboard_survey_item_responses_on_dashboard_gender_id" t.index ["dashboard_income_id"], name: "index_dashboard_survey_item_responses_on_dashboard_income_id" + t.index ["dashboard_school_id"], name: "index_dashboard_survey_item_responses_on_dashboard_school_id" t.index ["dashboard_sped_id"], name: "index_dashboard_survey_item_responses_on_dashboard_sped_id" t.index ["dashboard_student_id"], name: "index_dashboard_survey_item_responses_on_dashboard_student_id" t.index ["dashboard_survey_item_id"], name: "idx_on_dashboard_survey_item_id_3f6652fbc6" - t.index ["school_id"], name: "index_dashboard_survey_item_responses_on_school_id" end create_table "dashboard_survey_items", force: :cascade do |t| @@ -238,45 +251,18 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_05_041641) do t.index ["dashboard_scale_id"], name: "index_dashboard_survey_items_on_dashboard_scale_id" end - create_table "districts", force: :cascade do |t| - t.string "name" - t.string "slug" - t.integer "qualtrics_code" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "parents", force: :cascade do |t| - t.text "text" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "schools", force: :cascade do |t| - t.string "name" - t.bigint "district_id", null: false - t.text "description" - t.string "slug" - t.integer "qualtrics_code" - t.integer "dese_id" - t.boolean "is_hs" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["district_id"], name: "index_schools_on_district_id" - end - - add_foreign_key "children", "parents" add_foreign_key "dashboard_admin_data_items", "dashboard_scales" add_foreign_key "dashboard_admin_data_values", "dashboard_academic_years" add_foreign_key "dashboard_admin_data_values", "dashboard_admin_data_items" - add_foreign_key "dashboard_admin_data_values", "schools" + add_foreign_key "dashboard_admin_data_values", "dashboard_schools" add_foreign_key "dashboard_measures", "dashboard_subcategories" add_foreign_key "dashboard_respondents", "dashboard_academic_years" - add_foreign_key "dashboard_respondents", "schools" + add_foreign_key "dashboard_respondents", "dashboard_schools" add_foreign_key "dashboard_response_rates", "dashboard_academic_years" + add_foreign_key "dashboard_response_rates", "dashboard_schools" add_foreign_key "dashboard_response_rates", "dashboard_subcategories" - add_foreign_key "dashboard_response_rates", "schools" add_foreign_key "dashboard_scales", "dashboard_measures" + add_foreign_key "dashboard_schools", "dashboard_districts" add_foreign_key "dashboard_student_races", "dashboard_races" add_foreign_key "dashboard_student_races", "dashboard_students" add_foreign_key "dashboard_subcategories", "dashboard_categories", column: "dashboard_categories_id" @@ -284,10 +270,9 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_05_041641) do add_foreign_key "dashboard_survey_item_responses", "dashboard_ells" add_foreign_key "dashboard_survey_item_responses", "dashboard_genders" add_foreign_key "dashboard_survey_item_responses", "dashboard_incomes" + add_foreign_key "dashboard_survey_item_responses", "dashboard_schools" add_foreign_key "dashboard_survey_item_responses", "dashboard_speds" add_foreign_key "dashboard_survey_item_responses", "dashboard_students" add_foreign_key "dashboard_survey_item_responses", "dashboard_survey_items" - add_foreign_key "dashboard_survey_item_responses", "schools" add_foreign_key "dashboard_survey_items", "dashboard_scales" - add_foreign_key "schools", "districts" end diff --git a/spec/factories/dashboard/examples.rb b/spec/factories/dashboard/examples.rb deleted file mode 100644 index 09396d6..0000000 --- a/spec/factories/dashboard/examples.rb +++ /dev/null @@ -1,6 +0,0 @@ -FactoryBot.define do - factory :example, class: "Dashboard::Example" do - text { "MyString" } - body { "MyText" } - end -end diff --git a/spec/helpers/dashboard/examples_helper_spec.rb b/spec/helpers/dashboard/examples_helper_spec.rb deleted file mode 100644 index 0e6c57a..0000000 --- a/spec/helpers/dashboard/examples_helper_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -require 'rails_helper' - -# Specs in this file have access to a helper object that includes -# the ExamplesHelper. For example: -# -# describe ExamplesHelper 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 -module Dashboard - RSpec.describe ExamplesHelper, type: :helper do - pending "add some examples to (or delete) #{__FILE__}" - end -end diff --git a/spec/models/dashboard/example_spec.rb b/spec/models/dashboard/example_spec.rb deleted file mode 100644 index ec767e1..0000000 --- a/spec/models/dashboard/example_spec.rb +++ /dev/null @@ -1,10 +0,0 @@ -require "rails_helper" - -module Dashboard - RSpec.describe Example, type: :model do - it "creates an example to test rspec and factorybot" do - create(:example) - expect(Example.count).to eq 1 - end - end -end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 62024d6..bfe10c6 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -75,4 +75,6 @@ RSpec.configure do |config| include Dashboard::Engine.routes.url_helpers end end + + config.include Dashboard::Engine.routes.url_helpers end diff --git a/spec/requests/dashboard/examples_spec.rb b/spec/requests/dashboard/examples_spec.rb deleted file mode 100644 index 5deb02c..0000000 --- a/spec/requests/dashboard/examples_spec.rb +++ /dev/null @@ -1,138 +0,0 @@ -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. - -module Dashboard - RSpec.describe "/examples", type: :request do - include Engine.routes.url_helpers - - # This should return the minimal set of attributes required to create a valid - # Example. As you add validations to Example, 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 - Example.create! valid_attributes - get examples_url - expect(response).to be_successful - end - end - - describe "GET /show" do - it "renders a successful response" do - example = Example.create! valid_attributes - get example_url(example) - expect(response).to be_successful - end - end - - describe "GET /new" do - it "renders a successful response" do - get new_example_url - expect(response).to be_successful - end - end - - describe "GET /edit" do - it "renders a successful response" do - example = Example.create! valid_attributes - get edit_example_url(example) - expect(response).to be_successful - end - end - - describe "POST /create" do - context "with valid parameters" do - it "creates a new Example" do - expect { - post examples_url, params: { example: valid_attributes } - }.to change(Example, :count).by(1) - end - - it "redirects to the created example" do - post examples_url, params: { example: valid_attributes } - expect(response).to redirect_to(example_url(Example.last)) - end - end - - context "with invalid parameters" do - it "does not create a new Example" do - expect { - post examples_url, params: { example: invalid_attributes } - }.to change(Example, :count).by(0) - end - - - it "renders a response with 422 status (i.e. to display the 'new' template)" do - post examples_url, params: { example: invalid_attributes } - expect(response).to have_http_status(:unprocessable_entity) - 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 example" do - example = Example.create! valid_attributes - patch example_url(example), params: { example: new_attributes } - example.reload - skip("Add assertions for updated state") - end - - it "redirects to the example" do - example = Example.create! valid_attributes - patch example_url(example), params: { example: new_attributes } - example.reload - expect(response).to redirect_to(example_url(example)) - end - end - - context "with invalid parameters" do - - it "renders a response with 422 status (i.e. to display the 'edit' template)" do - example = Example.create! valid_attributes - patch example_url(example), params: { example: invalid_attributes } - expect(response).to have_http_status(:unprocessable_entity) - end - - end - end - - describe "DELETE /destroy" do - it "destroys the requested example" do - example = Example.create! valid_attributes - expect { - delete example_url(example) - }.to change(Example, :count).by(-1) - end - - it "redirects to the examples list" do - example = Example.create! valid_attributes - delete example_url(example) - expect(response).to redirect_to(examples_url) - end - end - end -end diff --git a/spec/routing/dashboard/examples_routing_spec.rb b/spec/routing/dashboard/examples_routing_spec.rb deleted file mode 100644 index 3007913..0000000 --- a/spec/routing/dashboard/examples_routing_spec.rb +++ /dev/null @@ -1,39 +0,0 @@ -require "rails_helper" - -module Dashboard - RSpec.describe ExamplesController, type: :routing do - describe "routing" do - it "routes to #index" do - expect(get: "dashboard/examples").to route_to("dashboard/examples#index") - end - - it "routes to #new" do - expect(get: "dashboard/examples/new").to route_to("dashboard/examples#new") - end - - it "routes to #show" do - expect(get: "dashboard/examples/1").to route_to("dashboard/examples#show", id: "1") - end - - it "routes to #edit" do - expect(get: "/dashboard/examples/1/edit").to route_to("dashboard/examples#edit", id: "1") - end - - it "routes to #create" do - expect(post: "/dashboard/examples").to route_to("dashboard/examples#create") - end - - it "routes to #update via PUT" do - expect(put: "/dashboard/examples/1").to route_to("dashboard/examples#update", id: "1") - end - - it "routes to #update via PATCH" do - expect(patch: "/dashboard/examples/1").to route_to("dashboard/examples#update", id: "1") - end - - it "routes to #destroy" do - expect(delete: "/dashboard/examples/1").to route_to("dashboard/examples#destroy", id: "1") - end - end - end -end diff --git a/spec/views/dashboard/examples/edit.html.erb_spec.rb b/spec/views/dashboard/examples/edit.html.erb_spec.rb deleted file mode 100644 index 5162d25..0000000 --- a/spec/views/dashboard/examples/edit.html.erb_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require "rails_helper" - -module Dashboard - RSpec.xdescribe "dashboard/examples/edit", type: :view do - let(:example) do - Example.create!( - text: "MyString", - body: "MyText" - ) - end - - before(:each) do - assign(:example, example) - end - - it "renders the edit example form" do - render - - assert_select "form[action=?][method=?]", example_path(example), "post" do - assert_select "input[name=?]", "example[text]" - - assert_select "textarea[name=?]", "example[body]" - end - end - end -end diff --git a/spec/views/dashboard/examples/index.html.erb_spec.rb b/spec/views/dashboard/examples/index.html.erb_spec.rb deleted file mode 100644 index 8d1a36a..0000000 --- a/spec/views/dashboard/examples/index.html.erb_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -require "rails_helper" -require "nokogiri" - -module Dashboard - include Engine.routes.url_helpers - RSpec.describe "/dashboard/examples/index", type: :view do - before(:each) do - assign(:examples, [ - Example.create!( - text: "Word", - body: "Sentence" - ), - Example.create!( - text: "Word", - body: "Sentence" - ) - ]) - end - - it "renders a list of examples" do - render - cell_selector = Rails::VERSION::STRING >= "7" ? "div>p" : "tr>td" - assert_select cell_selector, text: Regexp.new("Word".to_s), count: 2 - assert_select cell_selector, text: Regexp.new("Sentence".to_s), count: 2 - end - end -end diff --git a/spec/views/dashboard/examples/new.html.erb_spec.rb b/spec/views/dashboard/examples/new.html.erb_spec.rb deleted file mode 100644 index a1efb25..0000000 --- a/spec/views/dashboard/examples/new.html.erb_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require "rails_helper" - -module Dashboard - include Engine.routes.url_helpers - RSpec.describe "dashboard/examples/new", type: :view do - before(:each) do - assign(:example, Example.new( - text: "MyString", - body: "MyText" - )) - end - - it "renders new example form" do - render - - assert_select "form[action=?][method=?]", examples_path, "post" do - assert_select "input[name=?]", "example[text]" - - assert_select "textarea[name=?]", "example[body]" - end - end - end -end diff --git a/spec/views/dashboard/examples/show.html.erb_spec.rb b/spec/views/dashboard/examples/show.html.erb_spec.rb deleted file mode 100644 index 5049e5e..0000000 --- a/spec/views/dashboard/examples/show.html.erb_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require "rails_helper" - -module Dashboard - RSpec.describe "dashboard/examples/show", type: :view do - before(:each) do - assign(:example, Example.create!( - text: "Word", - body: "Sentence" - )) - end - - it "renders attributes in

" do - render - expect(rendered).to match(/Word/) - expect(rendered).to match(/Sentence/) - end - end -end