Commit 666623f8 by John Doe

added DbStreams

parent 103c1e4a
# 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/
// Place all the styles related to the DbStreams controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
module DbFilesHelper class DbStreamsController < ApplicationController
end end
# application helper
module ApplicationHelper
end
# helper for DbFolder
module DbFoldersHelper
end
# A file in the database, contains one or more Streams
class DbFile < ActiveRecord::Base class DbFile < ActiveRecord::Base
belongs_to :db_folder belongs_to :db_folder
has_many :streams has_many :streams
......
# a stream in the database, this is the lowest element
# in the db hierarchy and contains actual data
class DbStream < ActiveRecord::Base
belongs_to :db_file
end
Rails.application.routes.draw do Rails.application.routes.draw do
resources :db_streams
resources :db_files resources :db_files
resources :db_folders resources :db_folders
# The priority is based upon order of creation: first created -> highest priority. # The priority is based upon order of creation: first created -> highest priority.
......
class CreateDbStreams < ActiveRecord::Migration
def change
create_table :db_streams do |t|
t.string :name
t.string :units
t.integer :column
t.float :default_max
t.float :default_min
t.float :scale
t.float :offset
t.integer :db_file_id
t.timestamps null: false
end
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160515201220) do ActiveRecord::Schema.define(version: 20160516000545) do
create_table "db_files", force: :cascade do |t| create_table "db_files", force: :cascade do |t|
t.string "name" t.string "name"
...@@ -28,4 +28,17 @@ ActiveRecord::Schema.define(version: 20160515201220) do ...@@ -28,4 +28,17 @@ ActiveRecord::Schema.define(version: 20160515201220) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
end end
create_table "db_streams", force: :cascade do |t|
t.string "name"
t.string "units"
t.integer "column"
t.float "default_max"
t.float "default_min"
t.float "scale"
t.float "offset"
t.integer "db_file_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end end
require 'rails_helper' require 'rails_helper'
RSpec.describe DbFilesController, type: :controller do RSpec.describe DbFilesController, type: :controller do
end end
require 'rails_helper'
RSpec.describe DbStreamsController, type: :controller do
end
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the DbFilesHelper. For example:
#
# describe DbFilesHelper 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 DbFilesHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
...@@ -6,6 +6,5 @@ RSpec.describe 'DbFile' do ...@@ -6,6 +6,5 @@ RSpec.describe 'DbFile' do
specify { expect(db_file).to respond_to(:name) } specify { expect(db_file).to respond_to(:name) }
specify { expect(db_file).to respond_to(:description) } specify { expect(db_file).to respond_to(:description) }
specify { expect(db_file).to respond_to(:streams) } specify { expect(db_file).to respond_to(:streams) }
end end
end end
require 'rails_helper'
RSpec.describe 'DbStream' do
describe 'object' do
let(:db_stream) { DbStream.new }
specify { expect(db_stream).to respond_to(:name) }
specify { expect(db_stream).to respond_to(:units) }
specify { expect(db_stream).to respond_to(:column) }
specify { expect(db_stream).to respond_to(:default_max) }
specify { expect(db_stream).to respond_to(:default_min) }
specify { expect(db_stream).to respond_to(:scale) }
specify { expect(db_stream).to respond_to(:offset) }
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment