Sha256: a9320d70b6a5cb988b116a5d19b75589dc5a11c8b60b05c33694457098a6273f

Contents?: true

Size: 863 Bytes

Versions: 13

Compression:

Stored size: 863 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Surveyor do
  it "should write thousands of response sets" do
    Surveyor::Parser.parse(File.read(File.join(Rails.root, 'surveys', 'kitchen_sink_survey.rb')))
    survey = Survey.last
    rs = ResponseSet.create(:survey => survey)
    survey.sections.each{|s| s.questions.each{|q| rs.responses.create(:question => q, :answer => q.answers.first)}}
    Benchmark.bm 20 do |x|
      x.report "a test" do
        full_path = File.join(Rails.root,"#{survey.access_code}_#{Time.now.to_i}.csv")
        File.open(full_path, 'w') do |f|
          100.times do # adjust this to test
            survey.response_sets.each_with_index{|r,i| f.write(r.to_csv(true, i == 0)) } # print access code every time, print_header first time
          end
        end        
      end
    end
  end
end


Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
affectiva-surveyor-1.5.0.pre.disco.2 spec/lib/benchmark_spec.rb
hssc_surveyor-1.4.3.pre spec/lib/benchmark_spec.rb
hssc_surveyor-1.4.2.pre spec/lib/benchmark_spec.rb
hssc_surveyor-1.4.1.pre spec/lib/benchmark_spec.rb
surveyor-1.4.0 spec/lib/benchmark_spec.rb
surveyor-1.3.0 spec/lib/benchmark_spec.rb
surveyor-1.2.0 spec/lib/benchmark_spec.rb
surveyor-1.1.0 spec/lib/benchmark_spec.rb
surveyor-1.0.1 spec/lib/benchmark_spec.rb
surveyor-1.0.0 spec/lib/benchmark_spec.rb
surveyor-0.22.0 spec/lib/benchmark_spec.rb
surveyor-0.21.0 spec/lib/benchmark_spec.rb
surveyor-0.20.0 spec/lib/benchmark_spec.rb