Module: RSpec::ComplianceTable

Defined in:
lib/rspec/compliance_table.rb,
lib/rspec/compliance_table/version.rb,
lib/rspec/compliance_table/configuration.rb

Defined Under Namespace

Classes: Configuration, MissingAction

Constant Summary collapse

COMPLIANCE_TOKEN =
'y'
SCENARIO_HEADER_TOKEN =
'scenario'
VERSION =
'0.1.7'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configure {|Configuration.instance| ... } ⇒ Object

Yields:



22
23
24
# File 'lib/rspec/compliance_table.rb', line 22

def self.configure
  yield(Configuration.instance)
end

Instance Method Details

#compliance_for(record_name, table, options = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rspec/compliance_table.rb', line 26

def compliance_for(record_name, table, options = {})
  table = prepare_table(table)

  actions = actions(table)
  scenarios = scenarios(table)
  compliance = compliance(table)

  raise_if_missing_action(actions, options)

  expected_table = {}.tap do |parsed_table|
    actions.each_with_index do |act, act_index|
      scenarios.each_with_index do |sce, sce_index|
        parsed_table[sce] ||= {}
        parsed_table[sce][act] = compliance[sce_index][act_index]
      end
    end
  end

  run_compliance_matchers(expected_table, actions, scenarios, compliance, record_name)
end