Sha256: a7b6c5d11e4e9d35df61265d8ea8f22f706eabad6c9451d33fd055f150388e31

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

# Configure Rails Environment
ENV["RAILS_ENV"] = "test"

require File.expand_path("../dummy/config/environment.rb",  __FILE__)
require "rspec/rails"
require "factory_girl"

# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

RSpec.configure do |config|
  config.use_transactional_fixtures = true
end

def default_selections
  @parent_1 = Factory(:selection, :system_code => "state")
  @child_1 = Factory(:selection, :parent => @parent_1)
  @child_2 = Factory(:selection, :parent => @parent_1, :is_default => true)
  @child_3 = Factory(:selection, :parent => @parent_1)
  @child_4 = Factory(:selection, :parent => @parent_1)
end

def selected_options options, selection, has_blank_item
  options.each do |child|
    selected = (selection && selection.id == child.id) ? "[selected='selected']" : ""
    assert_select "option[value='#{child.id}']#{selected}"
  end
  assert_select "option[selected='selected']", 0 unless selection
  assert_select "option[value='']", (has_blank_item ? 1 : 0)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
selections-0.0.1 spec/spec_helper.rb