Sha256: 2397a61701866f8ee108611dfc3197214e9136f6c7193ccca91d2eac52cc5d8d

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require 'rails/test_help'
require 'shoulda'
require 'factory_girl'
require 'sqlite3'
require 'faker'

ActionMailer::Base.delivery_method    = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.default_url_options[:host] = "example.com"

Rails.backtrace_cleaner.remove_silencers!

# Configure capybara for integration testing
require "capybara/rails"
require "selenium/webdriver"

Capybara.default_driver   = :selenium
Capybara.default_selector = :css

# Define a bare test case to use with Capybara
class ActiveSupport::IntegrationCase < ActiveSupport::TestCase
  
  include Capybara
  include Rails.application.routes.url_helpers
  
  self.use_transactional_fixtures = false
   
  def assert_seen(text, opts={})
    if opts[:within]
      within(opts[:within]) do
        assert has_content?(text)
      end
    else
      assert has_content?(text)
    end
  end
  
  def assert_flash(key, text)
    within(".flash.#{key}") do
      assert_seen(text)
    end
  end
  
  def assert_title(title)
    assert_seen title, :within => "head title"
  end

  def assert_meta(tag, text)
    tag = find(:xpath, "//head/meta[@name='#{tag.to_s}']")
    assert_equal text, tag.native.attribute("content")
  end
    
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_essentials-0.1.2 lib/spree_essentials/test_helper.rb
spree_essentials-0.1.1 lib/spree_essentials/test_helper.rb