Class: Spex::Script

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/spex/script.rb

Defined Under Namespace

Classes: Builder

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandObject

Returns the value of attribute command.



5
6
7
# File 'lib/spex/script.rb', line 5

def command
  @command
end

Class Method Details

.evaluate(*args, &block) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/spex/script.rb', line 11

def self.evaluate(*args, &block)
  script = new
  builder = Builder.new(script, &block)
  unless block_given?
    builder.instance_eval(*args)
  end
  script
end

.evaluate_file(path) ⇒ Object



7
8
9
# File 'lib/spex/script.rb', line 7

def self.evaluate_file(path)
  evaluate(File.read(path), path, 1)
end

Instance Method Details

#<<(scenario) ⇒ Object



20
21
22
# File 'lib/spex/script.rb', line 20

def <<(scenario)
  scenarios << scenario
end

#each(&block) ⇒ Object



28
29
30
# File 'lib/spex/script.rb', line 28

def each(&block)
  scenarios.each(&block)
end

#scenariosObject



24
25
26
# File 'lib/spex/script.rb', line 24

def scenarios
  @scenarios ||= []
end