Class: Jasmine::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/jasmine/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/jasmine/configuration.rb', line 28

def initialize()
  @rack_paths = {}
  @rack_apps = []
  @path_mappers = []
  @jasmine_css_files = lambda { [] }
  @css_files = lambda { [] }
  @jasmine_files = lambda { [] }
  @boot_files = lambda { [] }
  @runner_boot_files = lambda { [] }
  @src_files = lambda { [] }
  @helper_files = lambda { [] }
  @spec_files = lambda { [] }
  @testing_files = lambda { helper_files.call + spec_files.call}
  @runner = lambda { |config| }
  @rack_options = {}
  @show_console_log = false
  @stop_spec_on_expectation_failure = false
  @stop_on_spec_failure = false
  @random = true
  @phantom_config_script = nil
  @phantom_cli_options = {}
  @chrome_cli_options = {"no-sandbox" => nil, "headless" => nil, "remote-debugging-port" => 9222}
  @chrome_startup_timeout = 3
  @chrome_binary = nil
  @runner_browser = :phantomjs

  @formatters = [Jasmine::Formatters::Console]
  @color = true

  @server_port = 8888
end

Instance Attribute Details

#boot_dirObject

Returns the value of attribute boot_dir.



7
8
9
# File 'lib/jasmine/configuration.rb', line 7

def boot_dir
  @boot_dir
end

#boot_files=(value) ⇒ Object (writeonly)

Sets the attribute boot_files

Parameters:

  • value

    the value to set the attribute boot_files to.



4
5
6
# File 'lib/jasmine/configuration.rb', line 4

def boot_files=(value)
  @boot_files = value
end

#boot_pathObject

Returns the value of attribute boot_path.



6
7
8
# File 'lib/jasmine/configuration.rb', line 6

def boot_path
  @boot_path
end

#chrome_binaryObject

Returns the value of attribute chrome_binary.



23
24
25
# File 'lib/jasmine/configuration.rb', line 23

def chrome_binary
  @chrome_binary
end

#chrome_cli_optionsObject

Returns the value of attribute chrome_cli_options.



21
22
23
# File 'lib/jasmine/configuration.rb', line 21

def chrome_cli_options
  @chrome_cli_options
end

#chrome_startup_timeoutObject

Returns the value of attribute chrome_startup_timeout.



22
23
24
# File 'lib/jasmine/configuration.rb', line 22

def chrome_startup_timeout
  @chrome_startup_timeout
end

#colorObject

Returns the value of attribute color.



9
10
11
# File 'lib/jasmine/configuration.rb', line 9

def color
  @color
end

#css_filesObject



60
61
62
63
# File 'lib/jasmine/configuration.rb', line 60

def css_files
  map(@jasmine_css_files, :jasmine) +
    map(@css_files, :src)
end

#formattersObject

Returns the value of attribute formatters.



8
9
10
# File 'lib/jasmine/configuration.rb', line 8

def formatters
  @formatters
end

#helper_filesObject

Returns the value of attribute helper_files.



5
6
7
# File 'lib/jasmine/configuration.rb', line 5

def helper_files
  @helper_files
end

#hostObject

Returns the value of attribute host.



10
11
12
# File 'lib/jasmine/configuration.rb', line 10

def host
  @host
end

#image_pathObject

Returns the value of attribute image_path.



6
7
8
# File 'lib/jasmine/configuration.rb', line 6

def image_path
  @image_path
end

#images_dirObject

Returns the value of attribute images_dir.



7
8
9
# File 'lib/jasmine/configuration.rb', line 7

def images_dir
  @images_dir
end

#jasmine_css_files=(value) ⇒ Object (writeonly)

Sets the attribute jasmine_css_files

Parameters:

  • value

    the value to set the attribute jasmine_css_files to.



3
4
5
# File 'lib/jasmine/configuration.rb', line 3

def jasmine_css_files=(value)
  @jasmine_css_files = value
end

#jasmine_dirObject

Returns the value of attribute jasmine_dir.



7
8
9
# File 'lib/jasmine/configuration.rb', line 7

def jasmine_dir
  @jasmine_dir
end

#jasmine_files=(value) ⇒ Object (writeonly)

Sets the attribute jasmine_files

Parameters:

  • value

    the value to set the attribute jasmine_files to.



4
5
6
# File 'lib/jasmine/configuration.rb', line 4

def jasmine_files=(value)
  @jasmine_files = value
end

#jasmine_pathObject

Returns the value of attribute jasmine_path.



6
7
8
# File 'lib/jasmine/configuration.rb', line 6

def jasmine_path
  @jasmine_path
end

#phantom_cli_optionsObject

Returns the value of attribute phantom_cli_options.



20
21
22
# File 'lib/jasmine/configuration.rb', line 20

def phantom_cli_options
  @phantom_cli_options
end

#phantom_config_scriptObject

Returns the value of attribute phantom_config_script.



19
20
21
# File 'lib/jasmine/configuration.rb', line 19

def phantom_config_script
  @phantom_config_script
end

#prevent_phantom_js_auto_installObject

Returns the value of attribute prevent_phantom_js_auto_install.



14
15
16
# File 'lib/jasmine/configuration.rb', line 14

def prevent_phantom_js_auto_install
  @prevent_phantom_js_auto_install
end

#rack_appsObject (readonly)

Returns the value of attribute rack_apps.



26
27
28
# File 'lib/jasmine/configuration.rb', line 26

