Top Level Namespace
Defined Under Namespace
Modules: CachingHelpers, Capybara, Refinery, WillPaginate
Classes: ApplicationController, RefineryInflector
Constant Summary
collapse
- APP_RAKEFILE =
File.expand_path("../spec/dummy/Rakefile", __FILE__)
Instance Method Summary
collapse
Instance Method Details
#edit_selector(class_name: nil, locale: nil, slug: nil) ⇒ Object
various edit actions selectors: there are several in a single index entry
- the page title is wrapped in an edit link
page title
- if there are several locales there is an edit_in_locale link for each locale
- the actions group has an edit icon with a link to edit the page (equivalent to 1)
19
20
21
22
23
|
# File 'pages/spec/support/selector_helpers.rb', line 19
def edit_selector(class_name: nil, locale: nil, slug: nil)
class_selector = [class_name, 'edit'].compact.join('.')
query_selector = ("?switch_locale=#{locale}" if locale.present?)
"a.#{class_selector}[href$='#{slug}/edit#{query_selector}']"
end
|
#ensure_on(path) ⇒ Object
13
14
15
|
# File 'images/spec/support/spec_helper.rb', line 13
def ensure_on(path)
visit(path) unless current_path == path
end
|
#expect_window_with_content(content, window: windows.last) ⇒ Object
4
5
6
7
8
|
# File 'pages/spec/system/refinery/admin/pages_spec.rb', line 4
def expect_window_with_content(content, window: windows.last)
page.within_window window do
expect(page).to have_content(content)
end
end
|
#expect_window_without_content(content, window: windows.last) ⇒ Object
10
11
12
13
14
|
# File 'pages/spec/system/refinery/admin/pages_spec.rb', line 10
def expect_window_without_content(content, window: windows.last)
page.within_window window do
expect(page).not_to have_content(content)
end
end
|
#icon_link_selector(slug: '') ⇒ Object
29
30
31
|
# File 'pages/spec/support/selector_helpers.rb', line 29
def icon_link_selector(slug: '')
edit_selector(slug: slug, class_name: :edit_icon)
end
|
#index_entry ⇒ Object
3
4
5
|
# File 'pages/spec/support/selector_helpers.rb', line 3
def index_entry
'li.record.page'
end
|
#index_item(id) ⇒ Object
7
8
9
|
# File 'pages/spec/support/selector_helpers.rb', line 7
def index_item(id)
[id, '.item'].join(' ')
end
|
#locale_link_selector(locale:, slug: '') ⇒ Object
33
34
35
|
# File 'pages/spec/support/selector_helpers.rb', line 33
def locale_link_selector(locale:, slug: '')
edit_selector(slug: slug, class_name: :locale, locale: locale.downcase)
end
|
#locale_picker(locale) ⇒ Object
41
42
43
|
# File 'pages/spec/support/selector_helpers.rb', line 41
def locale_picker(locale)
".locales ##{locale}"
end
|
#locales ⇒ Object
37
38
39
|
# File 'pages/spec/support/selector_helpers.rb', line 37
def locales
"span.locales"
end
|
#preview_image ⇒ Object
1
2
3
4
5
6
7
8
9
10
|
# File 'images/spec/support/shared_examples/image_previewer.rb', line 1
def preview_image
preview_window = window_opened_by do
find(:linkhref, image_url).click
end
page.within_window preview_window do
expect(page).to have_image(image_url)
end
preview_window.close
end
|
#switch_page_form_locale(locale) ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'pages/spec/system/refinery/admin/pages_spec.rb', line 16
def switch_page_form_locale(locale)
within "#switch_locale_picker" do
find("a", id: locale.downcase).click
end
expect(page).to have_selector("#switch_locale_picker a.selected##{locale.downcase}")
end
|
#title_link_selector(slug: '') ⇒ Object
25
26
27
|
# File 'pages/spec/support/selector_helpers.rb', line 25
def title_link_selector(slug: '')
edit_selector(slug: slug, class_name: :title)
end
|
#uri_filename(url) ⇒ Object
16
17
18
|
# File 'resources/spec/spec_helper.rb', line 16
def uri_filename(url)
File.basename(URI.parse(url).path)
end
|