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

#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

#preview_imageObject



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", text: locale.upcase).click
  end

  # make sure that the locale change has taken effect
  expect(page).to have_selector("#switch_locale_picker li.selected a##{locale.downcase}")
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