Sha256: ddeb30ecde2052dd5c66afb5f03c3a6bbf68d6fd40b56764b5c8e8d9b6b0d3c6

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

Feature: REST API

  Scenario: Compare JSON
    Given I have created a new Rails app "rails-3-app" and installed cucumber-rails
    And I write to "app/controllers/posts_controller.rb" with:
      """
      class PostsController < ApplicationController
        def index
          render :json => {'hello' => 'world'}.to_json
        end
      end
      """
    And I write to "config/routes.rb" with:
      """
      Rails3App::Application.routes.draw do
        resources :posts
      end
      """
    And I write to "features/posts.feature" with:
      """
      Feature: posts
        Scenario: See them
          When the client requests GET /posts
          Then the response should be JSON:
            \"\"\"
            {
              "hello": "world"
            }
            \"\"\"
      """
    And I write to "features/step_definitions/rest_steps.rb" with:
      """
      When /^the client requests GET (.*)$/ do |path|
        get(path)
      end

      Then /^the response should be JSON:$/ do |json|
        JSON.parse(last_response.body).should == JSON.parse(json)
      end
      """
    And I run `bundle exec rake db:migrate`
    And I run `bundle exec rake cucumber`
    Then the feature run should pass with:
       """
       1 scenario (1 passed)
       2 steps (2 passed)
       """

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cucumber-rails-1.5.0 features/rest_api.feature
cucumber-rails-1.4.5 features/rest_api.feature
cucumber-rails-1.4.4 features/rest_api.feature
cucumber-rails-1.4.3 features/rest_api.feature