def rack_apps
  @rack_apps
end

#rack_optionsObject

Returns the value of attribute rack_options.



13
14
15
# File 'lib/jasmine/configuration.rb', line 13

def rack_options
  @rack_options
end

#randomObject

Returns the value of attribute random.



18
19
20
# File 'lib/jasmine/configuration.rb', line 18

def random
  @random
end

#runnerObject

Returns the value of attribute runner.



12
13
14
# File 'lib/jasmine/configuration.rb', line 12

def runner
  @runner
end

#runner_boot_dirObject

Returns the value of attribute runner_boot_dir.



7
8
9
# File 'lib/jasmine/configuration.rb', line 7

def runner_boot_dir
  @runner_boot_dir
end

#runner_boot_files=(value) ⇒ Object (writeonly)

Sets the attribute runner_boot_files

Parameters:

  • value

    the value to set the attribute runner_boot_files to.



4
5
6
# File 'lib/jasmine/configuration.rb', line 4

def runner_boot_files=(value)
  @runner_boot_files = value
end

#runner_boot_pathObject

Returns the value of attribute runner_boot_path.



6
7
8
# File 'lib/jasmine/configuration.rb', line 6

def runner_boot_path
  @runner_boot_path
end

#runner_browserObject

Returns the value of attribute runner_browser.



25
26
27
# File 'lib/jasmine/configuration.rb', line 25

def runner_browser
  @runner_browser
end

#show_console_logObject

Returns the value of attribute show_console_log.



15
16
17
# File 'lib/jasmine/configuration.rb', line 15

def show_console_log
  @show_console_log
end

#show_full_stack_traceObject

Returns the value of attribute show_full_stack_trace.



24
25
26
# File 'lib/jasmine/configuration.rb', line 24

def show_full_stack_trace
  @show_full_stack_trace
end

#spec_dirObject

Returns the value of attribute spec_dir.



7
8
9
# File 'lib/jasmine/configuration.rb', line 7

def spec_dir
  @spec_dir
end

#spec_filesObject

Returns the value of attribute spec_files.



5
6
7
# File 'lib/jasmine/configuration.rb', line 5

def spec_files
  @spec_files
end

#spec_formatObject

Returns the value of attribute spec_format.



11
12
13
# File 'lib/jasmine/configuration.rb', line 11

def spec_format
  @spec_format
end

#spec_pathObject

Returns the value of attribute spec_path.



6
7
8
# File 'lib/jasmine/configuration.rb', line 6

def spec_path
  @spec_path
end

#src_dirObject

Returns the value of attribute src_dir.



7
8
9
# File 'lib/jasmine/configuration.rb', line 7

def src_dir
  @src_dir
end

#src_files=(value) ⇒ Object (writeonly)

Sets the attribute src_files

Parameters:

  • value

    the value to set the attribute src_files to.



4
5
6
# File 'lib/jasmine/configuration.rb', line 4

def src_files=(value)
  @src_files = value
end

#src_pathObject

Returns the value of attribute src_path.



6
7
8
# File 'lib/jasmine/configuration.rb', line 6

def src_path
  @src_path
end

#stop_on_spec_failureObject

Returns the value of attribute stop_on_spec_failure.



17
18
19
# File 'lib/jasmine/configuration.rb', line 17

def stop_on_spec_failure
  @stop_on_spec_failure
end

#stop_spec_on_expectation_failureObject

Returns the value of attribute stop_spec_on_expectation_failure.



16
17
18
# File 'lib/jasmine/configuration.rb', line 16

def stop_spec_on_expectation_failure
  @stop_spec_on_expectation_failure
end

Instance Method Details

#add_path_mapper(mapper) ⇒ Object



89
90
91
# File 'lib/jasmine/configuration.rb', line 89

def add_path_mapper(mapper)
  @path_mappers << mapper.call(self)
end

#add_rack_app(app, *args, &block) ⇒ Object



81
82
83
84
85
86
87
# File 'lib/jasmine/configuration.rb', line 81

def add_rack_app(app, *args, &block)
  @rack_apps << {
      :app => app,
      :args => args,
      :block => block
  }
end

#add_rack_path(path, rack_app_lambda) ⇒ Object



77
78
79
# File 'lib/jasmine/configuration.rb', line 77

def add_rack_path(path, rack_app_lambda)
  @rack_paths[path] = rack_app_lambda
end

#ci_port=(port) ⇒ Object



97
98
99
# File 'lib/jasmine/configuration.rb', line 97

def ci_port=(port)
  @ci_port = port
end

#js_filesObject



65
66
67
68
69
70
71
# File 'lib/jasmine/configuration.rb', line 65

def js_files
  map(@jasmine_files, :jasmine) +
    map(@boot_files, :boot) +
    map(@runner_boot_files, :runner_boot) +
    map(@src_files, :src) +
    map(@testing_files, :spec)
end

#port(server_type) ⇒ Object



101
102
103
104
105
106
107
# File 'lib/jasmine/configuration.rb', line 101

def port(server_type)
  if server_type == :server
    @server_port
  else
    @ci_port ||= Jasmine.find_unused_port
  end
end

#rack_path_mapObject



73
74
75
# File 'lib/jasmine/configuration.rb', line 73

def rack_path_map
  {}.merge(@rack_paths)
end

#server_port=(port) ⇒ Object



93
94
95
# File 'lib/jasmine/configuration.rb', line 93

def server_port=(port)
  @server_port = port
end