[refs #576] Optimize tests, views and model
This commit is contained in:
parent
15a86c2ecd
commit
3d19a4f23e
|
@ -19,6 +19,6 @@ class FlashNotify < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def should_show?(cookie_id, cookie_hash_id)
|
def should_show?(cookie_id, cookie_hash_id)
|
||||||
cookie_id.to_i == id && cookie_hash_id == hash_id ? false : true
|
!(cookie_id.to_i == id && cookie_hash_id == hash_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
%h3= t("layout.flash_notifies.edit_header")
|
%h3= t("layout.flash_notifies.edit_header")
|
||||||
|
|
||||||
= form_for @flash_notify, :url => flash_notifies_path(@flash_notify), :html => { :class => :form } do |f|
|
= form_for @flash_notify, :url => flash_notify_path(@flash_notify), :html => { :class => :form } do |f|
|
||||||
= render "form", :f => f
|
= render "form", :f => f
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
%tbody
|
%tbody
|
||||||
- @flash_notifies.each do |flash_notify|
|
- @flash_notifies.each do |flash_notify|
|
||||||
%tr{:class => cycle("odd", "even")}
|
%tr{:class => cycle("odd", "even")}
|
||||||
%td= flash_notify.body_en.slice(0..15) + "..."
|
%td= flash_notify.body_en.truncate 18
|
||||||
%td= flash_notify.body_ru.slice(0..15) + "..."
|
%td= flash_notify.body_ru.truncate 18
|
||||||
%td= flash_notify.published
|
%td= flash_notify.published
|
||||||
%td
|
%td
|
||||||
= link_to t("layout.flash_notifies.edit"), edit_flash_notify_path(flash_notify)
|
= link_to t("layout.flash_notifies.edit"), edit_flash_notify_path(flash_notify)
|
||||||
|
|
|
@ -54,24 +54,16 @@ describe FlashNotifiesController do
|
||||||
set_session_for(@admin)
|
set_session_for(@admin)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should be able to perform index action' do
|
|
||||||
get :index
|
|
||||||
response.should render_template(:index)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should load 2 flash notifies objects on index' do
|
it 'should load 2 flash notifies objects on index' do
|
||||||
get :index
|
get :index
|
||||||
assigns[:flash_notifies].count.should == 2
|
assigns[:flash_notifies].count.should == 2
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should be able to perform new action' do
|
[:index, :new, :edit].each do |action|
|
||||||
get :new
|
it "should be able to perform #{action} action" do
|
||||||
response.should render_template(:new)
|
get action, :id => @flash_notify
|
||||||
end
|
response.should render_template(action)
|
||||||
|
end
|
||||||
it 'should be able to perform edit action' do
|
|
||||||
get :edit
|
|
||||||
response.should render_template(:edit)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should be able to perform create action' do
|
it 'should be able to perform create action' do
|
||||||
|
|
Loading…
Reference in New Issue