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

Version Path
active_record_survey_api-0.0.19 spec/features/active_record_survey_api/answers_spec.rb
active_record_survey_api-0.0.18 spec/features/active_record_survey_api/answers_spec.rb
active_record_survey_api-0.0.17 spec/features/active_record_survey_api/answers_spec.rb
active_record_survey_api-0.0.14 spec/features/active_record_survey_api/answers_spec.rb
active_record_survey_api-0.0.12 spec/features/active_record_survey_api/answers_spec.rb
active_record_survey_api-0.0.11 spec/features/active_record_survey_api/answers_spec.rb
active_record_survey_api-0.0.7 spec/features/active_record_survey_api/answers_spec.rb
active_record_survey_api-0.0.6 spec/features/active_record_survey_api/answers_spec.rb
active_record_survey_api-0.0.4 spec/features/active_record_survey_api/answers_spec.rb