fluke/devops-service/tests/templates/generators/path_scenarios_generator.rb

22 lines
608 B
Ruby
Raw Normal View History

class PathScenariosGenerator
def generate_get_path_scenarios name, path
%Q(
Scenario: #{name}
When I send GET '#{path}' query with JSON body
Then response should be '200'
And the Content-Type header should include 'application/json'
#{yield}
Scenario: #{name} with header 'Accept' value is not 'application/json'
When I send GET '#{path}' query with header 'Accept' value 'application/xml'
Then response should be '406'
Scenario: #{name} without privileges
When I send GET '#{path}' query with user without privileges
Then response should be '401'
)
end
end