Rename bs_id label and key. Stub XML RPC to raise exception and fix spec. Write specs for build_lists filters. Refs #2
This commit is contained in:
parent
b89416e125
commit
0ca7c5d451
|
@ -37,7 +37,7 @@
|
|||
.columns.wat-cf
|
||||
.column.left
|
||||
.group
|
||||
= f.label :status, t("layout.build_lists.bs_id"), :class => :label
|
||||
= f.label :status, t("layout.build_lists.bs_id_search"), :class => :label
|
||||
= f.text_field :bs_id, :class => :text_field
|
||||
.column.right
|
||||
.group
|
||||
|
|
|
@ -35,4 +35,4 @@ Rosa::Application.configure do
|
|||
config.active_support.deprecation = :stderr
|
||||
end
|
||||
|
||||
require 'stub_xml_rpc'
|
||||
require 'stub_xml_rpc' # TODO stub XML calls through stubbers
|
||||
|
|
|
@ -279,7 +279,7 @@ ru:
|
|||
created_at_end: "Время постановки на сборку по:"
|
||||
notified_at_start: "Время последнего обновления от BS с:"
|
||||
notified_at_end: "Время последнего обновления от BS по:"
|
||||
bs_id: 'Id в ядре'
|
||||
bs_id_search: 'Поиск по Id'
|
||||
project_name: 'Название проекта'
|
||||
bs_id_not_set: Id еще не присвоен
|
||||
items_header: Элементы сборки
|
||||
|
|
|
@ -6,7 +6,6 @@ module XMLRPC
|
|||
case
|
||||
when args.first == 'get_status'
|
||||
{'client_count' => 1, 'count_new_task' => 2, 'count_build_task' => 3}
|
||||
# raise Timeout::Error
|
||||
else; 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,8 +2,6 @@ require 'spec_helper'
|
|||
|
||||
describe BuildListsController do
|
||||
context 'crud' do
|
||||
# let(:build_list) { Factory(:build_list) }
|
||||
|
||||
context 'for guest' do
|
||||
it 'should not be able to perform all action' do
|
||||
get :all
|
||||
|
@ -24,10 +22,37 @@ describe BuildListsController do
|
|||
before(:each) { set_session_for Factory(:admin) }
|
||||
|
||||
it "should be able to perform all action without exception" do
|
||||
any_instance_of(XMLRPC::Client) do |xml_rpc|
|
||||
stub(xml_rpc).call do |args|
|
||||
raise Timeout::Error
|
||||
end
|
||||
end
|
||||
get :all
|
||||
assigns[:build_server_status].should == {} # TODO stub to isolate
|
||||
assigns[:build_server_status].should == {}
|
||||
response.should be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'filter' do
|
||||
let(:build_list1) { Factory(:build_list_core) }
|
||||
let(:build_list2) { Factory(:build_list_core) }
|
||||
let(:build_list3) { Factory(:build_list_core) }
|
||||
before(:each) { set_session_for Factory(:admin) }
|
||||
|
||||
it 'should filter by bs_id' do
|
||||
get :all, :filter => {:bs_id => build_list1.bs_id, :project_name => 'fdsfdf', :any_other_field => 'do not matter'}
|
||||
assigns[:build_lists].should include(build_list1)
|
||||
assigns[:build_lists].should_not include(build_list2)
|
||||
assigns[:build_lists].should_not include(build_list3)
|
||||
end
|
||||
|
||||
it 'should filter by project_name' do
|
||||
# Project.where(:id => build_list2.project.id).update_all(:name => 'project_name')
|
||||
get :all, :filter => {:project_name => build_list2.project.name}
|
||||
assigns[:build_lists].should_not include(build_list1)
|
||||
assigns[:build_lists].should include(build_list2)
|
||||
assigns[:build_lists].should_not include(build_list3)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,4 +6,8 @@ Factory.define(:build_list) do |p|
|
|||
p.project_version "1.0"
|
||||
p.build_requires true
|
||||
p.update_type 'security'
|
||||
end
|
||||
end
|
||||
|
||||
Factory.define(:build_list_core, :parent => :build_list) do |p|
|
||||
p.bs_id { Factory.next(:integer) }
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue