OSDN Git Service

basic認証をproductionのみに限定 master
authorcake <cake@users.sourceforge.jp>
Tue, 30 Nov 2010 14:22:42 +0000 (23:22 +0900)
committercake <cake@users.sourceforge.jp>
Tue, 30 Nov 2010 14:22:42 +0000 (23:22 +0900)
app/controllers/application_controller.rb
config/config.yml
spec/controllers/songs_controller_spec.rb
spec/support/blueprints.rb

index 8b8ec10..ded529e 100644 (file)
@@ -8,6 +8,7 @@ class ApplicationController < ActionController::Base
   filter_parameter_logging :password
 
   def authenticate
+    return true if RAILS_ENV.downcase != "production"
     authenticate_or_request_with_http_basic do |user_name, password|
       user_name == AppConfig.user_name && password == AppConfig.password
     end
index 60ff807..1ede9df 100644 (file)
@@ -5,3 +5,8 @@ development:
   <<: *common
   user_name: 'user'
   password: 'pass'
+
+test:
+  <<: *common
+  user_name: 'test_user'
+  password: 'test_pass'
index c7be5f0..b3f24ea 100644 (file)
@@ -7,4 +7,15 @@ describe SongsController do
     controller.should be_an_instance_of(SongsController)
   end
 
+  it "トップページにアクセスできる" do
+    get :index
+    response.should be_success
+  end
+  
+  it "新しい曲のフォーム" do
+    get :new
+    assigns[:song].should be_instance_of Song
+  end
+
+
 end
index 8278b82..0bf614a 100644 (file)
@@ -1,11 +1,5 @@
 require 'machinist/active_record'
 
-Program.blueprint do
-  name { "a program" }
-  note { "a note about this program..." }
-  play_on { Date.today }
-end
-
 Song.blueprint do
   code { "C" }
   title { "a title of song" }