Sha256: 6ddf63d1388c9e78e8590294739a43336e2016001ee5e2488dbe916377b2e74a

Contents?: true

Size: 1.44 KB

Versions: 7

Compression:

Stored size: 1.44 KB

Contents

ENV['RAILS_ENV'] = 'test'
require 'capybara/rails'
require 'database_cleaner'
require 'capybara/dsl'
require 'active_support/all'
require 'action_controller'

include Capybara::DSL
Capybara.default_driver = :selenium
DatabaseCleaner.strategy = :truncation
Capybara.app_host = 'http://localhost:3000'

include Warden::Test::Helpers
Warden.test_mode!

require 'factory_girl'
FactoryGirl.definition_file_paths = [File.expand_path('../factories/', __FILE__)]
FactoryGirl.find_definitions
Dir[File.join(Rails.root.join('../factories'), '*.rb')].each { |f| load f }

def login_as_admin
  user = {:email => 'test@example.com', :password => '123456'}
  @me = User.find_by_email('test@example.com') || FactoryGirl.create(:admin_user, user)
  visit '/users/sign_in'
  fill_in 'Email', :with => user[:email]
  fill_in 'Password', :with => user[:password]
  click_button 'Sign in'
  #login_as(@me)
end

def build_structures
  [{"title" => "node-1", "parent_name" => ""},
  {"title" => "node-1-1", "parent_name" => "node-1"},
  {"title" => "node-1-2", "parent_name" => "node-1"},
  {"title" => "node-2", "parent_name" => ""},
  {"title" => "node-2-1", "parent_name" => "node-2"},
  {"title" => "node-2-1-1", "parent_name" => "node-2-1"}].each do |attrs|
    parent = Structure.joins(:translations).where("structure_translations.title='#{attrs['parent_name']}'").first
    FactoryGirl.create(:structure_page, :title => attrs['title'], :parent => parent)
  end
  visit '/admin/structures'
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ab_admin-0.2.3 spec/dummy/lib/capybara_irb.rb
ab_admin-0.2.2 spec/dummy/lib/capybara_irb.rb
ab_admin-0.2.1 spec/dummy/lib/capybara_irb.rb
ab_admin-0.2.0 spec/dummy/lib/capybara_irb.rb
ab_admin-0.1.2 spec/dummy/lib/capybara_irb.rb
ab_admin-0.1.1 spec/dummy/lib/capybara_irb.rb
ab_admin-0.1.0 spec/dummy/lib/capybara_irb.rb