OSDN Git Service

add controller songs_controller
authorshimada <shimada.cake@gmail.com>
Sat, 15 May 2010 05:28:30 +0000 (14:28 +0900)
committershimada <shimada.cake@gmail.com>
Sat, 15 May 2010 05:28:30 +0000 (14:28 +0900)
14 files changed:
app/controllers/base_controller.rb [new file with mode: 0644]
app/controllers/songs_controller.rb [new file with mode: 0644]
app/helpers/songs_helper.rb [new file with mode: 0644]
app/models/song.rb [new file with mode: 0644]
config/routes.rb
db/migrate/20100424171005_create_songs.rb [new file with mode: 0644]
log/development.log [deleted file]
log/production.log [deleted file]
log/server.log [deleted file]
log/test.log [deleted file]
spec/controllers/songs_controller_spec.rb [new file with mode: 0644]
spec/fixtures/songs.yml [new file with mode: 0644]
spec/helpers/songs_helper_spec.rb [new file with mode: 0644]
spec/models/song_spec.rb [new file with mode: 0644]

diff --git a/app/controllers/base_controller.rb b/app/controllers/base_controller.rb
new file mode 100644 (file)
index 0000000..69e252e
--- /dev/null
@@ -0,0 +1,3 @@
+class BaseController < ApplicationController
+  layout 'base'
+end
diff --git a/app/controllers/songs_controller.rb b/app/controllers/songs_controller.rb
new file mode 100644 (file)
index 0000000..6755560
--- /dev/null
@@ -0,0 +1,2 @@
+class SongsController < ApplicationController
+end
diff --git a/app/helpers/songs_helper.rb b/app/helpers/songs_helper.rb
new file mode 100644 (file)
index 0000000..75baad2
--- /dev/null
@@ -0,0 +1,2 @@
+module SongsHelper
+end
diff --git a/app/models/song.rb b/app/models/song.rb
new file mode 100644 (file)
index 0000000..091746f
--- /dev/null
@@ -0,0 +1,2 @@
+class Song < ActiveRecord::Base
+end
index ea14ce1..d35527e 100644 (file)
@@ -1,5 +1,6 @@
 ActionController::Routing::Routes.draw do |map|
   # The priority is based upon order of creation: first created -> highest priority.
+  map.resources :songs
 
   # Sample of regular route:
   #   map.connect 'products/:id', :controller => 'catalog', :action => 'view'
diff --git a/db/migrate/20100424171005_create_songs.rb b/db/migrate/20100424171005_create_songs.rb
new file mode 100644 (file)
index 0000000..7634101
--- /dev/null
@@ -0,0 +1,19 @@
+class CreateSongs < ActiveRecord::Migration
+  def self.up
+    create_table :songs do |t|
+      t.string :code, :limit => 5, :null => false, :default => "", :comment => "曲のコード"
+      t.string :title,             :null => false, :default => "", :comment => "曲名"
+      t.text :words,               :null => false, :default => "", :comment => "歌詞本体"
+      t.text :words_for_search,    :null => false, :default => "", :comment => "歌詞検索用のデータ"
+      t.string :copyright,         :null => false, :default => "", :comment => "楽曲の出典"
+      t.int :font_size,            :null => false, :default => 4,  :comment => "表示フォントサイズ"
+      t.datetime :deleted_at,                                      :comment => "削除タイムスタンプ"
+
+      t.timestamps
+    end
+  end
+
+  def self.down
+    drop_table :songs
+  end
+end
diff --git a/log/development.log b/log/development.log
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/log/production.log b/log/production.log
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/log/server.log b/log/server.log
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/log/test.log b/log/test.log
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/spec/controllers/songs_controller_spec.rb b/spec/controllers/songs_controller_spec.rb
new file mode 100644 (file)
index 0000000..c7be5f0
--- /dev/null
@@ -0,0 +1,10 @@
+require 'spec_helper'
+
+describe SongsController do
+
+  #Delete this example and add some real ones
+  it "should use SongsController" do
+    controller.should be_an_instance_of(SongsController)
+  end
+
+end
diff --git a/spec/fixtures/songs.yml b/spec/fixtures/songs.yml
new file mode 100644 (file)
index 0000000..9988415
--- /dev/null
@@ -0,0 +1,19 @@
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
+
+one:
+  code: MyString
+  title: MyString
+  words: MyText
+  kana: MyText
+  cright: MyString
+  font_size: 
+  deleted_at: 2010-04-25 02:10:05
+
+two:
+  code: MyString
+  title: MyString
+  words: MyText
+  kana: MyText
+  cright: MyString
+  font_size: 
+  deleted_at: 2010-04-25 02:10:05
diff --git a/spec/helpers/songs_helper_spec.rb b/spec/helpers/songs_helper_spec.rb
new file mode 100644 (file)
index 0000000..a21ef2a
--- /dev/null
@@ -0,0 +1,11 @@
+require 'spec_helper'
+
+describe SongsHelper do
+
+  #Delete this example and add some real ones or delete this file
+  it "should be included in the object returned by #helper" do
+    included_modules = (class << helper; self; end).send :included_modules
+    included_modules.should include(SongsHelper)
+  end
+
+end
diff --git a/spec/models/song_spec.rb b/spec/models/song_spec.rb
new file mode 100644 (file)
index 0000000..27a9eb8
--- /dev/null
@@ -0,0 +1,19 @@
+require 'spec_helper'
+
+describe Song do
+  before(:each) do
+    @valid_attributes = {
+      :code => "value for code",
+      :title => "value for title",
+      :words => "value for words",
+      :kana => "value for kana",
+      :cright => "value for cright",
+      :font_size => 1,
+      :deleted_at => Time.now
+    }
+  end
+
+  it "should create a new instance given valid attributes" do
+    Song.create!(@valid_attributes)
+  end
+end