File: rails_integration.feature

package info (click to toggle)
ruby-http-accept-language 2.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 140 kB
  • sloc: ruby: 363; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 939 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
@rails
Feature: Rails Integration

  To use http_accept_language inside a Rails application, just add it to your
  Gemfile and run `bundle install`.

  It is automatically added to your middleware.

  Scenario: Installing
    When I generate a new Rails app
    And I add http_accept_language to my Gemfile
    And I run `rake middleware`
    Then the output should contain "use HttpAcceptLanguage::Middleware"

  Scenario: Using
    Given I have installed http_accept_language
    When I generate the following controller:
    """
    class LanguagesController < ApplicationController

      def index
        languages = http_accept_language.user_preferred_languages
        render :text => "Languages: #{languages.join(' : ')}"
      end

    end
    """
    When I access that action with the HTTP_ACCEPT_LANGUAGE header "en-us,en-gb;q=0.8,en;q=0.6,es-419"
    Then the response should contain "Languages: en-US : es-419 : en-GB : en"