else
nil
end
+ @demand_user = if demand_user_signed_in?
+ current_demand_user
+ else
+ nil
+ end
end
end
30
end
- def self.max_panel_size
- 200
- end
-
def self.page prm = nil
page = prm.to_i
page = 1 if page < 1
r.provider_status_id = nil
end
end
- r.save
+ raise ActiveRecord::Rollback unless r.save
end
r
end
<%= link_to 'system_pictures', main_app.system_pictures_path %>\r
</div>\r
<%= yield %>\r
+<div>\r
+demanders\r
+<% if demand_user_signed_in? %>\r
+ <%= link_to "demanders", main_app.demanders_path %>\r
+ <%= link_to "sign out", main_app.destroy_demand_user_session_path, :method => :delete %>\r
+<% else %>\r
+ <%= link_to "sign in", main_app.new_demand_user_session_path %>\r
+<% end %>\r
+</div>\r
<%= javascript_tag 'var server_result=' + @server_result.to_json + ';' %>\r
\r
</body>\r
<% if @provider_status.status == 0 %>
<%= link_to 'この貸手からの借受を開始する', edit_provider_status_path(@provider_status) %>
<% else %>
- <%= link_to '借受を停止する', destroy_provider_status_path(@provider_status) %>
+ <%= link_to '借受を停止する', provider_status_path(@provider_status), :method => :delete %>
<% end %>
</p>
<%= link_to 'Back', provider_statuses_path %>
<%= link_to '貸手', providers_path %>
</td>
</tr>
+ <tr>
+ <td>
+ <%= link_to '借受状況', provider_statuses_path %>
+ </td>
+ </tr>
+</table>
+<h1>貸手</h1>
+<table>
+ <tr>
+ <td>
+ <%= link_to '貸与状況', demander_statuses_path %>
+ </td>
+ </tr>
</table>
</div>
thumbnail_height: 64
provider_status_items: [['waiting', 0], ['receiving', 1]]
+ demander_status_items: [['waiting', 0], ['rejected', 1], ['requesting', 2], ['approved', 3]]
comic_visible_items: [['private', 0], ['public', 1]]
ground_picture_repeat_items: ['repeat', 'repeat-x', 'repeat-y', 'no-repeat']
devise_for :users , :controllers => { :registrations => "user_registrations" }
devise_for :admins
+ devise_for :demand_users
Pettanr::Application.licenses.each do |name, klass|
mount Module.const_get(klass)::Engine => "/#{name}"
delete :destroy
end
end
+ resources :demanders do
+ new do
+ get :new
+ end
+ collection do
+ get :index
+ get :show
+ post :create
+ get :list
+ get :browse
+ post :req
+ end
+ member do
+ get :edit
+ put :update
+ delete :destroy
+ end
+ end
+ resources :demander_statuses do
+ collection do
+ get :index
+ get :show
+ get :list
+ get :browse
+ end
+ member do
+ get :edit
+ put :update
+ delete :destroy
+ end
+ end
# The priority is based upon order of creation:
# first created -> highest priority.
get :index, :format => :json\r
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)\r
end\r
- it 'コミックモデルにjson一覧出力オプションを問い合わせている' do
- Comic.should_receive(:list_json_opt).exactly(1)
- get :index, :format => :json
- end
+ it 'コミックモデルにjson一覧出力オプションを問い合わせている' do\r
+ Comic.should_receive(:list_json_opt).exactly(1)\r
+ get :index, :format => :json\r
+ end\r
it 'データがリスト構造になっている' do\r
get :index, :format => :json\r
json = JSON.parse response.body\r
get :show, :id => @comic.id, :format => :json\r
lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)\r
end\r
- it 'コミックモデルにjson単体出力オプションを問い合わせている' do
- Comic.should_receive(:show_json_opt).exactly(1)
- get :show, :id => @comic.id, :format => :json
- end
+ it 'コミックモデルにjson単体出力オプションを問い合わせている' do\r
+ Comic.should_receive(:show_json_opt).exactly(1)\r
+ get :show, :id => @comic.id, :format => :json\r
+ end\r
it 'データがアレになっている' do\r
get :show, :id => @comic.id, :format => :json\r
json = JSON.parse response.body\r
response.should render_template("new")\r
end\r
end\r
- context 'json形式' do
- it 'jsonデータを返す' do
- get :new, :format => :json
- lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)
- end
- it 'コミックモデルにjson単体出力オプションを問い合わせている' do
- Comic.should_receive(:show_json_opt).exactly(1)
- get :new, :format => :json
- end
- end
+ context 'json形式' do\r
+ it 'jsonデータを返す' do\r
+ get :new, :format => :json\r
+ lambda{JSON.parse(response.body)}.should_not raise_error(JSON::ParserError)\r
+ end\r
+ it 'コミックモデルにjson単体出力オプションを問い合わせている' do\r
+ Comic.should_receive(:show_json_opt).exactly(1)\r
+ get :new, :format => :json\r
+ end\r
+ end\r
end\r
context '作家権限がないとき' do\r
before do\r
response.message.should match(/Unauthorized/)\r
end\r
end\r
+ context 'json形式' do\r
+ it 'ステータスコード401 Unauthorizedを返す' do\r
+ get :new, :format => :json\r
+ response.status.should eq 401\r
+ end\r
+ it '応答メッセージにUnauthorizedを返す' do\r
+ get :new, :format => :json\r
+ response.message.should match(/Unauthorized/)\r
+ end\r
+ end\r
end\r
end\r
\r
context '事前チェックしておく' do\r
it 'コミックモデルにデフォルト値補充を依頼している' do\r
Comic.any_instance.should_receive(:supply_default).exactly(1)\r
- post :create, :artist => @attr\r
- end
+ post :create, :comic => @attr\r
+ end\r
it 'コミックモデルにカラム値復元を依頼している' do\r
Comic.any_instance.should_receive(:attributes=).exactly(1)\r
- post :create, :artist => @attr\r
+ post :create, :comic => @attr\r
end\r
it 'コミックモデルに上書き補充を依頼している' do\r
Comic.any_instance.should_receive(:overwrite).exactly(1)\r
- post :create, :artist => @attr\r
+ post :create, :comic => @attr\r
end\r
it 'モデルに保存依頼する' do\r
Comic.any_instance.should_receive(:save).exactly(1)\r
- post :create, :artist => @attr\r
+ post :create, :comic => @attr\r
end\r
end\r
context 'つつがなく終わるとき' do\r
before do
sign_in @admin
@ps = MagicNumber['provider_sources']
- @results = @ps.map {|u| {u => {:validations => []}}}
+ @results = @ps.map {|u| {u => {'validations' => []}}}
Provider.stub(:import).with(@ps).and_return @results
end
context '事前チェックする' do
response.should render_template("edit")
end
end
- context 'js形式' do
- it 'edit.jsテンプレートを描画する' do
- get :edit, :id => @ps.id, :format => :js
- response.should render_template("edit")
- end
- end
end
context '管理者権限がないとき' do
before do
response.body.should redirect_to '/admins/sign_in'
end
end
- context 'js形式' do
- it 'ステータスコード401 Unauthorizedを返す' do
- get :edit, :id => @ps.id, :format => :js
- response.status.should eq 401
- end
- it '応答メッセージにUnauthorizedを返す' do
- get :edit, :id => @ps.id, :format => :js
- response.message.should match(/Unauthorized/)
- end
- end
end
end
# user.author FactoryGirl.create(:author_yas)
end
+ factory :demand_user, :class => DemandUser do |demand_user|
+ demand_user.sequence(:email) { |n| "hoge#{n}@gmail.com"}
+ demand_user.password "user0100"
+ demand_user.password_confirmation "user0100"
+ # user.author FactoryGirl.create(:author_yas)
+ end
+
factory :author, :class => Author do |author|
author.name nil
author.sequence(:user_id) { |n| n}
end
factory :provider, :class => Provider do |provider|
- provider.provider_status_id 1
provider.name 'admin@penguinkingdom.com'
- provider.caption 'ペンギン王国"'
+ provider.caption 'ペンギン王国'
provider.url 'http://localhost:3000/'
provider.description 'ペンギン王国はペンギン素材を豊富に用意したペンギンマニアのサイトです。'
provider.demander_url 'http://localhost:3000/demanders'
+ provider.provider_status_id 1
end
factory :provider_status, :class => ProviderStatus do |provider_status|
provider_status.stopped_at nil
end
+ factory :demander, :class => Demander do |demander|
+ demander.demand_user_id 1
+ demander.name 'admin@penguinkingdom.com'
+ demander.caption 'ペンギン王国'
+ demander.url 'http://localhost:3000/'
+ demander.description 'ペンギン王国はペンギン素材を豊富に用意したペンギンマニアのサイトです。'
+ demander.demander_url 'http://localhost:3000/demanders'
+ demander.demander_status_id 1
+ end
+
+ factory :demander_status, :class => DemanderStatus do |demander_status|
+ demander_status.requested_at nil
+ demander_status.rejected_at nil
+ demander_status.approved_at nil
+ demander_status.token nil
+ demander_status.receive_hour1 nil
+ demander_status.receive_hour2 nil
+ end
end