Project

General

Profile

Download (764 Bytes) Statistics
| Branch: | Tag: | Revision:

foreman_docker / test / test_plugin_helper.rb @ f6a9acbd

1
# This calls the main test_helper in Foreman-core
2
require 'test_helper'
3

    
4
def assert_row_button(index_path, link_text, button_text, dropdown = false)
5
  visit index_path
6
  within(:xpath, "//tr[contains(.,'#{link_text}')]") do
7
    find("i.caret").click if dropdown
8
    click_link(button_text)
9
  end
10
end
11

    
12
# Add plugin to FactoryGirl's paths
13
FactoryGirl.definition_file_paths << File.join(File.dirname(__FILE__), 'factories')
14
FactoryGirl.reload
15

    
16
def stub_image_existance(exists = true)
17
  Docker::Image.any_instance.stubs(:exist?).returns(exists)
18
  ForemanDocker::ImageSearch.any_instance.stubs(:available?).returns(exists)
19
end
20

    
21
def stub_registry_api
22
  Service::RegistryApi.any_instance.stubs(:get).returns({'results' => []})
23
  Docker::Image.stubs(:all).returns([])
24
end