Sha256: 15054ad88b37847c76637b664ad000f1d62d4b6e41415d942b3987d195c7e493
Contents?: true
Size: 1.48 KB
Versions: 9
Compression:
Stored size: 1.48 KB
Contents
require 'spec_helper' =begin describe ActiveRecordSurveyApi::AnswersController, :type => :controller, :answers_api => true do routes { ActiveRecordSurveyApi::Engine.routes } describe 'When creating a new survey' do describe 'GET index' do it 'should work for english' do answer = ActiveRecordSurveyApi::Answer.new answer.attributes = { text: "Comment allez-vous aujourd'hui?", locale: :fr } answer.attributes = { text: "How are you today?", locale: :en } answer.save request.headers['HTTP_ACCEPT_LANGUAGE'] = "en" get :index, nil, { 'HTTP_ACCEPT_LANGUAGE' => 'en', 'CONTENT_TYPE' => 'application/json', 'ACCEPT' => 'application/json' } puts response.body.inspect end it 'should work for french' do answer = ActiveRecordSurveyApi::Answer.new answer.attributes = { text: "¿Cuáles son tus planes?", locale: :es } answer.attributes = { text: "What are your plans?", locale: :en } answer.save request.headers['HTTP_ACCEPT_LANGUAGE'] = "es" get :index, nil, { 'HTTP_ACCEPT_LANGUAGE' => 'es', 'CONTENT_TYPE' => 'application/json', 'ACCEPT' => 'application/json' } puts response.body.inspect end end it 'should create' do #post :create, { # :survey => { # :name => "Survey #1", # } #}.to_json, { # 'CONTENT_TYPE' => 'application/json', # 'ACCEPT' => 'application/json' #} #puts response.body.inspect end end end =end
Version data entries
9 entries across 9 versions & 1 rubygems