mirror of
https://github.com/internetee/registry.git
synced 2025-05-22 04:09:52 +02:00
Add initial models and corresponding test files
This commit is contained in:
parent
bca4470643
commit
542ea5101e
28 changed files with 548 additions and 8 deletions
19
Gemfile
19
Gemfile
|
@ -17,11 +17,11 @@ gem 'coffee-rails', '~> 4.0.0'
|
||||||
# Use jquery as the JavaScript library
|
# Use jquery as the JavaScript library
|
||||||
gem 'jquery-rails'
|
gem 'jquery-rails'
|
||||||
|
|
||||||
# Turbolinks makes following links in your web application faster.
|
# Turbolinks makes following links in your web application faster.
|
||||||
# Read more: https://github.com/rails/turbolinks
|
# Read more: https://github.com/rails/turbolinks
|
||||||
gem 'turbolinks'
|
gem 'turbolinks'
|
||||||
|
|
||||||
# Build JSON APIs with ease.
|
# Build JSON APIs with ease.
|
||||||
# Read more: https://github.com/rails/jbuilder
|
# Read more: https://github.com/rails/jbuilder
|
||||||
gem 'jbuilder', '~> 2.0'
|
gem 'jbuilder', '~> 2.0'
|
||||||
|
|
||||||
|
@ -34,18 +34,21 @@ group :assets do
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
# debugging
|
|
||||||
gem 'pry'
|
|
||||||
|
|
||||||
# faster dev load time
|
# faster dev load time
|
||||||
gem 'unicorn'
|
gem 'unicorn'
|
||||||
|
|
||||||
# Spring speeds up development by keeping your application running in the background.
|
# Spring speeds up development by keeping your application running in the background.
|
||||||
# Read more: https://github.com/rails/spring
|
# Read more: https://github.com/rails/spring
|
||||||
gem 'spring'
|
gem 'spring'
|
||||||
end
|
|
||||||
|
|
||||||
group :development do
|
|
||||||
# bundle exec rake doc:rails generates the API under doc/api.
|
# bundle exec rake doc:rails generates the API under doc/api.
|
||||||
gem 'sdoc', '~> 0.4.0'
|
gem 'sdoc', '~> 0.4.0'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
group :development, :test do
|
||||||
|
gem 'fabrication', '~> 2.11.3'
|
||||||
|
gem 'faker', '~> 1.3.0'
|
||||||
|
gem 'pry'
|
||||||
|
gem 'rspec-rails', '~> 3.0.1'
|
||||||
|
gem 'shoulda-matchers', '~> 2.6.1', require: false
|
||||||
|
end
|
||||||
|
|
47
Gemfile.lock
47
Gemfile.lock
|
@ -29,6 +29,7 @@ GEM
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
arel (5.0.1.20140414130214)
|
arel (5.0.1.20140414130214)
|
||||||
builder (3.2.2)
|
builder (3.2.2)
|
||||||
|
coderay (1.1.0)
|
||||||
coffee-rails (4.0.1)
|
coffee-rails (4.0.1)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
railties (>= 4.0.0, < 5.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
|
@ -36,8 +37,12 @@ GEM
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.7.0)
|
coffee-script-source (1.7.0)
|
||||||
|
diff-lcs (1.2.5)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (2.2.0)
|
execjs (2.2.0)
|
||||||
|
fabrication (2.11.3)
|
||||||
|
faker (1.3.0)
|
||||||
|
i18n (~> 0.5)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
i18n (0.6.9)
|
i18n (0.6.9)
|
||||||
jbuilder (2.1.0)
|
jbuilder (2.1.0)
|
||||||
|
@ -47,14 +52,21 @@ GEM
|
||||||
railties (>= 3.0, < 5.0)
|
railties (>= 3.0, < 5.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
json (1.8.1)
|
json (1.8.1)
|
||||||
|
kgio (2.9.2)
|
||||||
|
libv8 (3.16.14.3)
|
||||||
mail (2.5.4)
|
mail (2.5.4)
|
||||||
mime-types (~> 1.16)
|
mime-types (~> 1.16)
|
||||||
treetop (~> 1.4.8)
|
treetop (~> 1.4.8)
|
||||||
|
method_source (0.8.2)
|
||||||
mime-types (1.25.1)
|
mime-types (1.25.1)
|
||||||
minitest (5.3.4)
|
minitest (5.3.4)
|
||||||
multi_json (1.10.1)
|
multi_json (1.10.1)
|
||||||
pg (0.17.1)
|
pg (0.17.1)
|
||||||
polyglot (0.3.5)
|
polyglot (0.3.5)
|
||||||
|
pry (0.10.0)
|
||||||
|
coderay (~> 1.1.0)
|
||||||
|
method_source (~> 0.8.1)
|
||||||
|
slop (~> 3.4)
|
||||||
rack (1.5.2)
|
rack (1.5.2)
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
|
@ -73,9 +85,27 @@ GEM
|
||||||
activesupport (= 4.1.1)
|
activesupport (= 4.1.1)
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
|
raindrops (0.13.0)
|
||||||
rake (10.3.2)
|
rake (10.3.2)
|
||||||
rdoc (4.1.1)
|
rdoc (4.1.1)
|
||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
|
ref (1.0.5)
|
||||||
|
rspec-core (3.0.1)
|
||||||
|
rspec-support (~> 3.0.0)
|
||||||
|
rspec-expectations (3.0.1)
|
||||||
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
|
rspec-support (~> 3.0.0)
|
||||||
|
rspec-mocks (3.0.1)
|
||||||
|
rspec-support (~> 3.0.0)
|
||||||
|
rspec-rails (3.0.1)
|
||||||
|
actionpack (>= 3.0)
|
||||||
|
activesupport (>= 3.0)
|
||||||
|
railties (>= 3.0)
|
||||||
|
rspec-core (~> 3.0.0)
|
||||||
|
rspec-expectations (~> 3.0.0)
|
||||||
|
rspec-mocks (~> 3.0.0)
|
||||||
|
rspec-support (~> 3.0.0)
|
||||||
|
rspec-support (3.0.0)
|
||||||
sass (3.2.19)
|
sass (3.2.19)
|
||||||
sass-rails (4.0.3)
|
sass-rails (4.0.3)
|
||||||
railties (>= 4.0.0, < 5.0)
|
railties (>= 4.0.0, < 5.0)
|
||||||
|
@ -85,6 +115,9 @@ GEM
|
||||||
sdoc (0.4.0)
|
sdoc (0.4.0)
|
||||||
json (~> 1.8)
|
json (~> 1.8)
|
||||||
rdoc (~> 4.0, < 5.0)
|
rdoc (~> 4.0, < 5.0)
|
||||||
|
shoulda-matchers (2.6.1)
|
||||||
|
activesupport (>= 3.0.0)
|
||||||
|
slop (3.5.0)
|
||||||
spring (1.1.3)
|
spring (1.1.3)
|
||||||
sprockets (2.11.0)
|
sprockets (2.11.0)
|
||||||
hike (~> 1.2)
|
hike (~> 1.2)
|
||||||
|
@ -95,6 +128,9 @@ GEM
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
sprockets (~> 2.8)
|
sprockets (~> 2.8)
|
||||||
|
therubyracer (0.12.1)
|
||||||
|
libv8 (~> 3.16.14.0)
|
||||||
|
ref
|
||||||
thor (0.19.1)
|
thor (0.19.1)
|
||||||
thread_safe (0.3.4)
|
thread_safe (0.3.4)
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
|
@ -108,18 +144,29 @@ GEM
|
||||||
uglifier (2.5.0)
|
uglifier (2.5.0)
|
||||||
execjs (>= 0.3.0)
|
execjs (>= 0.3.0)
|
||||||
json (>= 1.8.0)
|
json (>= 1.8.0)
|
||||||
|
unicorn (4.8.3)
|
||||||
|
kgio (~> 2.6)
|
||||||
|
rack
|
||||||
|
raindrops (~> 0.7)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
coffee-rails (~> 4.0.0)
|
coffee-rails (~> 4.0.0)
|
||||||
|
fabrication (~> 2.11.3)
|
||||||
|
faker (~> 1.3.0)
|
||||||
jbuilder (~> 2.0)
|
jbuilder (~> 2.0)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
pg
|
pg
|
||||||
|
pry
|
||||||
rails (= 4.1.1)
|
rails (= 4.1.1)
|
||||||
|
rspec-rails (~> 3.0.1)
|
||||||
sass-rails (~> 4.0.3)
|
sass-rails (~> 4.0.3)
|
||||||
sdoc (~> 0.4.0)
|
sdoc (~> 0.4.0)
|
||||||
|
shoulda-matchers (~> 2.6.1)
|
||||||
spring
|
spring
|
||||||
|
therubyracer
|
||||||
turbolinks
|
turbolinks
|
||||||
uglifier (>= 1.3.0)
|
uglifier (>= 1.3.0)
|
||||||
|
unicorn
|
||||||
|
|
4
app/models/address.rb
Normal file
4
app/models/address.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
class Address < ActiveRecord::Base
|
||||||
|
belongs_to :contact
|
||||||
|
belongs_to :country
|
||||||
|
end
|
3
app/models/contact.rb
Normal file
3
app/models/contact.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class Contact < ActiveRecord::Base
|
||||||
|
has_many :addresses
|
||||||
|
end
|
3
app/models/country.rb
Normal file
3
app/models/country.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class Country < ActiveRecord::Base
|
||||||
|
|
||||||
|
end
|
7
app/models/domain.rb
Normal file
7
app/models/domain.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class Domain < ActiveRecord::Base
|
||||||
|
belongs_to :registrar
|
||||||
|
belongs_to :ns_set
|
||||||
|
belongs_to :owner_contact, class_name: 'Contact'
|
||||||
|
belongs_to :technical_contact, class_name: 'Contact'
|
||||||
|
belongs_to :admin_contact, class_name: 'Contact'
|
||||||
|
end
|
3
app/models/nameserver.rb
Normal file
3
app/models/nameserver.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class Nameserver < ActiveRecord::Base
|
||||||
|
has_and_belongs_to_many :ns_sets
|
||||||
|
end
|
5
app/models/ns_set.rb
Normal file
5
app/models/ns_set.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class NsSet < ActiveRecord::Base
|
||||||
|
belongs_to :registrar
|
||||||
|
has_many :domains
|
||||||
|
has_and_belongs_to_many :nameservers
|
||||||
|
end
|
5
app/models/registrar.rb
Normal file
5
app/models/registrar.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class Registrar < ActiveRecord::Base
|
||||||
|
belongs_to :country
|
||||||
|
has_many :domains
|
||||||
|
has_many :ns_sets
|
||||||
|
end
|
3
app/models/right.rb
Normal file
3
app/models/right.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class Right < ActiveRecord::Base
|
||||||
|
has_and_belongs_to_many :roles
|
||||||
|
end
|
4
app/models/role.rb
Normal file
4
app/models/role.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
class Role < ActiveRecord::Base
|
||||||
|
has_many :users
|
||||||
|
has_and_belongs_to_many :rights
|
||||||
|
end
|
3
app/models/user.rb
Normal file
3
app/models/user.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
class User < ActiveRecord::Base
|
||||||
|
belongs_to :role
|
||||||
|
end
|
16
bin/rspec
Executable file
16
bin/rspec
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'rspec' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
require 'pathname'
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
||||||
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
|
require 'rubygems'
|
||||||
|
require 'bundler/setup'
|
||||||
|
|
||||||
|
load Gem.bin_path('rspec-core', 'rspec')
|
125
db/migrate/20140616073945_init.rb
Normal file
125
db/migrate/20140616073945_init.rb
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
class Init < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :domains do |t|
|
||||||
|
t.string :name #ascii, utf8 will be converted on the fly
|
||||||
|
t.integer :registrar_id #registripidaja
|
||||||
|
t.datetime :registered_at
|
||||||
|
t.string :status
|
||||||
|
t.datetime :valid_from
|
||||||
|
t.datetime :valid_to
|
||||||
|
t.integer :owner_contact_id
|
||||||
|
t.integer :admin_contact_id
|
||||||
|
t.integer :technical_contact_id
|
||||||
|
t.integer :ns_set_id
|
||||||
|
t.string :auth_info
|
||||||
|
#t.integer :keyset_id #dnssec
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
# this will be a huge table?
|
||||||
|
create_table :contacts do |t|
|
||||||
|
t.string :code #CID:STRING:OID
|
||||||
|
t.string :name
|
||||||
|
t.string :type #organisation / juridical / citizen #rails specific variable
|
||||||
|
t.string :reg_no #identity code or registration number for organisation
|
||||||
|
|
||||||
|
# can a person have one or more of these contacts?
|
||||||
|
t.string :phone
|
||||||
|
t.string :email
|
||||||
|
t.string :fax
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :addresses do |t| #needs a better name?
|
||||||
|
t.integer :contact_id
|
||||||
|
t.integer :country_id
|
||||||
|
t.string :city
|
||||||
|
t.string :address #Street + house + apartment #needs a better name
|
||||||
|
t.string :zip
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :country_id do |t|
|
||||||
|
t.string :iso
|
||||||
|
t.string :name
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :registrars do |t|
|
||||||
|
t.string :name
|
||||||
|
t.string :reg_no
|
||||||
|
t.string :vat_no
|
||||||
|
t.string :address
|
||||||
|
t.integer :country_id
|
||||||
|
t.string :billing_address
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
#legal documents
|
||||||
|
# create_table :documents do |t|
|
||||||
|
# t.integer :domain_id
|
||||||
|
# t.string :name
|
||||||
|
# t.status :document_type #if this is registration document or deletion document
|
||||||
|
|
||||||
|
# t.timestamps
|
||||||
|
# end
|
||||||
|
|
||||||
|
create_table :ns_sets do |t|
|
||||||
|
t.string :code #NSSID:STRING:OID
|
||||||
|
t.integer :registrar_id
|
||||||
|
t.string :auth_info #password for transferring between registrants
|
||||||
|
t.string :report_level
|
||||||
|
|
||||||
|
#t.integer :technical_contact_id # reference to technical contact -
|
||||||
|
#does each ns_set have spearate technical contacts or can the contacts be inherited from the registrar?
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :nameservers_ns_sets do |t|
|
||||||
|
t.integer :nameserver_id
|
||||||
|
t.integer :ns_set_id
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :nameservers do |t|
|
||||||
|
t.string :name
|
||||||
|
t.string :ip
|
||||||
|
t.integer :ns_set_id
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
#devise for login
|
||||||
|
#cancan for securing
|
||||||
|
#what to do with API users?
|
||||||
|
create_table :users do |t|
|
||||||
|
t.string :username
|
||||||
|
t.string :password
|
||||||
|
t.integer :role_id #can user have more than one role?
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :roles do |t|
|
||||||
|
t.string :name
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :rights_roles do |t|
|
||||||
|
t.integer :right_id
|
||||||
|
t.integer :role_id
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :rights do |t|
|
||||||
|
t.string :code #LOG_IN, SEE_DOMAINS, etc
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
122
db/schema.rb
Normal file
122
db/schema.rb
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
# encoding: UTF-8
|
||||||
|
# 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: 20140616073945) do
|
||||||
|
|
||||||
|
# These are extensions that must be enabled in order to support this database
|
||||||
|
enable_extension "plpgsql"
|
||||||
|
|
||||||
|
create_table "addresses", force: true do |t|
|
||||||
|
t.integer "contact_id"
|
||||||
|
t.integer "country_id"
|
||||||
|
t.string "city"
|
||||||
|
t.string "address"
|
||||||
|
t.string "zip"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "contacts", force: true do |t|
|
||||||
|
t.string "code"
|
||||||
|
t.string "name"
|
||||||
|
t.string "type"
|
||||||
|
t.string "reg_no"
|
||||||
|
t.string "phone"
|
||||||
|
t.string "email"
|
||||||
|
t.string "fax"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "country_id", force: true do |t|
|
||||||
|
t.string "iso"
|
||||||
|
t.string "name"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "domains", force: true do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.integer "registrar_id"
|
||||||
|
t.datetime "registered_at"
|
||||||
|
t.string "status"
|
||||||
|
t.datetime "valid_from"
|
||||||
|
t.datetime "valid_to"
|
||||||
|
t.integer "owner_contact_id"
|
||||||
|
t.integer "admin_contact_id"
|
||||||
|
t.integer "technical_contact_id"
|
||||||
|
t.integer "ns_set_id"
|
||||||
|
t.string "auth_info"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "nameservers", force: true do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.string "ip"
|
||||||
|
t.integer "ns_set_id"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "nameservers_ns_sets", force: true do |t|
|
||||||
|
t.integer "nameserver_id"
|
||||||
|
t.integer "ns_set_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "ns_sets", force: true do |t|
|
||||||
|
t.string "code"
|
||||||
|
t.integer "registrar_id"
|
||||||
|
t.string "auth_info"
|
||||||
|
t.string "report_level"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "registrars", force: true do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.string "reg_no"
|
||||||
|
t.string "vat_no"
|
||||||
|
t.string "address"
|
||||||
|
t.integer "country_id"
|
||||||
|
t.string "billing_address"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "rights", force: true do |t|
|
||||||
|
t.string "code"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "rights_roles", force: true do |t|
|
||||||
|
t.integer "right_id"
|
||||||
|
t.integer "role_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "roles", force: true do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "users", force: true do |t|
|
||||||
|
t.string "username"
|
||||||
|
t.string "password"
|
||||||
|
t.integer "role_id"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
3
spec/fabricators/domain_fabricator.rb
Normal file
3
spec/fabricators/domain_fabricator.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Fabricator(:domain) do
|
||||||
|
name { "#{Faker::Internet.domain_word}.ee" }
|
||||||
|
end
|
6
spec/models/address_spec.rb
Normal file
6
spec/models/address_spec.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe Address do
|
||||||
|
it { should belong_to(:contact) }
|
||||||
|
it { should belong_to(:country) }
|
||||||
|
end
|
5
spec/models/contact_spec.rb
Normal file
5
spec/models/contact_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe Contact do
|
||||||
|
it { should have_many(:addresses) }
|
||||||
|
end
|
14
spec/models/domain_spec.rb
Normal file
14
spec/models/domain_spec.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe Domain do
|
||||||
|
it { should belong_to(:registrar) }
|
||||||
|
it { should belong_to(:ns_set) }
|
||||||
|
it { should belong_to(:admin_contact) }
|
||||||
|
it { should belong_to(:owner_contact) }
|
||||||
|
it { should belong_to(:technical_contact) }
|
||||||
|
|
||||||
|
it 'creates a resource' do
|
||||||
|
d = Fabricate(:domain)
|
||||||
|
expect(d.name).to_not be_nil
|
||||||
|
end
|
||||||
|
end
|
5
spec/models/nameserver_spec.rb
Normal file
5
spec/models/nameserver_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe Nameserver do
|
||||||
|
it { should have_and_belong_to_many(:ns_sets) }
|
||||||
|
end
|
6
spec/models/ns_set_spec.rb
Normal file
6
spec/models/ns_set_spec.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe NsSet do
|
||||||
|
it { should belong_to(:registrar)}
|
||||||
|
it { should have_and_belong_to_many(:nameservers) }
|
||||||
|
end
|
7
spec/models/registrar_spec.rb
Normal file
7
spec/models/registrar_spec.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe Registrar do
|
||||||
|
it { should belong_to(:country) }
|
||||||
|
it { should have_many(:domains) }
|
||||||
|
it { should have_many(:ns_sets) }
|
||||||
|
end
|
5
spec/models/right_spec.rb
Normal file
5
spec/models/right_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe Right do
|
||||||
|
it { should have_and_belong_to_many(:roles) }
|
||||||
|
end
|
5
spec/models/role_spec.rb
Normal file
5
spec/models/role_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe Role do
|
||||||
|
it { should have_and_belong_to_many(:rights) }
|
||||||
|
end
|
5
spec/models/user_spec.rb
Normal file
5
spec/models/user_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe User do
|
||||||
|
it { should belong_to(:role) }
|
||||||
|
end
|
48
spec/rails_helper.rb
Normal file
48
spec/rails_helper.rb
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||||
|
ENV["RAILS_ENV"] ||= 'test'
|
||||||
|
require 'spec_helper'
|
||||||
|
require File.expand_path("../../config/environment", __FILE__)
|
||||||
|
require 'rspec/rails'
|
||||||
|
require 'shoulda/matchers'
|
||||||
|
|
||||||
|
# Requires supporting ruby files with custom matchers and macros, etc, in
|
||||||
|
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
||||||
|
# run as spec files by default. This means that files in spec/support that end
|
||||||
|
# in _spec.rb will both be required and run as specs, causing the specs to be
|
||||||
|
# run twice. It is recommended that you do not name files matching this glob to
|
||||||
|
# end with _spec.rb. You can configure this pattern with with the --pattern
|
||||||
|
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
||||||
|
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
||||||
|
|
||||||
|
# Checks for pending migrations before tests are run.
|
||||||
|
# If you are not using ActiveRecord, you can remove this line.
|
||||||
|
ActiveRecord::Migration.maintain_test_schema!
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||||
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||||
|
|
||||||
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||||
|
# examples within a transaction, remove the following line or assign false
|
||||||
|
# instead of true.
|
||||||
|
config.use_transactional_fixtures = true
|
||||||
|
|
||||||
|
# RSpec Rails can automatically mix in different behaviours to your tests
|
||||||
|
# based on their file location, for example enabling you to call `get` and
|
||||||
|
# `post` in specs under `spec/controllers`.
|
||||||
|
#
|
||||||
|
# You can disable this behaviour by removing the line below, and instead
|
||||||
|
# explicitly tag your specs with their type, e.g.:
|
||||||
|
#
|
||||||
|
# RSpec.describe UsersController, :type => :controller do
|
||||||
|
# # ...
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# The different available types are documented in the features, such as in
|
||||||
|
# https://relishapp.com/rspec/rspec-rails/docs
|
||||||
|
config.infer_spec_type_from_file_location!
|
||||||
|
|
||||||
|
config.expect_with :rspec do |c|
|
||||||
|
c.syntax = :expect
|
||||||
|
end
|
||||||
|
end
|
78
spec/spec_helper.rb
Normal file
78
spec/spec_helper.rb
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
||||||
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
||||||
|
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
||||||
|
# file to always be loaded, without a need to explicitly require it in any files.
|
||||||
|
#
|
||||||
|
# Given that it is always loaded, you are encouraged to keep this file as
|
||||||
|
# light-weight as possible. Requiring heavyweight dependencies from this file
|
||||||
|
# will add to the boot time of your test suite on EVERY test run, even for an
|
||||||
|
# individual file that may not need all of that loaded. Instead, make a
|
||||||
|
# separate helper file that requires this one and then use it only in the specs
|
||||||
|
# that actually need it.
|
||||||
|
#
|
||||||
|
# The `.rspec` file also contains a few flags that are not defaults but that
|
||||||
|
# users commonly want.
|
||||||
|
#
|
||||||
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
||||||
|
RSpec.configure do |config|
|
||||||
|
# The settings below are suggested to provide a good initial experience
|
||||||
|
# with RSpec, but feel free to customize to your heart's content.
|
||||||
|
=begin
|
||||||
|
# These two settings work together to allow you to limit a spec run
|
||||||
|
# to individual examples or groups you care about by tagging them with
|
||||||
|
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
||||||
|
# get run.
|
||||||
|
config.filter_run :focus
|
||||||
|
config.run_all_when_everything_filtered = true
|
||||||
|
|
||||||
|
# Many RSpec users commonly either run the entire suite or an individual
|
||||||
|
# file, and it's useful to allow more verbose output when running an
|
||||||
|
# individual spec file.
|
||||||
|
if config.files_to_run.one?
|
||||||
|
# Use the documentation formatter for detailed output,
|
||||||
|
# unless a formatter has already been configured
|
||||||
|
# (e.g. via a command-line flag).
|
||||||
|
config.default_formatter = 'doc'
|
||||||
|
end
|
||||||
|
|
||||||
|
# Print the 10 slowest examples and example groups at the
|
||||||
|
# end of the spec run, to help surface which specs are running
|
||||||
|
# particularly slow.
|
||||||
|
config.profile_examples = 10
|
||||||
|
|
||||||
|
# Run specs in random order to surface order dependencies. If you find an
|
||||||
|
# order dependency and want to debug it, you can fix the order by providing
|
||||||
|
# the seed, which is printed after each run.
|
||||||
|
# --seed 1234
|
||||||
|
config.order = :random
|
||||||
|
|
||||||
|
# Seed global randomization in this process using the `--seed` CLI option.
|
||||||
|
# Setting this allows you to use `--seed` to deterministically reproduce
|
||||||
|
# test failures related to randomization by passing the same `--seed` value
|
||||||
|
# as the one that triggered the failure.
|
||||||
|
Kernel.srand config.seed
|
||||||
|
|
||||||
|
# rspec-expectations config goes here. You can use an alternate
|
||||||
|
# assertion/expectation library such as wrong or the stdlib/minitest
|
||||||
|
# assertions if you prefer.
|
||||||
|
config.expect_with :rspec do |expectations|
|
||||||
|
# Enable only the newer, non-monkey-patching expect syntax.
|
||||||
|
# For more details, see:
|
||||||
|
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
||||||
|
expectations.syntax = :expect
|
||||||
|
end
|
||||||
|
|
||||||
|
# rspec-mocks config goes here. You can use an alternate test double
|
||||||
|
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
||||||
|
config.mock_with :rspec do |mocks|
|
||||||
|
# Enable only the newer, non-monkey-patching expect syntax.
|
||||||
|
# For more details, see:
|
||||||
|
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
||||||
|
mocks.syntax = :expect
|
||||||
|
|
||||||
|
# Prevents you from mocking or stubbing a method that does not exist on
|
||||||
|
# a real object. This is generally recommended.
|
||||||
|
mocks.verify_partial_doubles = true
|
||||||
|
end
|
||||||
|
=end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue