Sha256: 3215e640866163ae3584b036ef547b074111b559d3fd1613c337d51e1f8975a9
Contents?: true
Size: 985 Bytes
Versions: 4
Compression:
Stored size: 985 Bytes
Contents
require 'spec_helper' describe ActiveRecordSurveyApi::InstanceNodesController, :type => :controller, :instance_nodes_api => true do routes { ActiveRecordSurveyApi::Engine.routes } describe 'GET create' do it 'should create a new instance' do survey = FactoryGirl.build(:basic_survey) survey.save instance = ActiveRecordSurvey::Instance.new(:survey => survey) instance.save request.headers[:HTTP_ACCEPT_LANGUAGE] = "en" header_params = { :survey_id => survey.id, :instance_id => instance.id, :HTTP_ACCEPT_LANGUAGE => 'en', :CONTENT_TYPE => 'application/json', :ACCEPT => 'application/json' } questions = survey.questions survey_path = survey.as_map.as_json.first post :create, { :instance_node => { :active_record_survey_node_id => survey_path["children"].first["node_id"] } }.to_json, header_params json_body = JSON.parse(response.body) expect(json_body["data"]["id"].to_i).to eq(1) end end end
Version data entries
4 entries across 4 versions & 1 rubygems