Sha256: aa416b28e92c5c6a02c6c4a9c68a6caef102394f99a73f2713ea2791a4fce255
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
# encoding: utf-8 # ============================================================================== # Examples for testing rules # ============================================================================== shared_context :rule do def nodes defined?(input) ? [input].flatten : [] end def optimized defined?(output) ? [output].flatten : [] end let(:rule) { described_class } subject { rule.new(*nodes).call } end # shared context shared_examples :skipping_nodes do include_context :rule it do is_expected.to eql(nodes), <<-REPORT.gsub(/.+\|/, "") | |#{rule} | |Input: #{nodes.inspect} | |Output: | expected: #{nodes.inspect} | got: #{subject} REPORT end end # shared examples shared_examples :optimizing_nodes do include_context :rule it do is_expected.to eql(optimized), <<-REPORT.gsub(/.+\|/, "") | |#{rule} | |Input: #{nodes.inspect} | |Output: | expected: #{optimized.inspect} | got: #{subject} REPORT end end # shared examples
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
abstract_mapper-0.1.0 | lib/rspec/rules.rb |
abstract_mapper-0.0.2 | lib/rspec/rules.rb |