Class: CheckAuth::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_check_auth/check_auth/output.rb

Overview

Handles generating the code to eval from all the request objects

Class Method Summary collapse

Class Method Details

.generate_steps_for(format, objects) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rspec_check_auth/check_auth/output.rb', line 5

def self.generate_steps_for format, objects
  # Wrap each format in a new describe block
  o = [%Q{describe "as #{format.to_s.upcase}" do}]
    # Run through each step
    objects.each do |request|
      o << <<-EOF
  it "should return 401 for #{request.method.to_s.upcase} #{request.action}" do
#{request.method}(#{request.action.inspect}#{", " + request.params.inspect})

#{CheckAuth.checking_block(format)}
  end
      EOF
    end
  o << "end"
  o.join("\n")
end