Sha256: aceb6d4582e4a44751b6c5d78511007132402f8670a0873714195760f364aa61

Contents?: true

Size: 1.27 KB

Versions: 11

Compression:

Stored size: 1.27 KB

Contents

Feature: REST API

  Scenario: Compare JSON
    Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
    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 it should pass with:
       """
       1 scenario (1 passed)
       2 steps (2 passed)
       """

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
casecumber-rails-1.0.2.1 features/rest_api.feature
cucumber-rails-1.1.1 features/rest_api.feature
cucumber-rails-1.1.0 features/rest_api.feature
cucumber-rails-1.0.6 features/rest_api.feature
cucumber-rails-1.0.5 features/rest_api.feature
cucumber-rails-1.0.4 features/rest_api.feature
cucumber-rails-1.0.3 features/rest_api.feature
cucumber-rails-1.0.2 features/rest_api.feature
cucumber-rails-1.0.1 features/rest_api.feature
cucumber-rails-1.0.0 features/rest_api.feature
cucumber-rails-0.5.2 features/rest_api.feature