Class: Cucumber::ThinkingSphinx::InternalWorld

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/thinking_sphinx/internal_world.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (InternalWorld) initialize

A new instance of InternalWorld



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cucumber/thinking_sphinx/internal_world.rb', line 11

def initialize
  pwd = Dir.pwd
  @temporary_directory  = "#{pwd}/tmp"
  @migrations_directory = "#{pwd}/features/thinking_sphinx/db/migrations"
  @models_directory     = "#{pwd}/features/thinking_sphinx/models"
  @fixtures_directory   = "#{pwd}/features/thinking_sphinx/db/fixtures"
  @database_file        = "#{pwd}/features/thinking_sphinx/database.yml"

  @adapter  = (ENV['DATABASE'] || 'mysql').gsub /^mysql$/, 'mysql2'
  @database = 'thinking_sphinx'
  @username = @adapter[/mysql/] ? 'root' : 'postgres'
  # @password = 'thinking_sphinx'
  @host     = 'localhost'
end

Instance Attribute Details

- (Object) adapter

Returns the value of attribute adapter



8
9
10
# File 'lib/cucumber/thinking_sphinx/internal_world.rb', line 8

def adapter
  @adapter
end

- (Object) database

Returns the value of attribute database



8
9
10
# File 'lib/cucumber/thinking_sphinx/internal_world.rb', line 8

def database
  @database
end

- (Object) database_file

Returns the value of attribute database_file



6
7
8
# File 'lib/cucumber/thinking_sphinx/internal_world.rb', line 6

def database_file
  @database_file
end

- (Object) fixtures_directory

Returns the value of attribute fixtures_directory



6
7
8
# File 'lib/cucumber/thinking_sphinx/internal_world.rb', line 6

def fixtures_directory
  @fixtures_directory
end

- (Object) host

Returns the value of attribute host



8
9
10
# File 'lib/cucumber/thinking_sphinx/internal_world.rb', line 8

def host
  @host
end

- (Object) migrations_directory

Returns the value of attribute migrations_directory



6
7
8
# File 'lib/cucumber/thinking_sphinx/internal_world.rb', line 6

def migrations_directory
  @migrations_directory
end

- (Object) models_directory

Returns the value of attribute models_directory



6
7
8
# File 'lib/cucumber/thinking_sphinx/internal_world.rb', line 6

def models_directory
  @models_directory
end

- (Object) password

Returns the value of attribute password



8
9
10
# File 'lib/cucumber/thinking_sphinx/internal_world.rb', line 8

def password
  @password
end

- (Object) temporary_directory

Returns the value of attribute temporary_directory



6
7
8
# File 'lib/cucumber/thinking_sphinx/internal_world.rb', line 6

def temporary_directory
  @temporary_directory
end

- (Object) username

Returns the value of attribute username



8
9
10
# File 'lib/cucumber/thinking_sphinx/internal_world.rb', line 8

def username
  @username
end

Instance Method Details

- (Object) configure_database



39
40
41
42
# File 'lib/cucumber/thinking_sphinx/internal_world.rb', line 39

def configure_database
  ActiveRecord::Base.establish_connection database_settings
  self
end

- (Object) setup



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cucumber/thinking_sphinx/internal_world.rb', line 26

def setup
  make_temporary_directory

  configure_cleanup
  configure_thinking_sphinx
  configure_active_record

  prepare_data
  setup_sphinx

  self
end