Skip to content

Commit

Permalink
Added MultipleChoiceQuestion model
Browse files Browse the repository at this point in the history
  • Loading branch information
sdflem committed Sep 21, 2018
1 parent 6a3db5c commit 78da026
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/models/multiple_choice_question.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# == Schema Information
#
# Table name: multiple_choice_questions
#
# id :integer not null, primary key
# answer :string
# distractor_1 :string
# distractor_2 :string
# distractor_3 :string
# distractor_4 :string
# question :string
# created_at :datetime not null
# updated_at :datetime not null
#

class MultipleChoiceQuestion < ApplicationRecord
end
14 changes: 14 additions & 0 deletions db/migrate/20180921202046_create_multiple_choice_questions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class CreateMultipleChoiceQuestions < ActiveRecord::Migration[5.2]
def change
create_table :multiple_choice_questions do |t|
t.string :question
t.string :answer
t.string :distractor_1
t.string :distractor_2
t.string :distractor_3
t.string :distractor_4

t.timestamps
end
end
end
26 changes: 26 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2018_09_21_202046) do

create_table "multiple_choice_questions", force: :cascade do |t|
t.string "question"
t.string "answer"
t.string "distractor_1"
t.string "distractor_2"
t.string "distractor_3"
t.string "distractor_4"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

end
32 changes: 32 additions & 0 deletions test/fixtures/multiple_choice_questions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# == Schema Information
#
# Table name: multiple_choice_questions
#
# id :integer not null, primary key
# answer :string
# distractor_1 :string
# distractor_2 :string
# distractor_3 :string
# distractor_4 :string
# question :string
# created_at :datetime not null
# updated_at :datetime not null
#

# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html

one:
question: MyString
answer: MyString
distractor_1: MyString
distractor_2: MyString
distractor_3: MyString
distractor_4: MyString

two:
question: MyString
answer: MyString
distractor_1: MyString
distractor_2: MyString
distractor_3: MyString
distractor_4: MyString
22 changes: 22 additions & 0 deletions test/models/multiple_choice_question_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# == Schema Information
#
# Table name: multiple_choice_questions
#
# id :integer not null, primary key
# answer :string
# distractor_1 :string
# distractor_2 :string
# distractor_3 :string
# distractor_4 :string
# question :string
# created_at :datetime not null
# updated_at :datetime not null
#

require 'test_helper'

class MultipleChoiceQuestionTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

0 comments on commit 78da026

Please sign in to comment.