-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
models and validations for sound and sound pattern
- Loading branch information
1 parent
3f68e8f
commit 10b495a
Showing
14 changed files
with
217 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
class Sound < ActiveRecord::Base | ||
validates_presence_of :name | ||
validates_presence_of :url | ||
has_many :sound_patterns | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class SoundPattern < ActiveRecord::Base | ||
belongs_to :sound | ||
validates_presence_of :pattern | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class CreateSoundPatterns < ActiveRecord::Migration | ||
def change | ||
create_table :sound_patterns do |t| | ||
t.string :pattern | ||
t.references :sound, index: true | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# src_files | ||
# | ||
# Return an array of filepaths relative to src_dir to include before jasmine specs. | ||
# Default: [] | ||
# | ||
# EXAMPLE: | ||
# | ||
# src_files: | ||
# - lib/source1.js | ||
# - lib/source2.js | ||
# - dist/**/*.js | ||
# | ||
src_files: | ||
- assets/application.js | ||
|
||
# stylesheets | ||
# | ||
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs. | ||
# Default: [] | ||
# | ||
# EXAMPLE: | ||
# | ||
# stylesheets: | ||
# - css/style.css | ||
# - stylesheets/*.css | ||
# | ||
stylesheets: | ||
- stylesheets/**/*.css | ||
|
||
# helpers | ||
# | ||
# Return an array of filepaths relative to spec_dir to include before jasmine specs. | ||
# Default: ["helpers/**/*.js"] | ||
# | ||
# EXAMPLE: | ||
# | ||
# helpers: | ||
# - helpers/**/*.js | ||
# | ||
helpers: | ||
- 'helpers/**/*.js' | ||
|
||
# spec_files | ||
# | ||
# Return an array of filepaths relative to spec_dir to include. | ||
# Default: ["**/*[sS]pec.js"] | ||
# | ||
# EXAMPLE: | ||
# | ||
# spec_files: | ||
# - **/*[sS]pec.js | ||
# | ||
spec_files: | ||
- '**/*[sS]pec.js' | ||
|
||
# src_dir | ||
# | ||
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank. | ||
# Default: project root | ||
# | ||
# EXAMPLE: | ||
# | ||
# src_dir: public | ||
# | ||
src_dir: | ||
|
||
# spec_dir | ||
# | ||
# Spec directory path. Your spec_files must be returned relative to this path. | ||
# Default: spec/javascripts | ||
# | ||
# EXAMPLE: | ||
# | ||
# spec_dir: spec/javascripts | ||
# | ||
spec_dir: | ||
|
||
# spec_helper | ||
# | ||
# Ruby file that Jasmine server will require before starting. | ||
# Returned relative to your root path | ||
# Default spec/javascripts/support/jasmine_helper.rb | ||
# | ||
# EXAMPLE: | ||
# | ||
# spec_helper: spec/javascripts/support/jasmine_helper.rb | ||
# | ||
spec_helper: spec/javascripts/support/jasmine_helper.rb | ||
|
||
# boot_dir | ||
# | ||
# Boot directory path. Your boot_files must be returned relative to this path. | ||
# Default: Built in boot file | ||
# | ||
# EXAMPLE: | ||
# | ||
# boot_dir: spec/javascripts/support/boot | ||
# | ||
boot_dir: | ||
|
||
# boot_files | ||
# | ||
# Return an array of filepaths relative to boot_dir to include in order to boot Jasmine | ||
# Default: Built in boot file | ||
# | ||
# EXAMPLE | ||
# | ||
# boot_files: | ||
# - '**/*.js' | ||
# | ||
boot_files: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#Use this file to set/override Jasmine configuration options | ||
#You can remove it if you don't need it. | ||
#This file is loaded *after* jasmine.yml is interpreted. | ||
# | ||
#Example: using a different boot file. | ||
#Jasmine.configure do |config| | ||
# config.boot_dir = '/absolute/path/to/boot_dir' | ||
# config.boot_files = lambda { ['/absolute/path/to/boot_dir/file.js'] } | ||
#end | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'spec_helper' | ||
|
||
describe SoundPattern do | ||
it { should validate_presence_of :pattern } | ||
it { should belong_to :sound } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'spec_helper' | ||
|
||
describe Sound do | ||
it { should validate_presence_of :name } | ||
it { should validate_presence_of :url } | ||
it { should have_many :sound_patterns } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# This file is copied to spec/ when you run 'rails generate rspec:install' | ||
ENV["RAILS_ENV"] ||= 'test' | ||
require File.expand_path("../../config/environment", __FILE__) | ||
|
||
require 'simplecov' | ||
require 'rspec/rails' | ||
require 'rspec/autorun' | ||
# require 'capybara/rails' | ||
|
||
# Requires supporting ruby files with custom matchers and macros, etc, | ||
# in spec/support/ and its subdirectories. | ||
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.check_pending! if defined?(ActiveRecord::Migration) | ||
|
||
RSpec.configure do |config| | ||
# ## Mock Framework | ||
# | ||
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: | ||
# | ||
# config.mock_with :mocha | ||
# config.mock_with :flexmock | ||
# config.mock_with :rr | ||
|
||
# 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 | ||
|
||
# If true, the base class of anonymous controllers will be inferred | ||
# automatically. This will be the default behavior in future versions of | ||
# rspec-rails. | ||
config.infer_base_class_for_anonymous_controllers = false | ||
|
||
# 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" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
|
||
one: | ||
pattern: MyString | ||
sound_id: | ||
|
||
two: | ||
pattern: MyString | ||
sound_id: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'test_helper' | ||
|
||
class SoundPatternTest < ActiveSupport::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end |