Commit 90c91c4a902903ad54600386e39e7aa1d37ef46d
Committed by
Victor Costa
1 parent
4b06d2fb
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Added pairwise plugin
Showing
74 changed files
with
7188 additions
and
0 deletions
Show diff stats
plugins/pairwise/controllers/pairwise_plugin_admin_controller.rb
0 → 100644
| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | +class PairwisePluginAdminController < AdminController | |
| 2 | + append_view_path File.join(File.dirname(__FILE__) + '/../views') | |
| 3 | + | |
| 4 | + def index | |
| 5 | + @settings ||= Noosfero::Plugin::Settings.new(environment, PairwisePlugin, params[:settings]) | |
| 6 | + if request.post? | |
| 7 | + @settings.api_host = nil if @settings.api_host.blank? | |
| 8 | + @settings.username = nil if @settings.username.blank? | |
| 9 | + @settings.password = nil if @settings.password.blank? | |
| 10 | + @settings.save! | |
| 11 | + redirect_to :action => 'index' | |
| 12 | + end | |
| 13 | + end | |
| 14 | +end | ... | ... |
plugins/pairwise/controllers/profile/pairwise_plugin_profile_controller.rb
0 → 100644
| ... | ... | @@ -0,0 +1,151 @@ |
| 1 | +class PairwisePluginProfileController < ProfileController | |
| 2 | + append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
| 3 | + | |
| 4 | + def prompt | |
| 5 | + prompt_id = params[:prompt_id] | |
| 6 | + @pairwise_content = find_content(params) | |
| 7 | + embeded = params.has_key?("embeded") | |
| 8 | + source = params[:source] | |
| 9 | + locals = {:source => source, :pairwise_content => @pairwise_content, :embeded => embeded, :source => source, :prompt_id => prompt_id } | |
| 10 | + if embeded | |
| 11 | + render 'content_viewer/prompt.rhtml', :layout => "embeded", :locals => locals | |
| 12 | + else | |
| 13 | + render 'content_viewer/prompt.rhtml', :locals => locals | |
| 14 | + end | |
| 15 | + end | |
| 16 | + | |
| 17 | + #FIXME reuse | |
| 18 | + def load_prompt | |
| 19 | + @pairwise_content = find_content(params) | |
| 20 | + if request.xhr? | |
| 21 | + render 'content_viewer/prompt.rjs' | |
| 22 | + else | |
| 23 | + redirect_to after_action_url | |
| 24 | + end | |
| 25 | + end | |
| 26 | + | |
| 27 | + def choose | |
| 28 | + @pairwise_content = find_content(params) | |
| 29 | + vote = @pairwise_content.vote_to(params[:prompt_id], params[:direction], user_identifier, params[:appearance_id]) | |
| 30 | + if request.xhr? | |
| 31 | + render 'content_viewer/prompt.rjs' | |
| 32 | + else | |
| 33 | + redirect_to after_action_url | |
| 34 | + end | |
| 35 | + end | |
| 36 | + | |
| 37 | + def skip_prompt | |
| 38 | + raise _('Invalid request') unless params.has_key?('prompt_id') | |
| 39 | + raise _('Invalid request') unless params.has_key?('appearance_id') | |
| 40 | + @pairwise_content = find_content(params) | |
| 41 | + reason = params[:reason] | |
| 42 | + skip = @pairwise_content.skip_prompt(params[:prompt_id], user_identifier, params[:appearance_id], reason) | |
| 43 | + if request.xhr? | |
| 44 | + render 'content_viewer/prompt.rjs' | |
| 45 | + else | |
| 46 | + redirect_to after_action_url | |
| 47 | + end | |
| 48 | + | |
| 49 | + end | |
| 50 | + | |
| 51 | + def result | |
| 52 | + @embeded = params.has_key?("embeded") | |
| 53 | + @page = @pairwise_content = find_content(params) | |
| 54 | + | |
| 55 | + if request.xhr? | |
| 56 | + render 'content_viewer/result' | |
| 57 | + else | |
| 58 | + render 'pairwise_plugin_profile/result' | |
| 59 | + end | |
| 60 | + end | |
| 61 | + | |
| 62 | + def prompt_tab | |
| 63 | + @embeded = params.has_key?("embeded") | |
| 64 | + @pairwise_content = find_content(params) | |
| 65 | + render 'content_viewer/prompt_tab', :locals => {:pairwise_content => @pairwise_content} | |
| 66 | + end | |
| 67 | + | |
| 68 | + def suggest_idea | |
| 69 | + flash_target = request.xhr? ? flash.now : flash | |
| 70 | + | |
| 71 | + if user.nil? | |
| 72 | + flash_target[:error] = _("Only logged user could suggest new ideas") | |
| 73 | + else | |
| 74 | + @page = @pairwise_content = find_content(params) | |
| 75 | + @embeded = params.has_key?("embeded") | |
| 76 | + @source = params[:source] | |
| 77 | + begin | |
| 78 | + if @page.add_new_idea(params[:idea][:text], user_identifier) | |
| 79 | + flash_target[:notice] = _("Thanks for your contributtion!") | |
| 80 | + else | |
| 81 | + if(@page.allow_new_ideas?) | |
| 82 | + flash_target[:error] = _("Unfortunatelly, we are not able to register your idea.") | |
| 83 | + else | |
| 84 | + flash_target[:notice] = _("Unfortunatelly, new ideas are not allowed anymore.") | |
| 85 | + end | |
| 86 | + end | |
| 87 | + rescue Exception => e | |
| 88 | + flash_target[:error] = _(e.message) | |
| 89 | + end | |
| 90 | + end | |
| 91 | + if request.xhr? | |
| 92 | + render 'suggestion_form' | |
| 93 | + else | |
| 94 | + redirect_to after_action_url | |
| 95 | + end | |
| 96 | + end | |
| 97 | + | |
| 98 | + protected | |
| 99 | + | |
| 100 | + def find_content(params) | |
| 101 | + @pairwise_content ||= profile.articles.find(params[:id]) | |
| 102 | + end | |
| 103 | + | |
| 104 | + def after_action_url(prompt_id = nil) | |
| 105 | + if params.has_key?("embeded") | |
| 106 | + redirect_target = { | |
| 107 | + :controller => :pairwise_plugin_profile, | |
| 108 | + :action => 'prompt', | |
| 109 | + :id => find_content(params).id, | |
| 110 | + :question_id => find_content(params).pairwise_question_id, | |
| 111 | + :prompt_id => params[:prompt_id], | |
| 112 | + :embeded => 1 | |
| 113 | + } | |
| 114 | + if params.has_key?("source") | |
| 115 | + redirect_target.merge!(:source => params[:source]) | |
| 116 | + end | |
| 117 | + redirect_target | |
| 118 | + else | |
| 119 | + find_content(params).url | |
| 120 | + end | |
| 121 | + end | |
| 122 | + | |
| 123 | + def is_external_vote | |
| 124 | + params.has_key?("source") && !params[:source].empty? | |
| 125 | + end | |
| 126 | + | |
| 127 | + def external_source | |
| 128 | + params[:source] | |
| 129 | + end | |
| 130 | + | |
| 131 | + def user_identifier | |
| 132 | + if user.nil? | |
| 133 | + is_external_vote ? "#{external_source}-#{request.session_options[:id]}" : "participa-#{request.session_options[:id]}" | |
| 134 | + else | |
| 135 | + user.identifier | |
| 136 | + end | |
| 137 | + end | |
| 138 | + | |
| 139 | + def process_error_message message | |
| 140 | + message | |
| 141 | + end | |
| 142 | + | |
| 143 | + | |
| 144 | + def redirect_to_error_page(message) | |
| 145 | + message = URI.escape(CGI.escape(process_error_message(message)),'.') | |
| 146 | + redirect_to "/profile/#{profile.identifier}/plugin/pairwise/error_page?message=#{message}" | |
| 147 | + end | |
| 148 | + | |
| 149 | + | |
| 150 | +end | |
| 151 | + | ... | ... |
plugins/pairwise/controllers/profile/pairwise_plugin_suggestions_controller.rb
0 → 100644
| ... | ... | @@ -0,0 +1,80 @@ |
| 1 | +require 'will_paginate/array' | |
| 2 | + | |
| 3 | +class PairwisePluginSuggestionsController < ProfileController | |
| 4 | + | |
| 5 | + append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
| 6 | + | |
| 7 | + before_filter :load_pairwise_question | |
| 8 | + | |
| 9 | + def index | |
| 10 | + return no_result if @pairwise_content.nil? | |
| 11 | + return no_result if @pairwise_content.question.nil? | |
| 12 | + @choices = list_choices | |
| 13 | + @choices = WillPaginate::Collection.create(params[:page] || 1, 20, @choices.length) do |pager| | |
| 14 | + pager.replace(@choices.slice(pager.offset, pager.per_page)) | |
| 15 | + end | |
| 16 | + end | |
| 17 | + | |
| 18 | + def edit | |
| 19 | + return no_result if @pairwise_content.nil? | |
| 20 | + return no_result if @pairwise_content.question.nil? | |
| 21 | + @choice = @pairwise_content.find_choice params[:choice_id] | |
| 22 | + end | |
| 23 | + | |
| 24 | + def update | |
| 25 | + return no_result if @pairwise_content.nil? | |
| 26 | + if @pairwise_content.update_choice(params[:choice][:id], params[:choice][:data], params[:choice][:active]) | |
| 27 | + redirect_to :action => :index, :id => @pairwise_content.id, :pending => params[:pending] | |
| 28 | + else | |
| 29 | + @choice = @pairwise_content.find_choice params[:choice][:id] | |
| 30 | + @choice.data = params[:choice][:data] | |
| 31 | + flash[:error] = @pairwise_content.errors.full_messages | |
| 32 | + render :edit | |
| 33 | + end | |
| 34 | + end | |
| 35 | + | |
| 36 | + def approve | |
| 37 | + return no_result if @pairwise_content.nil? | |
| 38 | + if @pairwise_content.approve_choice(params[:choice_id]) | |
| 39 | + redirect_to :action => :index, :id => @pairwise_content.id, :page => params[:page], :pending => params[:pending] | |
| 40 | + else | |
| 41 | + flash[:error] = @pairwise_content.errors.full_messages | |
| 42 | + redirect_to :action => :index, :id => @pairwise_content.id, :page => params[:page], :pending => params[:pending] | |
| 43 | + end | |
| 44 | + end | |
| 45 | + | |
| 46 | + def inactivate | |
| 47 | + return no_result if @pairwise_content.nil? | |
| 48 | + @pairwise_content.inactivate(params[:choice_id]) | |
| 49 | + redirect_to :action => :index, :id => @pairwise_content.id, :page => params[:page], :pending => params[:pending] | |
| 50 | + end | |
| 51 | + | |
| 52 | + def reprove | |
| 53 | + return no_result if @pairwise_content.nil? | |
| 54 | + @pairwise_content.flag_choice(params[:choice_id]) | |
| 55 | + redirect_to :action => :index, :id => @pairwise_content.id, :page => params[:page], :pending => params[:pending] | |
| 56 | + end | |
| 57 | + | |
| 58 | +private | |
| 59 | + | |
| 60 | + def list_choices | |
| 61 | + if '1'.eql?(params[:pending]) | |
| 62 | + if '1'.eql?(params[:reproved]) | |
| 63 | + @pairwise_content.reproved_choices(params[:filter], params[:order]) | |
| 64 | + else | |
| 65 | + @pairwise_content.pending_choices(params[:filter], params[:order]) | |
| 66 | + end | |
| 67 | + else | |
| 68 | + @pairwise_content.raw_choices(params[:filter], params[:order]) | |
| 69 | + end | |
| 70 | + end | |
| 71 | + | |
| 72 | + def no_result | |
| 73 | + render :no_result | |
| 74 | + end | |
| 75 | + | |
| 76 | + def load_pairwise_question | |
| 77 | + @pairwise_content ||= profile.articles.find(params[:id]) | |
| 78 | + render_access_denied unless @pairwise_content.allow_edit?(user) | |
| 79 | + end | |
| 80 | +end | ... | ... |
plugins/pairwise/controllers/public/pairwise_plugin_public_controller.rb
0 → 100644
| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | +class PairwisePluginPublicController < PublicController | |
| 2 | + append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
| 3 | + | |
| 4 | + #before_filter :login_required, :only => :select_community | |
| 5 | + | |
| 6 | + def index | |
| 7 | + question_id = params[:id] | |
| 8 | + client = PairwiseClient.new params[:profile_id] | |
| 9 | + question = client.question_with_prompt(question_id, visitor_id) | |
| 10 | + | |
| 11 | + render :index | |
| 12 | + end | |
| 13 | + | |
| 14 | + def results | |
| 15 | + question_id = params[:id] | |
| 16 | + client = PairwiseClient.new params[:profile_id] | |
| 17 | + end | |
| 18 | + | |
| 19 | + def vote | |
| 20 | + question_id = paarms[:id] | |
| 21 | + client = PairwiseClient.new params[:profile_id] | |
| 22 | + redirect_to :index | |
| 23 | + end | |
| 24 | +end | ... | ... |
plugins/pairwise/db/migrate/20140221110000_create_pairwise_choices_related.rb
0 → 100644
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +class CreatePairwiseChoicesRelated < ActiveRecord::Migration | |
| 2 | + def self.up | |
| 3 | + create_table :pairwise_plugin_choices_related do |t| | |
| 4 | + t.integer :choice_id | |
| 5 | + t.integer :parent_choice_id | |
| 6 | + t.references :question | |
| 7 | + t.references :user | |
| 8 | + t.timestamps | |
| 9 | + end | |
| 10 | + end | |
| 11 | + | |
| 12 | + def self.down | |
| 13 | + drop_table :pairwise_plugin_choices_related | |
| 14 | + end | |
| 15 | +end | |
| 0 | 16 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,197 @@ |
| 1 | +class Pairwise::Client | |
| 2 | + | |
| 3 | + private_class_method :new | |
| 4 | + | |
| 5 | + ### | |
| 6 | + # constructor for a pairwise client | |
| 7 | + # local_identifier is the id of the question owner in the client app side | |
| 8 | + def initialize(local_identifier) | |
| 9 | + @local_identifier = local_identifier | |
| 10 | + end | |
| 11 | + | |
| 12 | + # creates a new question in pairwise | |
| 13 | + def create_question(name, ideas = []) | |
| 14 | + ideas = ideas.join("\n") if ideas.is_a? Array | |
| 15 | + q = Pairwise::Question.create({ | |
| 16 | + :name => name, | |
| 17 | + :visitor_identifier => @local_identifier.to_s, | |
| 18 | + :local_identifier => @local_identifier.to_s, | |
| 19 | + :ideas => ideas | |
| 20 | + }) | |
| 21 | + q.it_should_autoactivate_ideas = true | |
| 22 | + q.active = true | |
| 23 | + q.save | |
| 24 | + q | |
| 25 | + end | |
| 26 | + | |
| 27 | + def toggle_autoactivate_ideas(question, value) | |
| 28 | + question.it_should_autoactivate_ideas = value | |
| 29 | + question.save | |
| 30 | + end | |
| 31 | + | |
| 32 | + def add_choice(question_id, choice_text, visitor=nil) | |
| 33 | + question = Pairwise::Question.find question_id | |
| 34 | + raise Pairwise::Error.new("Question not found in pairwise") if question.nil? | |
| 35 | + visitor_identifier = visitor.blank? ? @local_identifier.to_s : visitor | |
| 36 | + choice_args = { | |
| 37 | + :question_id => question_id, | |
| 38 | + :local_identifier => @local_identifier.to_s, | |
| 39 | + :visitor_identifier => visitor_identifier, | |
| 40 | + :data => choice_text | |
| 41 | + } | |
| 42 | + Pairwise::Choice.create(choice_args) | |
| 43 | + end | |
| 44 | + | |
| 45 | + def update_question(question_id, name) | |
| 46 | + question = Pairwise::Question.find question_id | |
| 47 | + question.name = name | |
| 48 | + question.save | |
| 49 | + end | |
| 50 | + | |
| 51 | + def update_choice(question, choice_id, choice_data, active) | |
| 52 | + choice = Pairwise::Choice.find(choice_id, :params => {:question_id => question.id }) | |
| 53 | + raise N_("Invalid choice id") unless choice | |
| 54 | + raise Pairwise::Error.new N_("Empty choice text") if choice_data.empty? | |
| 55 | + unless choice_data.eql?(choice.data) && choice.active.eql?(active) | |
| 56 | + choice.data = choice_data | |
| 57 | + choice.active = active | |
| 58 | + choice.save | |
| 59 | + end | |
| 60 | + end | |
| 61 | + | |
| 62 | + def approve_choice(question, choice_id) | |
| 63 | + choice = Pairwise::Choice.find(choice_id, :params => {:question_id => question.id}) | |
| 64 | + raise N_("Invalid choice id") unless choice | |
| 65 | + choice.active = true | |
| 66 | + choice.save | |
| 67 | + end | |
| 68 | + | |
| 69 | + def flag_choice(question, choice_id, reason) | |
| 70 | + choice = Pairwise::Choice.find(choice_id, :params => {:question_id => question.id}) | |
| 71 | + raise N_("Invalid choice id") unless choice | |
| 72 | + | |
| 73 | + choice.put(:flag, | |
| 74 | + :visitor_identifier => @local_identifier.to_s, | |
| 75 | + :explanation => reason) | |
| 76 | + end | |
| 77 | + | |
| 78 | + # finds a question by a given id | |
| 79 | + def find_question_by_id(question_id) | |
| 80 | + question = Pairwise::Question.find question_id | |
| 81 | + return question #if question.local_identifier == @local_identifier.to_s | |
| 82 | + end | |
| 83 | + | |
| 84 | + # returns all questions in pairwise owned by the local_identifier user | |
| 85 | + def questions | |
| 86 | + questions = Pairwise::Question.find(:all, :params => {:creator => @local_identifier}) | |
| 87 | + questions.select {|q| q if q.local_identifier == @local_identifier.to_s } | |
| 88 | + end | |
| 89 | + | |
| 90 | + # get a question with a prompt, visitor_id (id of logged user) should be provided | |
| 91 | + def question_with_prompt(question_id, visitor_id = "guest", prompt_id=nil) | |
| 92 | + question = Pairwise::Question.find_with_prompt(question_id, @local_identifier, visitor_id) | |
| 93 | + return question #if question.local_identifier == @local_identifier.to_s | |
| 94 | + end | |
| 95 | + | |
| 96 | + # register votes in response to a prompt to a pairwise question | |
| 97 | + def vote(question_id, prompt_id, direction, visitor="guest", appearance_lookup=nil) | |
| 98 | + prompt = Pairwise::Prompt.find(prompt_id, :params => {:question_id => question_id}) | |
| 99 | + begin | |
| 100 | + vote = prompt.post(:vote, | |
| 101 | + :question_id => question_id, | |
| 102 | + :vote => { | |
| 103 | + :direction => direction, | |
| 104 | + :visitor_identifier => visitor, | |
| 105 | + :appearance_lookup => appearance_lookup | |
| 106 | + }, | |
| 107 | + :next_prompt => { | |
| 108 | + :with_appearance => true, | |
| 109 | + :with_visitor_stats => true, | |
| 110 | + :visitor_identifier => visitor | |
| 111 | + }) | |
| 112 | + Hash.from_xml(vote.body) | |
| 113 | + rescue ActiveResource::ResourceInvalid => e | |
| 114 | + raise Pairwise::Error.new(_("Vote not registered. Please check if all the necessary parameters were passed.")) | |
| 115 | + end | |
| 116 | + end | |
| 117 | + | |
| 118 | + def skip_prompt(question_id, prompt_id, visitor="guest", appearance_lookup=nil, reason=nil) | |
| 119 | + prompt = Pairwise::Prompt.find(prompt_id, :params => {:question_id => question_id}) | |
| 120 | + begin | |
| 121 | + skip = prompt.post(:skip, :question_id => question_id, | |
| 122 | + :skip => { | |
| 123 | + :appearance_lookup => appearance_lookup, | |
| 124 | + :visitor_identifier => visitor, | |
| 125 | + :skip_reason => (reason.nil? ? 'some not informed reason' : reason) | |
| 126 | + }, | |
| 127 | + :next_prompt => { | |
| 128 | + :with_appearance => true, | |
| 129 | + :with_visitor_stats => true, | |
| 130 | + :visitor_identifier => visitor | |
| 131 | + } | |
| 132 | + ) | |
| 133 | + Hash.from_xml(skip.body) | |
| 134 | + rescue ActiveResource::ResourceInvalid => e | |
| 135 | + raise Pairwise::Error.new(_("Could not skip vote. Check the parameters")) | |
| 136 | + end | |
| 137 | + end | |
| 138 | + | |
| 139 | + # skips a prompt | |
| 140 | + def skip(prompt_id, question_id, visitor_id = "guest", appearance_lookup = nil) | |
| 141 | + prompt = Pairwise::Prompt.find(prompt_id, :params => {:question_id => question_id}) | |
| 142 | + skip = prompt.post(:skip, | |
| 143 | + :question_id => question_id, | |
| 144 | + :skip => { | |
| 145 | + :visitor_identifier => visitor_id, | |
| 146 | + :appearance_lookup => appearance_lookup | |
| 147 | + }, | |
| 148 | + :next_prompt => { | |
| 149 | + :with_appearance => true, | |
| 150 | + :with_visitor_stats => true, | |
| 151 | + :visitor_identifier => visitor_id | |
| 152 | + }) | |
| 153 | + | |
| 154 | + end | |
| 155 | + | |
| 156 | + def pairwise_config | |
| 157 | + options = environment.settings[:pairwise_plugin] | |
| 158 | + [:api_host, :username, :password].each do |key| | |
| 159 | + if options.keys.include?(key.to_s) | |
| 160 | + Pairwise::ResourceSettings[key] = options[key.to_s] | |
| 161 | + end | |
| 162 | + end | |
| 163 | + | |
| 164 | + end | |
| 165 | + | |
| 166 | + def self.build(local_identifier, settings) | |
| 167 | + if settings.nil? | |
| 168 | + error_message = "#{_("Plugin was not configured")}. #{_("Please contact the administrator")}" | |
| 169 | + raise Pairwise::Error.new error_message | |
| 170 | + end | |
| 171 | + [Pairwise::Question, Pairwise::Prompt, Pairwise::Choice, Pairwise::Visitor].each do | klas | | |
| 172 | + if([Pairwise::Prompt, Pairwise::Choice].include?(klas)) | |
| 173 | + klas.site = settings[:api_host] + "questions/:question_id/" | |
| 174 | + else | |
| 175 | + klas.site = settings[:api_host] | |
| 176 | + end | |
| 177 | + klas.user = settings[:username] | |
| 178 | + klas.password = settings[:password] | |
| 179 | + end | |
| 180 | + new local_identifier | |
| 181 | + end | |
| 182 | + | |
| 183 | + def add_new_idea(question_id, text, visitor=nil) | |
| 184 | + raise _("Idea text is empty") if text.empty? | |
| 185 | + question = Pairwise::Question.find question_id | |
| 186 | + raise Pairwise::Error.new("Question not found in pairwise") if question.nil? | |
| 187 | + visitor_identifier = visitor.blank? ? @local_identifier.to_s : visitor | |
| 188 | + choice_args = { | |
| 189 | + :question_id => question_id, | |
| 190 | + :local_identifier => @local_identifier.to_s, | |
| 191 | + :visitor_identifier => visitor_identifier, | |
| 192 | + :data => text | |
| 193 | + } | |
| 194 | + return Pairwise::Choice.create(choice_args) | |
| 195 | + end | |
| 196 | +end | |
| 197 | + | ... | ... |
| ... | ... | @@ -0,0 +1,108 @@ |
| 1 | +class Pairwise::Question < ActiveResource::Base | |
| 2 | + extend Pairwise::Resource | |
| 3 | + | |
| 4 | + self.element_name = "question" | |
| 5 | + | |
| 6 | + def get_choices(filter=nil, order=nil) | |
| 7 | + Pairwise::Choice.find( | |
| 8 | + :all, | |
| 9 | + :params => { | |
| 10 | + :question_id => self.id, | |
| 11 | + :filter => filter, | |
| 12 | + :order => order | |
| 13 | + }) | |
| 14 | + end | |
| 15 | + | |
| 16 | + def choices_include_inactive | |
| 17 | + Pairwise::Choice.find(:all, :params => {:question_id => self.id , :include_inactive => true}) | |
| 18 | + end | |
| 19 | + | |
| 20 | + def pending_choices(filter=nil, order=nil) | |
| 21 | + find_options = { | |
| 22 | + :question_id => self.id, | |
| 23 | + :include_inactive => true, | |
| 24 | + :inactive_ignore_flagged => 1, | |
| 25 | + :filter => filter, | |
| 26 | + :order => order | |
| 27 | + } | |
| 28 | + | |
| 29 | + Pairwise::Choice.find(:all, :params => find_options) | |
| 30 | + end | |
| 31 | + | |
| 32 | + def reproved_choices(filter=nil, order=nil) | |
| 33 | + find_options = { | |
| 34 | + :question_id => self.id, | |
| 35 | + :include_inactive => true, | |
| 36 | + :reproved => 1, | |
| 37 | + :filter => filter, | |
| 38 | + :order => order | |
| 39 | + } | |
| 40 | + | |
| 41 | + Pairwise::Choice.find(:all, :params => find_options) | |
| 42 | + end | |
| 43 | + | |
| 44 | + def find_choice(id) | |
| 45 | + Pairwise::Choice.find(id, :params => {:question_id => self.id, :include_inactive => true }) | |
| 46 | + end | |
| 47 | + | |
| 48 | + alias_method :choices, :get_choices | |
| 49 | + | |
| 50 | + def has_choice_with_text?(text) | |
| 51 | + return filter_choices_with_text(text).size > 0 | |
| 52 | + end | |
| 53 | + | |
| 54 | + def get_choice_with_text(text) | |
| 55 | + choices_selected = filter_choices_with_text(text) | |
| 56 | + nil if choices_selected.size == 0 | |
| 57 | + choices_selected.first | |
| 58 | + end | |
| 59 | + | |
| 60 | + def filter_choices_with_text(text) | |
| 61 | + get_choices.select { |c| c if c.data.eql?(text) } | |
| 62 | + end | |
| 63 | + | |
| 64 | + # return visitors whom suggested ideas | |
| 65 | + def get_ideas_contributors(options=nil) | |
| 66 | + options = {:page => 1} | |
| 67 | + options.merge!(options) if options.is_a? Hash | |
| 68 | + Pairwise::Visitor.find(:all, :params => {:question_id => id, :ideas_count => 1, :page => options[:page]}) | |
| 69 | + end | |
| 70 | + | |
| 71 | + def add_choice(text, visitor=nil) | |
| 72 | + if(visitor.nil?) | |
| 73 | + Pairwise::Choice.create(:data => text, :question_id => self.id, :active => "true") | |
| 74 | + else | |
| 75 | + Pairwise::Choice.create(:data => text, :question_id => self.id, :active => "true", :visitor_identifier => visitor) | |
| 76 | + end | |
| 77 | + end | |
| 78 | + | |
| 79 | + def self.find_with_prompt(id, creator_id, visitor_id)#, prompt_id=nil) | |
| 80 | + question = Pairwise::Question.find(id, | |
| 81 | + :params => { | |
| 82 | + :creator_id => creator_id, | |
| 83 | + :with_prompt => true, | |
| 84 | + :with_appearance => true, | |
| 85 | + :visitor_identifier => visitor_id | |
| 86 | + }) | |
| 87 | + question.set_prompt(Pairwise::Prompt.find(question.picked_prompt_id, :params => {:question_id => id})) | |
| 88 | + question | |
| 89 | + end | |
| 90 | + | |
| 91 | + def set_prompt(prompt_object) | |
| 92 | + @prompt = prompt_object | |
| 93 | + end | |
| 94 | + | |
| 95 | + def prompt | |
| 96 | + @prompt | |
| 97 | + end | |
| 98 | + | |
| 99 | + def appearance_id | |
| 100 | + if attributes["appearance_id"] | |
| 101 | + attributes["appearance_id"] | |
| 102 | + elsif prompt and prompt.respond_to? :appearance_id | |
| 103 | + prompt.appearance_id | |
| 104 | + else | |
| 105 | + nil | |
| 106 | + end | |
| 107 | + end | |
| 108 | +end | ... | ... |
| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | +module Pairwise::Resource | |
| 2 | + %w(site user password).each do |attr| | |
| 3 | + define_method(attr) do | |
| 4 | + Thread.current["#{name}.active_resource.#{attr}"] | |
| 5 | + end | |
| 6 | + | |
| 7 | + if attr.eql?('site') | |
| 8 | + define_method("#{attr}=") do |site| | |
| 9 | + @connection = nil | |
| 10 | + site_uri = create_site_uri_from(site) | |
| 11 | + Thread.current["#{name}.active_resource.site"] = site_uri | |
| 12 | + Thread.current["#{name}.active_resource.user"] = URI.decode(site_uri.user) if site_uri.user | |
| 13 | + Thread.current["#{name}.active_resource.password"] = URI.decode(site_uri.password) if site_uri.password | |
| 14 | + end | |
| 15 | + else | |
| 16 | + define_method("#{attr}=") do |val| | |
| 17 | + @connection = nil | |
| 18 | + Thread.current["#{name}.active_resource.#{attr}"] = val | |
| 19 | + end | |
| 20 | + end | |
| 21 | + end | |
| 22 | +end | |
| 0 | 23 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | +class PairwisePlugin < Noosfero::Plugin | |
| 2 | + | |
| 3 | + def self.plugin_name | |
| 4 | + "PairwisePlugin" | |
| 5 | + end | |
| 6 | + | |
| 7 | + def self.plugin_description | |
| 8 | + _("A plugin that add a pairwise client feature to noosfero.") | |
| 9 | + end | |
| 10 | + | |
| 11 | + # def self.extra_blocks | |
| 12 | + # { | |
| 13 | + # PairwiseBlock => {:type => ['community', 'profile'] } | |
| 14 | + # } | |
| 15 | + # end | |
| 16 | + | |
| 17 | + def self.extra_blocks | |
| 18 | + { PairwisePlugin::QuestionsGroupListBlock => {} } | |
| 19 | + end | |
| 20 | + | |
| 21 | + def content_types | |
| 22 | + [PairwisePlugin::PairwiseContent] | |
| 23 | + # if context.profile.is_a?(Community) | |
| 24 | + # else | |
| 25 | + # [] | |
| 26 | + # end | |
| 27 | + end | |
| 28 | + | |
| 29 | + def stylesheet? | |
| 30 | + true | |
| 31 | + end | |
| 32 | + | |
| 33 | + def js_files | |
| 34 | + 'javascripts/pairwise.js' | |
| 35 | + end | |
| 36 | + | |
| 37 | +end | ... | ... |
| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | +class PairwisePlugin::ChoicesRelated < Noosfero::Plugin::ActiveRecord | |
| 2 | + set_table_name "pairwise_plugin_choices_related" | |
| 3 | + belongs_to :question, :class_name => 'PairwisePlugin::PairwiseContent' | |
| 4 | + belongs_to :user | |
| 5 | + | |
| 6 | + validates_presence_of :question, :choice_id, :parent_choice_id | |
| 7 | + | |
| 8 | + def self.related_choices_for choice_id | |
| 9 | + PairwisePlugin::ChoicesRelated.find_all_by_choice_id(choice_id) + PairwisePlugin::ChoicesRelated.find_all_by_parent_choice_id(choice_id) | |
| 10 | + end | |
| 11 | + | |
| 12 | +end | ... | ... |
plugins/pairwise/lib/pairwise_plugin/helpers/suggestions_helper.rb
0 → 100644
| ... | ... | @@ -0,0 +1,73 @@ |
| 1 | +module PairwisePlugin::Helpers::SuggestionsHelper | |
| 2 | + | |
| 3 | + def pagination_for_choices(choices) | |
| 4 | + pagination_links choices, | |
| 5 | + :params => { | |
| 6 | + :controller => 'pairwise_plugin_suggestions', | |
| 7 | + :action => :index, | |
| 8 | + :profile => profile.identifier | |
| 9 | + } | |
| 10 | + end | |
| 11 | + | |
| 12 | + def link_to_sort_choices(pairwise_content, label, sort_by) | |
| 13 | + | |
| 14 | + sort_order = "asc" | |
| 15 | + | |
| 16 | + if params[:order] | |
| 17 | + | |
| 18 | + order = params[:order] | |
| 19 | + | |
| 20 | + if order[:sort_by] == sort_by | |
| 21 | + case order[:sort_order] | |
| 22 | + when 'asc' | |
| 23 | + sort_order = 'desc' | |
| 24 | + when 'desc' | |
| 25 | + sort_order = 'asc' | |
| 26 | + else | |
| 27 | + sort_order = 'asc' | |
| 28 | + end | |
| 29 | + end | |
| 30 | + | |
| 31 | + end | |
| 32 | + | |
| 33 | + link_to label, :action => "index", :id => pairwise_content.id, :pending => params[:pending], :reproved => params[:reproved], :order => {:sort_by => sort_by, :sort_order => sort_order} | |
| 34 | + end | |
| 35 | + | |
| 36 | + def class_to_order_column(title, order=nil) | |
| 37 | + if order | |
| 38 | + sort_by = title == order[:sort_by] ? "selected_column" : "not_selected_column" | |
| 39 | + | |
| 40 | + #raise sort_by.inspect | |
| 41 | + | |
| 42 | + case order[:sort_order] | |
| 43 | + when 'asc' | |
| 44 | + sort_order = "soDescending" | |
| 45 | + when 'desc' | |
| 46 | + sort_order = "soAscending" | |
| 47 | + else | |
| 48 | + sort_order = "soAscending" | |
| 49 | + end | |
| 50 | + | |
| 51 | + if (title == order[:sort_by]) | |
| 52 | + style = "#{sort_by} #{sort_order}" | |
| 53 | + else | |
| 54 | + style = "#{sort_by}" | |
| 55 | + end | |
| 56 | + else | |
| 57 | + style = "not_selected_column" | |
| 58 | + end | |
| 59 | + end | |
| 60 | + | |
| 61 | + def link_to_edit_choice(pairwise_content, choice) | |
| 62 | + link_to _("Edit"), :action => "edit", :id => pairwise_content.id, :choice_id => choice.id | |
| 63 | + end | |
| 64 | + | |
| 65 | + def link_to_approve_choice(pairwise_content, choice, params) | |
| 66 | + link_to _("Approve"), :action => "approve", :id => pairwise_content.id, :choice_id => choice.id,:page => params[:page], :pending => params[:pending] | |
| 67 | + end | |
| 68 | + | |
| 69 | + def link_to_reprove_idea(pairwise_content, choice, reason, params) | |
| 70 | + link_to _("Reprove"), :action => "reprove", :reason => reason || 'reprove' , :id => pairwise_content.id, :choice_id => choice.id,:page => params[:page], :pending => params[:pending] | |
| 71 | + end | |
| 72 | + | |
| 73 | +end | |
| 0 | 74 | \ No newline at end of file | ... | ... |
plugins/pairwise/lib/pairwise_plugin/helpers/viewer_helper.rb
0 → 100644
| ... | ... | @@ -0,0 +1,175 @@ |
| 1 | +module PairwisePlugin::Helpers::ViewerHelper | |
| 2 | + | |
| 3 | + def pairwise_plugin_stylesheet | |
| 4 | + plugin_style_sheet_path = PairwisePlugin.public_path('style.css') | |
| 5 | + stylesheet_link_tag plugin_style_sheet_path, :cache => "cache/plugins-#{Digest::MD5.hexdigest plugin_style_sheet_path.to_s}" | |
| 6 | + end | |
| 7 | + | |
| 8 | + def choose_left_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil) | |
| 9 | + link_target = {:controller => 'pairwise_plugin_profile', | |
| 10 | + :profile => pairwise_content.profile.identifier, | |
| 11 | + :action => 'choose', :id => pairwise_content.id,:question_id => question.id , :prompt_id => prompt.id, | |
| 12 | + :choice_id => prompt.left_choice_id , :direction => 'left', :appearance_id => appearance_id} | |
| 13 | + link_target.merge!(:embeded => 1) if embeded | |
| 14 | + link_target.merge!(:source => source) if source | |
| 15 | + loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content) | |
| 16 | + link_to_remote prompt.left_choice_text, :loading => loading_javascript, :url => link_target | |
| 17 | + end | |
| 18 | + | |
| 19 | + def skip_vote_open_function(pairwise_content) | |
| 20 | + link_to_function _('Skip vote'), "jQuery(\"#skip_vote_reasons_#{pairwise_content.id}\").slideToggle()" | |
| 21 | + end | |
| 22 | + | |
| 23 | + def skip_vote_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil, reason = nil) | |
| 24 | + link_target = {:controller => 'pairwise_plugin_profile', | |
| 25 | + :profile => pairwise_content.profile.identifier, | |
| 26 | + :action => 'skip_prompt', :id => pairwise_content.id,:question_id => question.id , :prompt_id => prompt.id, | |
| 27 | + :appearance_id => appearance_id} | |
| 28 | + link_target.merge!(:embeded => 1) if embeded | |
| 29 | + link_target.merge!(:source => source) if source | |
| 30 | + link_target.merge!(:appearance_id => appearance_id) if appearance_id | |
| 31 | + link_target.merge!(:reason => reason) if reason | |
| 32 | + link_text = reason ? reason : _('Skip vote') | |
| 33 | + if reason | |
| 34 | + loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content) | |
| 35 | + "<li class='skip_vote_item'>" + link_to_remote(link_text, :loading => loading_javascript, :url => link_target) + "</li>" | |
| 36 | + else | |
| 37 | + link_to_remote(link_text, link_target) | |
| 38 | + end | |
| 39 | + end | |
| 40 | + | |
| 41 | + def pairwise_spinner_id(pairwise_content) | |
| 42 | + return "pairwise_spinner#{pairwise_content.id}" | |
| 43 | + end | |
| 44 | + def pairwise_spinner(pairwise_content) | |
| 45 | + text = content_tag :h5, _('Processing... please wait.') | |
| 46 | + content_tag :div, text, :class => "spinner", :id => pairwise_spinner_id(pairwise_content) | |
| 47 | + end | |
| 48 | + | |
| 49 | + def pairwise_spinner_show_function_call(pairwise_content) | |
| 50 | + pairwise_spinner_show_function_name(pairwise_content) + "();" | |
| 51 | + end | |
| 52 | + | |
| 53 | + def pairwise_hide_skip_call(pairwise_content) | |
| 54 | + "jQuery('#skip_vote_reasons_#{pairwise_content.id}').hide();" | |
| 55 | + end | |
| 56 | + | |
| 57 | + def pairwise_spinner_show_function_name(pairwise_content) | |
| 58 | + "jQuery('##{pairwise_spinner_id(pairwise_content)}').fadeIn" | |
| 59 | + end | |
| 60 | + | |
| 61 | + | |
| 62 | + def pairwise_spinner_hide_function_call(pairwise_content) | |
| 63 | + pairwise_spinner_hide_function_name(pairwise_content) + "();" | |
| 64 | + end | |
| 65 | + | |
| 66 | + def pairwise_spinner_hide_function_name(pairwise_content) | |
| 67 | + "jQuery('##{pairwise_spinner_id(pairwise_content)}').fadeOut" | |
| 68 | + end | |
| 69 | + | |
| 70 | + def pairwise_user_identifier(user) | |
| 71 | + if user.nil? | |
| 72 | + is_external_vote ? "#{params[:source]}-#{request.session_options[:id]}" : "participa-#{request.session_options[:id]}" | |
| 73 | + else | |
| 74 | + user.identifier | |
| 75 | + end | |
| 76 | + end | |
| 77 | + | |
| 78 | + def pairwise_embeded_code(pairwise_content) | |
| 79 | + embeded_url = url_for({:controller => "pairwise_plugin_profile", | |
| 80 | + :profile => pairwise_content.profile.identifier, | |
| 81 | + :action => "prompt", | |
| 82 | + :id => pairwise_content.id, | |
| 83 | + :question_id => pairwise_content.question.id, | |
| 84 | + :embeded => 1, | |
| 85 | + :source => "SOURCE_NAME", | |
| 86 | + :only_path => false}) | |
| 87 | + embeded_code = "<iframe src='#{embeded_url}' style='width:100%;height:400px' frameborder='0' allowfullscreen ></iframe>" | |
| 88 | + | |
| 89 | + label = "<hr/>" | |
| 90 | + label += content_tag :h5, _('Pairwise Embeded') | |
| 91 | + textarea = text_area_tag 'embeded_code', embeded_code, {:style => "width: 100%; background-color: #ccc; font-weight:bold", :rows => 7} | |
| 92 | + hint = content_tag :quote, _("You can put this iframe in your site. Replace <b>source</b> param with your site address and make any needed adjusts in width and height.") | |
| 93 | + label + textarea + hint + "<hr/>" | |
| 94 | + end | |
| 95 | + | |
| 96 | + def choose_right_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil) | |
| 97 | + link_target = { :controller => 'pairwise_plugin_profile', | |
| 98 | + :profile => pairwise_content.profile.identifier, | |
| 99 | + :action => 'choose', :id => pairwise_content.id, :question_id => question.id , :prompt_id => prompt.id, | |
| 100 | + :choice_id => prompt.right_choice_id , :direction => 'right' , :appearance_id => appearance_id} | |
| 101 | + link_target.merge!(:embeded => 1) if embeded | |
| 102 | + link_target.merge!(:source => source) if source | |
| 103 | + loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content) | |
| 104 | + link_to_remote prompt.right_choice_text, :loading => loading_javascript, :url => link_target | |
| 105 | + end | |
| 106 | + | |
| 107 | + def pairwise_edit_link(label, pairwise_content) | |
| 108 | + link_target = myprofile_path(:controller => :cms, :profile => pairwise_content.profile.identifier, :action => :edit, :id => pairwise_content.id) | |
| 109 | + link_to label, link_target | |
| 110 | + end | |
| 111 | + | |
| 112 | + def pairwise_result_link(label, pairwise_content, embeded = false, options = {}) | |
| 113 | + link_target = pairwise_content.result_url | |
| 114 | + link_target.merge!(:embeded => 1) if embeded | |
| 115 | + link_to label, link_target, options | |
| 116 | + end | |
| 117 | + | |
| 118 | + def pairwise_tab_remote_link(label, link_target, pairwise_content, embeded = false, options = {}) | |
| 119 | + link_target.merge!(:embeded => 1) if embeded | |
| 120 | + loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content) | |
| 121 | + link_to_remote label, :loading => loading_javascript, :url => link_target, :html => options | |
| 122 | + end | |
| 123 | + | |
| 124 | + def pairwise_suggestion_url(question, embeded = false, source = nil) | |
| 125 | + target = { :controller => :pairwise_plugin_profile, :profile => question.profile.identifier,:action => 'suggest_idea', :id => question.id } | |
| 126 | + target.merge!({ :embeded => 1 }) if embeded | |
| 127 | + target.merge!({ :source => source }) if source | |
| 128 | + target | |
| 129 | + end | |
| 130 | + | |
| 131 | + def is_external_vote | |
| 132 | + params.has_key?("source") && !params[:source].empty? | |
| 133 | + end | |
| 134 | + | |
| 135 | + def ideas_management_link(label, pairwise_content, user) | |
| 136 | + return "" unless user | |
| 137 | + return "" unless pairwise_content.allow_edit?(user) | |
| 138 | + link_to label, :controller => :pairwise_plugin_suggestions, :profile => pairwise_content.profile.identifier, :action => :index, :id => pairwise_content.id | |
| 139 | + end | |
| 140 | + | |
| 141 | + def has_param_pending_choices? | |
| 142 | + params.has_key?("pending") && "1".eql?(params[:pending]) | |
| 143 | + end | |
| 144 | + | |
| 145 | + def has_param_reproved_choices? | |
| 146 | + params.has_key?("reproved") && "1".eql?(params[:reproved]) | |
| 147 | + end | |
| 148 | + | |
| 149 | + def choices_showing_text | |
| 150 | + ideas_or_suggestions_text = has_param_pending_choices? ? "Suggestions" : "Ideas" | |
| 151 | + _("Showing") + " " + ideas_or_suggestions_text | |
| 152 | + end | |
| 153 | + | |
| 154 | + def pairwise_span_arrow(index) | |
| 155 | + content_tag :span, '', :class => (index == 0 ? 'active' : '') | |
| 156 | + end | |
| 157 | + | |
| 158 | + def pairwise_group_row_classes(index) | |
| 159 | + index == 0 ? 'row' : 'row secondary' | |
| 160 | + end | |
| 161 | + | |
| 162 | + def pairwise_group_content_body(index, pairwise_content, prompt_id = nil) | |
| 163 | + style = (index > 0) ? 'display:none' : '' | |
| 164 | + content_tag :div, :class => "pairwise_inner_body", :id => "pairwise_inner_body_#{pairwise_content.id}", :style => style do | |
| 165 | + render :partial => 'content_viewer/prompt_body', | |
| 166 | + :locals => { | |
| 167 | + :embeded => params[:embeded], | |
| 168 | + :source => params[:source], | |
| 169 | + :pairwise_content => pairwise_content, | |
| 170 | + :question => nil | |
| 171 | + } | |
| 172 | + end | |
| 173 | + end | |
| 174 | +end | |
| 175 | + | ... | ... |
plugins/pairwise/lib/pairwise_plugin/pairwise_content.rb
0 → 100644
| ... | ... | @@ -0,0 +1,330 @@ |
| 1 | +class PairwisePlugin::PairwiseContent < Article | |
| 2 | + include ActionView::Helpers::TagHelper | |
| 3 | + settings_items :pairwise_question_id | |
| 4 | + settings_items :allow_new_ideas, :type => :boolean, :default => true | |
| 5 | + | |
| 6 | + before_save :send_question_to_service | |
| 7 | + | |
| 8 | + validate_on_create :validate_choices | |
| 9 | + | |
| 10 | + REASONS_ARRAY = [ | |
| 11 | + {:text => _("I like both ideas"), :compare => false}, | |
| 12 | + {:text => _("I think both ideas are the same"), :compare => false}, | |
| 13 | + {:text => _("I don't know enough about either idea"),:compare => false}, | |
| 14 | + {:text => _("I don't like either idea"), :compare => false}, | |
| 15 | + {:text => _("I don't know enough about: "),:compare => true}, | |
| 16 | + {:text => _("I just can't decide"),:compare => false} | |
| 17 | + ] | |
| 18 | + | |
| 19 | + def initialize(*args) | |
| 20 | + super(*args) | |
| 21 | + self.published = false | |
| 22 | + self.accept_comments = false | |
| 23 | + self.notify_comments = false | |
| 24 | + @next_prompt = nil | |
| 25 | + end | |
| 26 | + | |
| 27 | + def has_next_prompt? | |
| 28 | + @next_prompt.present? | |
| 29 | + end | |
| 30 | + | |
| 31 | + alias_method :original_view_url, :view_url | |
| 32 | + | |
| 33 | + def result_url | |
| 34 | + profile.url.merge( | |
| 35 | + :controller => :pairwise_plugin_profile, | |
| 36 | + :action => :result, | |
| 37 | + :id => id) | |
| 38 | + end | |
| 39 | + | |
| 40 | + def prompt_url | |
| 41 | + profile.url.merge( | |
| 42 | + :controller => :pairwise_plugin_profile, | |
| 43 | + :action => :prompt_tab, | |
| 44 | + :id => id) | |
| 45 | + end | |
| 46 | + | |
| 47 | + def self.short_description | |
| 48 | + 'Pairwise question' | |
| 49 | + end | |
| 50 | + | |
| 51 | + def self.description | |
| 52 | + 'Question managed by pairwise' | |
| 53 | + end | |
| 54 | + | |
| 55 | + def to_html(options = {}) | |
| 56 | + source = options["source"] | |
| 57 | + embeded = options.has_key? "embeded" | |
| 58 | + prompt_id = options["prompt_id"] | |
| 59 | + pairwise_content = self | |
| 60 | + lambda do | |
| 61 | + locals = {:pairwise_content => pairwise_content, :source => source, :embeded => embeded, :prompt_id => prompt_id } | |
| 62 | + render :file => 'content_viewer/prompt.rhtml', :locals => locals | |
| 63 | + end | |
| 64 | + end | |
| 65 | + | |
| 66 | + def pairwise_client | |
| 67 | + @pairwise_client ||= Pairwise::Client.build(profile.id, environment.settings[:pairwise_plugin]) | |
| 68 | + @pairwise_client | |
| 69 | + end | |
| 70 | + | |
| 71 | + | |
| 72 | + def prepare_prompt(user_identifier, prompt_id=nil) | |
| 73 | + prepared_question = question | |
| 74 | + if has_next_prompt? | |
| 75 | + prepared_question.set_prompt @next_prompt | |
| 76 | + else | |
| 77 | + prepared_question = self.question_with_prompt_for_visitor(user_identifier, prompt_id) | |
| 78 | + end | |
| 79 | + prepared_question | |
| 80 | + end | |
| 81 | + | |
| 82 | + def question | |
| 83 | + begin | |
| 84 | + @question ||= pairwise_client.find_question_by_id(pairwise_question_id) | |
| 85 | + rescue Exception => error | |
| 86 | + errors.add_to_base(error.message) | |
| 87 | + end | |
| 88 | + @question | |
| 89 | + end | |
| 90 | + | |
| 91 | + def question_with_prompt_for_visitor(visitor='guest', prompt_id=nil) | |
| 92 | + pairwise_client.question_with_prompt(pairwise_question_id, visitor, prompt_id) | |
| 93 | + end | |
| 94 | + | |
| 95 | + def description=(value) | |
| 96 | + @description=value | |
| 97 | + end | |
| 98 | + | |
| 99 | + def description | |
| 100 | + begin | |
| 101 | + @description ||= question.name | |
| 102 | + rescue | |
| 103 | + @description = "" | |
| 104 | + end | |
| 105 | + @description | |
| 106 | + end | |
| 107 | + | |
| 108 | + def pending_choices(filter, order) | |
| 109 | + if(question) | |
| 110 | + @inactive_choices ||= question.pending_choices(filter, order) | |
| 111 | + else | |
| 112 | + [] | |
| 113 | + end | |
| 114 | + end | |
| 115 | + | |
| 116 | + def reproved_choices(filter, order) | |
| 117 | + @reproved_choices ||= question ? question.reproved_choices(filter, order) : [] | |
| 118 | + end | |
| 119 | + | |
| 120 | + def inactive_choices(options={}) | |
| 121 | + if(question) | |
| 122 | + @inactive_choices ||= (question.choices_include_inactive - question.get_choices) | |
| 123 | + else | |
| 124 | + [] | |
| 125 | + end | |
| 126 | + end | |
| 127 | + | |
| 128 | + def raw_choices(filter=nil, order=nil) | |
| 129 | + return [] if pairwise_question_id.nil? | |
| 130 | + @raw_choices ||= question ? question.get_choices(filter, order) : [] | |
| 131 | + end | |
| 132 | + | |
| 133 | + def choices | |
| 134 | + if raw_choices.nil? | |
| 135 | + @choices = [] | |
| 136 | + else | |
| 137 | + begin | |
| 138 | + @choices ||= question.get_choices.map {|q| { q.id.to_s, q.data } } | |
| 139 | + rescue | |
| 140 | + @choices = [] | |
| 141 | + end | |
| 142 | + end | |
| 143 | + @choices | |
| 144 | + end | |
| 145 | + | |
| 146 | + def choices=(value) | |
| 147 | + @choices = value | |
| 148 | + end | |
| 149 | + | |
| 150 | + def choices_saved | |
| 151 | + @choices_saved | |
| 152 | + end | |
| 153 | + | |
| 154 | + def choices_saved=value | |
| 155 | + @choices_saved = value | |
| 156 | + end | |
| 157 | + | |
| 158 | + def vote_to(prompt_id, direction, visitor, appearance_id) | |
| 159 | + raise _("Excepted question not found") if question.nil? | |
| 160 | + next_prompt = pairwise_client.vote(question.id, prompt_id, direction, visitor, appearance_id) | |
| 161 | + touch #invalidates cache | |
| 162 | + set_next_prompt(next_prompt) | |
| 163 | + next_prompt | |
| 164 | + end | |
| 165 | + | |
| 166 | + def skip_prompt(prompt_id, visitor, appearance_id, reason=nil) | |
| 167 | + next_prompt = pairwise_client.skip_prompt(question.id, prompt_id, visitor, appearance_id, reason) | |
| 168 | + touch #invalidates cache | |
| 169 | + set_next_prompt(next_prompt) | |
| 170 | + next_prompt | |
| 171 | + end | |
| 172 | + | |
| 173 | + def ask_skip_reasons(prompt) | |
| 174 | + reasons = REASONS_ARRAY.map do |item| | |
| 175 | + if item[:compare] | |
| 176 | + [ item[:text] + prompt.left_choice_text, item[:text] + prompt.right_choice_text] | |
| 177 | + else | |
| 178 | + item[:text] | |
| 179 | + end | |
| 180 | + end | |
| 181 | + reasons.flatten | |
| 182 | + end | |
| 183 | + | |
| 184 | + def validate_choices | |
| 185 | + errors.add_to_base(_("Choices empty")) if choices.nil? | |
| 186 | + errors.add_to_base(_("Choices invalid format")) unless choices.is_a?(Array) | |
| 187 | + errors.add_to_base(_("Choices invalid")) if choices.size == 0 | |
| 188 | + choices.each do | choice | | |
| 189 | + if choice.empty? | |
| 190 | + errors.add_to_base(_("Choice empty")) | |
| 191 | + break | |
| 192 | + end | |
| 193 | + end | |
| 194 | + end | |
| 195 | + | |
| 196 | + def update_choice(choice_id, choice_text, active) | |
| 197 | + begin | |
| 198 | + return pairwise_client.update_choice(question, choice_id, choice_text, active) | |
| 199 | + rescue Exception => e | |
| 200 | + errors.add_to_base(N_("Choices:") + " " + N_(e.message)) | |
| 201 | + return false | |
| 202 | + end | |
| 203 | + end | |
| 204 | + | |
| 205 | + def approve_choice(choice_id) | |
| 206 | + begin | |
| 207 | + return pairwise_client.approve_choice(question, choice_id) | |
| 208 | + rescue Exception => e | |
| 209 | + errors.add_to_base(N_("Choices:") + " " + N_(e.message)) | |
| 210 | + return false | |
| 211 | + end | |
| 212 | + end | |
| 213 | + | |
| 214 | + def flag_choice(choice_id, explanation=nil) | |
| 215 | + pairwise_client.flag_choice(question, choice_id, explanation || 'reproved') | |
| 216 | + end | |
| 217 | + | |
| 218 | + def find_choice id | |
| 219 | + return nil if question.nil? | |
| 220 | + question.find_choice id | |
| 221 | + end | |
| 222 | + | |
| 223 | + def toggle_autoactivate_ideas(active_flag) | |
| 224 | + pairwise_client.toggle_autoactivate_ideas(question, active_flag) | |
| 225 | + end | |
| 226 | + | |
| 227 | + def send_question_to_service | |
| 228 | + if new_record? | |
| 229 | + @question = create_pairwise_question | |
| 230 | + self.pairwise_question_id = @question.id | |
| 231 | + toggle_autoactivate_ideas(false) | |
| 232 | + else | |
| 233 | + #add new choices | |
| 234 | + unless @choices.nil? | |
| 235 | + @choices.each do |choice_text| | |
| 236 | + begin | |
| 237 | + unless choice_text.empty? | |
| 238 | + choice = pairwise_client.add_choice(pairwise_question_id, choice_text) | |
| 239 | + pairwise_client.approve_choice(question, choice.id) | |
| 240 | + end | |
| 241 | + rescue Exception => e | |
| 242 | + errors.add_to_base(N_("Choices: Error adding new choice to question") + N_(e.message)) | |
| 243 | + return false | |
| 244 | + end | |
| 245 | + end | |
| 246 | + end | |
| 247 | + #change old choices | |
| 248 | + unless @choices_saved.nil? | |
| 249 | + @choices_saved.each do |id,data| | |
| 250 | + begin | |
| 251 | + pairwise_client.update_choice(question, id, data, true) | |
| 252 | + rescue Exception => e | |
| 253 | + errors.add_to_base(N_("Choices:") + " " + N_(e.message)) | |
| 254 | + return false | |
| 255 | + end | |
| 256 | + end | |
| 257 | + end | |
| 258 | + begin | |
| 259 | + pairwise_client.update_question(pairwise_question_id, name) | |
| 260 | + rescue Exception => e | |
| 261 | + errors.add_to_base(N_("Question not saved: ") + N_(e.message)) | |
| 262 | + return false | |
| 263 | + end | |
| 264 | + end | |
| 265 | + end | |
| 266 | + | |
| 267 | + def create_pairwise_question | |
| 268 | + question = pairwise_client.create_question(name, choices) | |
| 269 | + question | |
| 270 | + end | |
| 271 | + | |
| 272 | + def ideas_contributors(options=nil) | |
| 273 | + question.get_ideas_contributors(options) | |
| 274 | + end | |
| 275 | + | |
| 276 | + def allow_new_ideas? | |
| 277 | + allow_new_ideas | |
| 278 | + end | |
| 279 | + | |
| 280 | + def add_new_idea(text, visitor=nil) | |
| 281 | + return false unless allow_new_ideas? | |
| 282 | + pairwise_client.add_new_idea(pairwise_question_id, text, visitor) | |
| 283 | + end | |
| 284 | + | |
| 285 | + def join_choices(ids_choices_to_join, id_choice_elected, user) | |
| 286 | + ids_choices_to_join.each do |id_choice| | |
| 287 | + unless id_choice.eql?(id_choice_elected) | |
| 288 | + choice = question.find_choice(id_choice) | |
| 289 | + choice_related = PairwisePlugin::ChoicesRelated.new do |cr| | |
| 290 | + cr.question = self | |
| 291 | + cr.choice_id = choice.id | |
| 292 | + cr.parent_choice_id = id_choice_elected | |
| 293 | + cr.user = user | |
| 294 | + cr.save! | |
| 295 | + end | |
| 296 | + end | |
| 297 | + end | |
| 298 | + end | |
| 299 | + | |
| 300 | + def copy(options = {}) | |
| 301 | + attrs = attributes.reject! { |key, value| ATTRIBUTES_NOT_COPIED.include?(key.to_sym) } | |
| 302 | + attrs.merge!(options) | |
| 303 | + obj = self.class.new(attrs) | |
| 304 | + obj.pairwise_question_id = self.pairwise_question_id | |
| 305 | + obj.allow_new_ideas = self.allow_new_ideas | |
| 306 | + id = obj.send(:create_without_callbacks) | |
| 307 | + raise "Objeto não gravado" unless id | |
| 308 | + end | |
| 309 | + | |
| 310 | + def copy!(options = {}) | |
| 311 | + attrs = attributes.reject! { |key, value| ATTRIBUTES_NOT_COPIED.include?(key.to_sym) } | |
| 312 | + attrs.merge!(options) | |
| 313 | + #self.class.create!(attrs) | |
| 314 | + obj = self.class.new(attrs) | |
| 315 | + obj.pairwise_question_id = self.pairwise_question_id | |
| 316 | + obj.allow_new_ideas = self.allow_new_ideas | |
| 317 | + id = obj.send(:create_without_callbacks) | |
| 318 | + raise "Objeto não gravado" unless id | |
| 319 | + end | |
| 320 | + | |
| 321 | + def page_size | |
| 322 | + 20 | |
| 323 | + end | |
| 324 | + | |
| 325 | +private | |
| 326 | + | |
| 327 | + def set_next_prompt(prompt) | |
| 328 | + @next_prompt = Pairwise::Prompt.new(prompt["prompt"]) | |
| 329 | + end | |
| 330 | +end | ... | ... |
plugins/pairwise/lib/pairwise_plugin/pairwise_question_block.rb
0 → 100644
| ... | ... | @@ -0,0 +1,32 @@ |
| 1 | +class PairwisePlugin::PairwiseQuestionBlock < Block | |
| 2 | + | |
| 3 | + settings_items :pairwise_question_id, :type => :integer | |
| 4 | + | |
| 5 | + alias :profile :owner | |
| 6 | + | |
| 7 | + def self.description | |
| 8 | + _('Display active pairwise question') | |
| 9 | + end | |
| 10 | + | |
| 11 | + def help | |
| 12 | + _('This block displays a pairwise question.') | |
| 13 | + end | |
| 14 | + | |
| 15 | + def content(args={}) | |
| 16 | + block = self | |
| 17 | + lambda do | |
| 18 | + pairwise_client = new PairwiseClient(owner.id) | |
| 19 | + question = pairwise_client.get_question(pairwise_question_id) | |
| 20 | + if !question.blank? | |
| 21 | + block_title(question.name) + content_tag('div', | |
| 22 | + render(:file => 'blocks/pairwise_question', :locals => {:question => question}), :class => 'contents', :id => "pairwise_question_#{block.id}") | |
| 23 | + else | |
| 24 | + '' | |
| 25 | + end | |
| 26 | + end | |
| 27 | + end | |
| 28 | + | |
| 29 | + def cacheable? | |
| 30 | + false | |
| 31 | + end | |
| 32 | +end | |
| 0 | 33 | \ No newline at end of file | ... | ... |
plugins/pairwise/lib/pairwise_plugin/questions_group_block.rb
0 → 100644
| ... | ... | @@ -0,0 +1,70 @@ |
| 1 | +class PairwisePlugin::QuestionsGroupBlock < Block | |
| 2 | + | |
| 3 | + def self.description | |
| 4 | + _('Display question of a group of questions') | |
| 5 | + end | |
| 6 | + | |
| 7 | + def help | |
| 8 | + _('This block displays one of your pairwise questions in a predefined group. You can edit the block to select which one of your questions is going to be displayed in the block.') | |
| 9 | + end | |
| 10 | + | |
| 11 | + | |
| 12 | + def content(args={}) | |
| 13 | + block = self | |
| 14 | + question = pick_question | |
| 15 | + lambda do | |
| 16 | + content = block_title(block.title) | |
| 17 | + content += ( question ? article_to_html(question,:gallery_view => false, :format => 'full').html_safe : _('No Question selected yet.') ) | |
| 18 | + end | |
| 19 | + end | |
| 20 | + | |
| 21 | + def questions_ids | |
| 22 | + self.settings[:questions_ids] | |
| 23 | + end | |
| 24 | + | |
| 25 | + def questions_ids= value | |
| 26 | + if value.is_a?(Array) | |
| 27 | + self.settings[:questions_ids] = value | |
| 28 | + else | |
| 29 | + self.settings[:questions_ids] = value.nil? ? [] : [value] | |
| 30 | + end | |
| 31 | + self.settings[:questions_ids].delete('') | |
| 32 | + end | |
| 33 | + | |
| 34 | + def pick_question | |
| 35 | + (questions && questions.length > 0) ? questions[Kernel.rand(questions.size)] : nil | |
| 36 | + end | |
| 37 | + | |
| 38 | + def questions(reload = false) | |
| 39 | + @questions = nil if reload | |
| 40 | + if @questions || questions_ids | |
| 41 | + begin | |
| 42 | + @questions = Article.find(:all, :conditions => {'id' => questions_ids}) | |
| 43 | + rescue ActiveRecord::RecordNotFound | |
| 44 | + # dangling reference, clear it | |
| 45 | + @questions = [] | |
| 46 | + self.questions_ids = nil | |
| 47 | + self.save! | |
| 48 | + end | |
| 49 | + end | |
| 50 | + @questions | |
| 51 | + end | |
| 52 | + | |
| 53 | + def questions=(arr) | |
| 54 | + self.questions_ids = arr.select {|x| x.attribute[:id] } | |
| 55 | + @questions = arr | |
| 56 | + end | |
| 57 | + | |
| 58 | + def available_questions | |
| 59 | + return [] if self.owner.nil? | |
| 60 | + self.owner.kind_of?(Environment) ? self.owner.portal_community.questions : self.owner.questions | |
| 61 | + end | |
| 62 | + | |
| 63 | + def self.expire_on | |
| 64 | + { :profile => [:article], :environment => [:article] } | |
| 65 | + end | |
| 66 | + | |
| 67 | + def cacheable? | |
| 68 | + false | |
| 69 | + end | |
| 70 | +end | ... | ... |
plugins/pairwise/lib/pairwise_plugin/questions_group_list_block.rb
0 → 100644
| ... | ... | @@ -0,0 +1,124 @@ |
| 1 | +class PairwisePlugin::QuestionsGroupListBlock < Block | |
| 2 | + | |
| 3 | + def self.description | |
| 4 | + _('Display question of a group of questions') | |
| 5 | + end | |
| 6 | + | |
| 7 | + def help | |
| 8 | + _('This block displays one of your pairwise questions in a predefined group. You can edit the block to select which one of your questions is going to be displayed in the block.') | |
| 9 | + end | |
| 10 | + | |
| 11 | + settings_items :group_description, :type => String | |
| 12 | + | |
| 13 | + def content(args={}) | |
| 14 | + block = self | |
| 15 | + questions = questions.shuffle if(questions) | |
| 16 | + #lambda do | |
| 17 | + # content = block_title(block.title) | |
| 18 | + # content += ( question ? article_to_html(question,:gallery_view => false, :format => 'full').html_safe : _('No Question selected yet.') ) | |
| 19 | + #end | |
| 20 | + lambda do | |
| 21 | + render :file => 'blocks/questions_group_list.rhtml', :locals => {:block => block} | |
| 22 | + end | |
| 23 | + end | |
| 24 | + | |
| 25 | + def random_sort= value | |
| 26 | + self.settings[:random_sort] = value | |
| 27 | + end | |
| 28 | + | |
| 29 | + def random_sort | |
| 30 | + self.settings[:random_sort] | |
| 31 | + end | |
| 32 | + | |
| 33 | + def is_random? | |
| 34 | + random_sort && !'0'.eql?(random_sort) | |
| 35 | + end | |
| 36 | + | |
| 37 | + def contains_question?(id) | |
| 38 | + if self.settings[:questions_ids] | |
| 39 | + self.settings[:questions_ids].include?(id.to_s) | |
| 40 | + else | |
| 41 | + return false | |
| 42 | + end | |
| 43 | + end | |
| 44 | + | |
| 45 | + def questions_ids | |
| 46 | + self.settings[:questions_ids] | |
| 47 | + end | |
| 48 | + | |
| 49 | + def questions_ids= value | |
| 50 | + if value.is_a?(Array) | |
| 51 | + self.settings[:questions_ids] = value | |
| 52 | + else | |
| 53 | + self.settings[:questions_ids] = value.nil? ? [] : value.split(",") | |
| 54 | + end | |
| 55 | + self.settings[:questions_ids].delete('') | |
| 56 | + end | |
| 57 | + | |
| 58 | + def questions_for_view | |
| 59 | + result = nil | |
| 60 | + if questions && questions.length > 0 | |
| 61 | + result = is_random? ? questions.shuffle : questions | |
| 62 | + end | |
| 63 | + result | |
| 64 | + end | |
| 65 | + | |
| 66 | + def questions(reload = false) | |
| 67 | + @questions = nil if reload | |
| 68 | + if @questions || questions_ids | |
| 69 | + begin | |
| 70 | + @questions = [] | |
| 71 | + questions_ids.each do |id| | |
| 72 | + @questions << Article.find(id) | |
| 73 | + end | |
| 74 | + rescue ActiveRecord::RecordNotFound | |
| 75 | + # dangling reference, clear it | |
| 76 | + @questions = [] | |
| 77 | + self.questions_ids = nil | |
| 78 | + self.save! | |
| 79 | + end | |
| 80 | + end | |
| 81 | + @questions | |
| 82 | + end | |
| 83 | + | |
| 84 | + def questions=(arr) | |
| 85 | + self.questions_ids = arr.select {|x| x.attribute[:id] } | |
| 86 | + @questions = arr | |
| 87 | + end | |
| 88 | + | |
| 89 | + def available_questions | |
| 90 | + return [] if self.owner.nil? | |
| 91 | + result = [] | |
| 92 | + conditions = {} | |
| 93 | + if questions_ids && !questions_ids.empty? | |
| 94 | + questions_ids.each do |id| | |
| 95 | + if self.owner.kind_of?(Environment) | |
| 96 | + question = self.owner.portal_community.questions.find(id) | |
| 97 | + else | |
| 98 | + question = self.owner.questions.find(id) | |
| 99 | + end | |
| 100 | + result << question | |
| 101 | + end | |
| 102 | + conditions = { :conditions => ['id not in (?)', questions_ids] } | |
| 103 | + end | |
| 104 | + | |
| 105 | + if self.owner.kind_of?(Environment) | |
| 106 | + result += self.owner.portal_community.questions.find(:all, conditions) | |
| 107 | + else | |
| 108 | + result += self.owner.questions.find(:all, conditions) | |
| 109 | + end | |
| 110 | + result | |
| 111 | + end | |
| 112 | + | |
| 113 | + def self.expire_on | |
| 114 | + { :profile => [:article], :environment => [:article] } | |
| 115 | + end | |
| 116 | + | |
| 117 | + def timeout | |
| 118 | + 1.hours | |
| 119 | + end | |
| 120 | + | |
| 121 | + def embedable? | |
| 122 | + true | |
| 123 | + end | |
| 124 | +end | ... | ... |
1.05 KB
| ... | ... | @@ -0,0 +1,117 @@ |
| 1 | +/* jQuery jqEasyCharCounter plugin | |
| 2 | + * Examples and documentation at: http://www.jqeasy.com/ | |
| 3 | + * Version: 1.0 (05/07/2010) | |
| 4 | + * No license. Use it however you want. Just keep this notice included. | |
| 5 | + * Requires: jQuery v1.3+ | |
| 6 | + * | |
| 7 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
| 8 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | |
| 9 | + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
| 10 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | |
| 11 | + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
| 12 | + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
| 13 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
| 14 | + * OTHER DEALINGS IN THE SOFTWARE. | |
| 15 | + */ | |
| 16 | +(function($) { | |
| 17 | + | |
| 18 | +$.fn.extend({ | |
| 19 | + jqEasyCounter: function(givenOptions) { | |
| 20 | + return this.each(function() { | |
| 21 | + var $this = $(this), | |
| 22 | + options = $.extend({ | |
| 23 | + maxChars: 160, | |
| 24 | + maxCharsWarning: 150, | |
| 25 | + msgFontSize: '100%', | |
| 26 | + msgFontColor: '#000', | |
| 27 | + msgFontFamily: 'inherit', | |
| 28 | + msgTextAlign: 'right', | |
| 29 | + msgWarningColor: '#F00', | |
| 30 | + msgAppendMethod: 'insertAfter' | |
| 31 | + }, givenOptions); | |
| 32 | + | |
| 33 | + if(options.maxChars <= 0) return; | |
| 34 | + // create counter element | |
| 35 | + var jqEasyCounterMsg = $("<div class=\"jqEasyCounterMsg\"> </div>"); | |
| 36 | + var jqEasyCounterMsgStyle = { | |
| 37 | + 'font-size' : options.msgFontSize, | |
| 38 | + 'font-family' : options.msgFontFamily, | |
| 39 | + 'color' : options.msgFontColor, | |
| 40 | + 'text-align' : options.msgTextAlign, | |
| 41 | + 'width' : '100%', | |
| 42 | + 'opacity' : 0 | |
| 43 | + }; | |
| 44 | + jqEasyCounterMsg.css(jqEasyCounterMsgStyle); | |
| 45 | + // append counter element to DOM | |
| 46 | + if (options.target) { | |
| 47 | + jqEasyCounterMsg.appendTo($(options.target)); | |
| 48 | + $(options.target).show(); | |
| 49 | + } | |
| 50 | + else { | |
| 51 | + jqEasyCounterMsg[options.msgAppendMethod]($this); | |
| 52 | + } | |
| 53 | + | |
| 54 | + // bind events to this element | |
| 55 | + $this | |
| 56 | + .bind('keydown keyup keypress focus',function() { | |
| 57 | + // allow chance for other events to modify value first | |
| 58 | + // e.g., hint plugins that clear the value on focus | |
| 59 | + setTimeout(doCount, 1); | |
| 60 | + }); | |
| 61 | + function doCount(){ | |
| 62 | + var val = $this.val(), | |
| 63 | + length = val.length; | |
| 64 | + | |
| 65 | + if(length >= options.maxChars) { | |
| 66 | + val = val.substring(0, options.maxChars); | |
| 67 | + } | |
| 68 | + | |
| 69 | + if(length > options.maxChars){ | |
| 70 | + // keep scroll bar position | |
| 71 | + var originalScrollTopPosition = $this.scrollTop(); | |
| 72 | + $this.val(val.substring(0, options.maxChars)); | |
| 73 | + $this.scrollTop(originalScrollTopPosition); | |
| 74 | + } | |
| 75 | + | |
| 76 | + if(length >= options.maxCharsWarning){ | |
| 77 | + jqEasyCounterMsg.css({"color" : options.msgWarningColor}); | |
| 78 | + }else { | |
| 79 | + jqEasyCounterMsg.css({"color" : options.msgFontColor}); | |
| 80 | + } | |
| 81 | + | |
| 82 | + jqEasyCounterMsg.html(options.maxChars - $this.val().length); | |
| 83 | + jqEasyCounterMsg.stop().fadeTo( 'fast', 1); | |
| 84 | + } | |
| 85 | + }); | |
| 86 | + } | |
| 87 | +}); | |
| 88 | + | |
| 89 | +})(jQuery); | |
| 90 | + | |
| 91 | + jQuery(document).ready(function($){ | |
| 92 | +/* $('#suggestions_box span.close_button').live('click', function(){ | |
| 93 | + $('#suggestions_box').fadeOut(); | |
| 94 | + $('#pairwise_main div.show_new_idea_box').show(); | |
| 95 | + }); | |
| 96 | + | |
| 97 | + $('#suggestions_box_show_link').live('click', function(){ | |
| 98 | + $('#suggestions_box').fadeIn(); | |
| 99 | + $('#pairwise_main div.show_new_idea_box').hide(); | |
| 100 | + }); */ | |
| 101 | + | |
| 102 | + $('#pairwise_main ul.pairwise_menu li a').mouseenter(function(){ | |
| 103 | + if($(this).attr('id') != 'pairwise_voting_tab') { | |
| 104 | + $('#pairwise_voting_tab').attr("class", ""); | |
| 105 | + } | |
| 106 | + }); | |
| 107 | + | |
| 108 | + $('#pairwise_main ul.pairwise_menu li a').mouseout(function(){ | |
| 109 | + if($(this).attr('id') != 'pairwise_voting_tab') { | |
| 110 | + $('#pairwise_voting_tab').attr("class", "active"); | |
| 111 | + } | |
| 112 | + }); | |
| 113 | + $('span.embeded_code_link a').live('click', function(){ | |
| 114 | + $(this).parents('.embeded_code').find('#pairwise_embeded_box').slideToggle(); | |
| 115 | + }); | |
| 116 | + | |
| 117 | + }); | ... | ... |
| ... | ... | @@ -0,0 +1,344 @@ |
| 1 | +div#pairwise_form_fields textarea { | |
| 2 | + width: 100%; | |
| 3 | + margin-top: 5px; | |
| 4 | + height:30px; | |
| 5 | + | |
| 6 | +} | |
| 7 | + | |
| 8 | +#pairwise_main { | |
| 9 | + width: 100%; | |
| 10 | + padding: 10px; | |
| 11 | +} | |
| 12 | + | |
| 13 | +.vote_question { | |
| 14 | + | |
| 15 | +} | |
| 16 | + | |
| 17 | +#pairwise_main div.footer { | |
| 18 | + text-align:right; | |
| 19 | + padding: 20px; | |
| 20 | +} | |
| 21 | + | |
| 22 | +#pairwise_main div.prompt { | |
| 23 | + width: 45%; | |
| 24 | + float:none; | |
| 25 | + color:white; | |
| 26 | + min-height: 30px; | |
| 27 | + height:auto; | |
| 28 | + word-wrap: break-word; | |
| 29 | + font-size: 12pt; | |
| 30 | + text-align: center; | |
| 31 | + display: inline-block; | |
| 32 | + vertical-align: top; | |
| 33 | + | |
| 34 | +} | |
| 35 | + | |
| 36 | +#pairwise_main div.prompt a { | |
| 37 | + width:100%; | |
| 38 | + color:white; | |
| 39 | + display: block; | |
| 40 | + text-decoration: none; | |
| 41 | +} | |
| 42 | + | |
| 43 | + | |
| 44 | +#pairwise_main div#suggestions_box { | |
| 45 | + /*border: 1px solid; | |
| 46 | + border-radius: 7px; | |
| 47 | + -webkit-border-radius: 7px; | |
| 48 | + -moz-border-radius: 7px; | |
| 49 | + border-color: #ccc; | |
| 50 | + border-width: 1px; | |
| 51 | + border-style: solid;*/ | |
| 52 | + padding: 10px; | |
| 53 | + margin-top: 15px; | |
| 54 | +} | |
| 55 | + | |
| 56 | +#pairwise_main div#suggestion_box_loading { | |
| 57 | + color: black; | |
| 58 | + border: 1px solid; | |
| 59 | + border-radius: 7px; | |
| 60 | + -webkit-border-radius: 7px; | |
| 61 | + -moz-border-radius: 7px; | |
| 62 | + border-color: #ccc; | |
| 63 | + border-width: 1px; | |
| 64 | + border-style: solid; | |
| 65 | + padding: 10px; | |
| 66 | + margin-top: 15px; | |
| 67 | + text-align: center; | |
| 68 | +} | |
| 69 | + | |
| 70 | + | |
| 71 | +#pairwise_main div#suggestions_box textarea{ | |
| 72 | + width: 100%; | |
| 73 | + border: 1px solid #99999; | |
| 74 | + border-radius: 5px; | |
| 75 | + -webkit-border-radius: 5px; | |
| 76 | + -moz-border-radius: 5px; | |
| 77 | +} | |
| 78 | + | |
| 79 | +#pairwise_main div#suggestions_box #new_idea_button{ | |
| 80 | + background-color: #01bb00; | |
| 81 | + padding: 5px 10px 5px 10px; | |
| 82 | + cursor: pointer; | |
| 83 | + border-radius: 5px; | |
| 84 | + -webkit-border-radius: 5px; | |
| 85 | + -moz-border-radius: 5px; | |
| 86 | +} | |
| 87 | + | |
| 88 | +#pairwise_main div#suggestions_box div.suggestion_header { | |
| 89 | + text-align: right; | |
| 90 | + color: blue; | |
| 91 | +} | |
| 92 | + | |
| 93 | +#pairwise_main div#suggestions_box #new_idea_button:hover{ | |
| 94 | + boder-color: gray; | |
| 95 | +} | |
| 96 | + | |
| 97 | +#pairwise_main #suggestions_box span.close_button { | |
| 98 | + cursor: pointer; | |
| 99 | +} | |
| 100 | + | |
| 101 | +#pairwise_main #suggestions_box span.close_button:hover { | |
| 102 | + cursor: pointer; | |
| 103 | + text-decoration: underline; | |
| 104 | +} | |
| 105 | + | |
| 106 | + | |
| 107 | +#pairwise_main div.show_new_idea_box { | |
| 108 | + width: 150px; | |
| 109 | + float:none; | |
| 110 | + color:white; | |
| 111 | + min-height: 18px; | |
| 112 | + height:auto; | |
| 113 | + padding: 0.5em; | |
| 114 | + word-wrap: break-word; | |
| 115 | + font-size: 12pt; | |
| 116 | + background-color: #01bb00; | |
| 117 | + text-align: center; | |
| 118 | + border-radius: 7px; | |
| 119 | + -webkit-border-radius: 7px; | |
| 120 | + -moz-border-radius: 7px; | |
| 121 | + border-color:#CCCCCC; | |
| 122 | + border-width: 1px; | |
| 123 | + border-style: solid; | |
| 124 | + vertical-align: top; | |
| 125 | + margin-top: 12px; | |
| 126 | + margin-left: auto; | |
| 127 | + margin-right: auto; | |
| 128 | + text-align: center; | |
| 129 | + clear: both; | |
| 130 | +} | |
| 131 | + | |
| 132 | +#pairwise_main div.show_new_idea_box a{ | |
| 133 | + color: white; | |
| 134 | + text-decoration: none; | |
| 135 | +} | |
| 136 | + | |
| 137 | +#pairwise_main div.show_new_idea_box a:hover{ | |
| 138 | + text-decoration: underline; | |
| 139 | +} | |
| 140 | + | |
| 141 | +#pairwise_main div.skip_vote { | |
| 142 | + width: 150px; | |
| 143 | + float:none; | |
| 144 | + color:white; | |
| 145 | + min-height: 18px; | |
| 146 | + height:auto; | |
| 147 | + padding: 0.5em; | |
| 148 | + word-wrap: break-word; | |
| 149 | + font-size: 12pt; | |
| 150 | + text-align: center; | |
| 151 | + vertical-align: top; | |
| 152 | + margin-top: 12px; | |
| 153 | + margin-left: auto; | |
| 154 | + margin-right: auto; | |
| 155 | + text-align: center; | |
| 156 | +} | |
| 157 | + | |
| 158 | + | |
| 159 | +#pairwise_main div.skip_vote_reasons.show { | |
| 160 | + display:block; | |
| 161 | +} | |
| 162 | + | |
| 163 | +#pairwise_main div.skip_vote_reasons { | |
| 164 | + display:none; | |
| 165 | + padding:20px; | |
| 166 | + margin-bottom: 10px; | |
| 167 | +} | |
| 168 | + | |
| 169 | +#pairwise_main div.skip_vote_item { | |
| 170 | + width:100%; | |
| 171 | + margin-bottom: 15px; | |
| 172 | + padding-left: 5px; | |
| 173 | + padding-right: 5px; | |
| 174 | + /*float:left;*/ | |
| 175 | + float:left; | |
| 176 | + background-color:#ccc; | |
| 177 | + height: 3em; | |
| 178 | + text-align: center; | |
| 179 | + vertical-align: center; | |
| 180 | + min-height: 2em; | |
| 181 | + padding-top: 10px; | |
| 182 | + border-width: 1px; | |
| 183 | + border-style: solid; | |
| 184 | + border-radius: 7px; | |
| 185 | + -webkit-border-radius: 7px; | |
| 186 | + -moz-border-radius: 7px; | |
| 187 | + border-color:#CCCCCC; | |
| 188 | +} | |
| 189 | + | |
| 190 | +#pairwise_main div.skip_vote_reasons div:nth-child(even) { | |
| 191 | + /*margin-left: 10px;*/ | |
| 192 | +} | |
| 193 | + | |
| 194 | +#pairwise_main div.skip_vote a{ | |
| 195 | + color: white; | |
| 196 | + text-decoration: none; | |
| 197 | + width: 100%; | |
| 198 | +} | |
| 199 | + | |
| 200 | +#pairwise_main div.skip_vote a:hover{ | |
| 201 | + text-decoration: underline; | |
| 202 | + width: 100%; | |
| 203 | +} | |
| 204 | + | |
| 205 | +.result_label { | |
| 206 | + padding: 15px 0px; | |
| 207 | +} | |
| 208 | + | |
| 209 | +div.choices_filter { | |
| 210 | + width: 100%; | |
| 211 | + text-align: right; | |
| 212 | +} | |
| 213 | + | |
| 214 | +table.pairwise_choices_table { | |
| 215 | + border: 1px #fcfcfc solid; | |
| 216 | + border-radius: 7px; | |
| 217 | + -webkit-border-radius: 7px; | |
| 218 | + -moz-border-radius: 7px; | |
| 219 | +} | |
| 220 | + | |
| 221 | +table.pairwise_choices_table th{ | |
| 222 | + font-weight: bolder; | |
| 223 | + text-align: left; | |
| 224 | +} | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | +div.pairwise_group_list_container { | |
| 229 | + font-family: 'Open Sans'; | |
| 230 | +} | |
| 231 | + | |
| 232 | +div.pairwise_group_list_container .row { | |
| 233 | + font-size: 14px; | |
| 234 | + height: 40px; | |
| 235 | + width:100%; | |
| 236 | + background-color: #F8C300; | |
| 237 | + vertical-align: middle; | |
| 238 | + margin-top:10px; | |
| 239 | + margin-bottom:auto; | |
| 240 | + padding:0px; | |
| 241 | + cursor: auto; | |
| 242 | +} | |
| 243 | + | |
| 244 | +div.pairwise_group_list_container .row p { | |
| 245 | + line-height: 30px; | |
| 246 | + margin: auto; | |
| 247 | + padding-bottom: 5px; | |
| 248 | + padding-top: 5px; | |
| 249 | +} | |
| 250 | + | |
| 251 | + | |
| 252 | +div.pairwise_group_list_container .title{ | |
| 253 | + display: inline-block; | |
| 254 | + color: #2F5707; | |
| 255 | + Height: 40px; | |
| 256 | + padding-left: 20px; | |
| 257 | +} | |
| 258 | + | |
| 259 | +div.pairwise_group_list_container .number{ | |
| 260 | + display: inline-block; | |
| 261 | + left: 0px; | |
| 262 | + background-color: #2F5707; | |
| 263 | + width: 40px; | |
| 264 | + text-align: center; | |
| 265 | + color: #F8C300; | |
| 266 | + } | |
| 267 | + | |
| 268 | +div.pairwise_group_list_container .row.secondary { | |
| 269 | + cursor: pointer; | |
| 270 | + background-color: #497B16; | |
| 271 | +} | |
| 272 | + | |
| 273 | +div.pairwise_group_list_container .row.secondary .title { | |
| 274 | + color: white; | |
| 275 | +} | |
| 276 | + | |
| 277 | + | |
| 278 | +div.pairwise_group_list_container .row.secondary .number { | |
| 279 | + color: white; | |
| 280 | +} | |
| 281 | + | |
| 282 | +div.pairwise_group_list_container .arrow{ | |
| 283 | + display: inline-block; | |
| 284 | + position: absolute; | |
| 285 | + right: 20px; | |
| 286 | + margin-top: 10px; | |
| 287 | +} | |
| 288 | +/* | |
| 289 | +div.pairwise_group_list_container .arrow{ | |
| 290 | + display: inline-block; | |
| 291 | + position: absolute; | |
| 292 | + right: 20px; | |
| 293 | + margin-top: 10px; | |
| 294 | + height: 22px; | |
| 295 | + width:23px; | |
| 296 | + color: #2F5707; | |
| 297 | + background: url('/designs/themes/participa-theme/images/arrow_right.jpg') no-repeat center; | |
| 298 | +} | |
| 299 | + | |
| 300 | +div.pairwise_group_list_container .arrow.active{ | |
| 301 | + height: 18px; | |
| 302 | + margin-top: 10px; | |
| 303 | + right: 20px; | |
| 304 | + width: 22px; | |
| 305 | + background: url('/designs/themes/participa-theme/images/arrow_down.jpg') no-repeat center; | |
| 306 | +}*/ | |
| 307 | + | |
| 308 | +div.pairwise_group_list_container .row.secondary .arrow span { | |
| 309 | + background: url('/designs/themes/participa-theme/images/arrow_right.jpg') no-repeat center; | |
| 310 | + border: 0px; | |
| 311 | + width: 25px; | |
| 312 | + height: 25px; | |
| 313 | + display: inline-block; | |
| 314 | + cursor: pointer; | |
| 315 | +} | |
| 316 | + | |
| 317 | +div.pairwise_group_list_container .row .arrow span { | |
| 318 | + cursor: auto; | |
| 319 | + border: 0px; | |
| 320 | + width: 25px; | |
| 321 | + height: 25px; | |
| 322 | + display: inline-block; | |
| 323 | + background: url('/designs/themes/participa-theme/images/arrow_down.jpg') no-repeat center; | |
| 324 | + | |
| 325 | +} | |
| 326 | + | |
| 327 | +div.pairwise_main .spinner { | |
| 328 | + position: absolute; | |
| 329 | + text-align: center; | |
| 330 | + width: 95%; | |
| 331 | + height: 190px; | |
| 332 | + display: none; | |
| 333 | + z-index: 999; | |
| 334 | + background-color: #ECF2E7; | |
| 335 | +} | |
| 336 | + | |
| 337 | +div.pairwise_main .spinner h5{ | |
| 338 | + padding-top: 30px; | |
| 339 | +} | |
| 340 | + | |
| 341 | +#pairwise_main .pairwise_content .total_votes { | |
| 342 | + float: right; | |
| 343 | + color: #999; | |
| 344 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | +require 'vcr' | |
| 2 | + | |
| 3 | +VCR.configure do |c| | |
| 4 | + c.cassette_library_dir = "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/vcr_cassettes" | |
| 5 | + c.hook_into :webmock | |
| 6 | +end | |
| 7 | + | |
| 8 | +class HttpStubFixtures | |
| 9 | + attr_accessor :client | |
| 10 | + | |
| 11 | + def initialize(pairwise_env_settings) | |
| 12 | + @client = Pairwise::Client.build('1', pairwise_env_settings) | |
| 13 | + end | |
| 14 | + | |
| 15 | + def create_question(id_question, name, choices) | |
| 16 | + VCR.use_cassette('pairwise_create_question_dynamic', | |
| 17 | + :erb => { :id_question => id_question, :question_name => name, :choices => choices } | |
| 18 | + ) do | |
| 19 | + @client.create_question(name, choices) | |
| 20 | + end | |
| 21 | + end | |
| 22 | +end | |
| 0 | 23 | \ No newline at end of file | ... | ... |
plugins/pairwise/test/fixtures/pairwise_content_fixtures.rb
0 → 100644
| ... | ... | @@ -0,0 +1,80 @@ |
| 1 | +class PairwiseContentFixtures | |
| 2 | + | |
| 3 | + def self.pairwise_content | |
| 4 | + content = PairwisePlugin::PairwiseContent.new | |
| 5 | + content.pairwise_question_id = 1 | |
| 6 | + content.name = "Question 1" | |
| 7 | + content.choices = ["choice1,choice2"] | |
| 8 | + content | |
| 9 | + end | |
| 10 | + | |
| 11 | + def self.content_stub_with_3_choices | |
| 12 | + content = PairwisePlugin::PairwiseContent.new | |
| 13 | + content.pairwise_question_id = 1 | |
| 14 | + content.name = "Question 1" | |
| 15 | + content.choices = ["choice1,choice2,choice3"] | |
| 16 | + content | |
| 17 | + | |
| 18 | + question = Pairwise::Question.new(:id =>1, :name => "Question 1") | |
| 19 | + choices = [] | |
| 20 | + choices << Pairwise::Choice.new(:id => 1, :data => "Choice1") | |
| 21 | + choices << Pairwise::Choice.new(:id => 2, :data => "Choice2") | |
| 22 | + choices << Pairwise::Choice.new(:id => 3, :data => "Choice3") | |
| 23 | + | |
| 24 | + question.stubs(:find_choice).with(1).returns(choices[0]) | |
| 25 | + question.stubs(:find_choice).with(2).returns(choices[1]) | |
| 26 | + question.stubs(:find_choice).with(3).returns(choices[2]) | |
| 27 | + | |
| 28 | + question.stubs(:choices => choices) | |
| 29 | + content.stubs(:question => question) | |
| 30 | + content | |
| 31 | + end | |
| 32 | + | |
| 33 | + def self.new_pairwise_content | |
| 34 | + PairwisePlugin::PairwiseContent.new do |content| | |
| 35 | + content.name = "New question content" | |
| 36 | + content.published = true | |
| 37 | + end | |
| 38 | + end | |
| 39 | + | |
| 40 | + def self.pairwise_content_inactive | |
| 41 | + content = self.pairwise_content | |
| 42 | + content.published = false | |
| 43 | + content | |
| 44 | + end | |
| 45 | + | |
| 46 | + def self.pairwise_question(votes_count = 0) | |
| 47 | + question = Pairwise::Question.new({ | |
| 48 | + :id => 1, | |
| 49 | + :name => 'Question 1', | |
| 50 | + :active => true, | |
| 51 | + :description => 'Some description', | |
| 52 | + :appearance_id => 'abcdef', | |
| 53 | + :votes_count => votes_count | |
| 54 | + }) | |
| 55 | + end | |
| 56 | + | |
| 57 | + def self.pairwise_prompt | |
| 58 | + prompt = Pairwise::Prompt.new({ | |
| 59 | + :id => 1, | |
| 60 | + :question_id => 1, | |
| 61 | + :left_choice_text => 'Option 1', | |
| 62 | + :left_choice_id => 1, | |
| 63 | + :right_choice_text => 'Option 2', | |
| 64 | + :right_choice_id => 2 | |
| 65 | + }) | |
| 66 | + end | |
| 67 | + | |
| 68 | + def self.pairwise_question_with_prompt | |
| 69 | + question = self.pairwise_question | |
| 70 | + question.set_prompt self.pairwise_prompt | |
| 71 | + question | |
| 72 | + end | |
| 73 | + | |
| 74 | + def self.choices_with_stats | |
| 75 | + choices = [] | |
| 76 | + choices << Pairwise::Choice.new(:id => 1, :data => "Choice1", :wins => 0, :losses => 0, :score => 0.0) | |
| 77 | + choices << Pairwise::Choice.new(:id => 2, :data => "Choice2", :wins => 0, :losses => 0, :score => 0.0) | |
| 78 | + choices << Pairwise::Choice.new(:id => 3, :data => "Choice3", :wins => 0, :losses => 0, :score => 0.0) | |
| 79 | + end | |
| 80 | +end | |
| 0 | 81 | \ No newline at end of file | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/flag_choice_as_reproved.yml
0 → 100644
| ... | ... | @@ -0,0 +1,269 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: get | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/6.xml | |
| 7 | + body: | |
| 8 | + string: "" | |
| 9 | + headers: | |
| 10 | + Accept: | |
| 11 | + - application/xml | |
| 12 | + response: | |
| 13 | + status: | |
| 14 | + code: 200 | |
| 15 | + message: "OK " | |
| 16 | + headers: | |
| 17 | + Content-Length: | |
| 18 | + - "955" | |
| 19 | + Cache-Control: | |
| 20 | + - private, max-age=0, must-revalidate | |
| 21 | + Server: | |
| 22 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 23 | + Set-Cookie: | |
| 24 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIhUvcXVlc3Rpb25zLzYueG1sOg9zZXNzaW9uX2lkIiVmNTI4NDk5MWE4MWY4Y2JjZDcyOTFlYmFhMDM0MWZlYg%3D%3D--451165241c218ffe9a88776f330bd9224b3251e7; path=/; HttpOnly | |
| 25 | + Date: | |
| 26 | + - Thu, 20 Mar 2014 15:20:18 GMT | |
| 27 | + Content-Type: | |
| 28 | + - application/xml; charset=utf-8 | |
| 29 | + X-Runtime: | |
| 30 | + - "37" | |
| 31 | + Connection: | |
| 32 | + - Keep-Alive | |
| 33 | + Etag: | |
| 34 | + - "\"890ce780d1a33e8e4dfd9e742c6f54f7\"" | |
| 35 | + body: | |
| 36 | + string: | | |
| 37 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 38 | + <question> | |
| 39 | + <active type="boolean">true</active> | |
| 40 | + <choices-count type="integer">3</choices-count> | |
| 41 | + <created-at type="datetime">2014-03-19T18:38:15Z</created-at> | |
| 42 | + <creator-id type="integer">4</creator-id> | |
| 43 | + <id type="integer">6</id> | |
| 44 | + <inactive-choices-count type="integer">1</inactive-choices-count> | |
| 45 | + <information nil="true"></information> | |
| 46 | + <it-should-autoactivate-ideas type="boolean">true</it-should-autoactivate-ideas> | |
| 47 | + <local-identifier>1</local-identifier> | |
| 48 | + <name>Q1</name> | |
| 49 | + <prompts-count type="integer">0</prompts-count> | |
| 50 | + <show-results type="boolean">true</show-results> | |
| 51 | + <site-id type="integer">1</site-id> | |
| 52 | + <tracking nil="true"></tracking> | |
| 53 | + <updated-at type="datetime">2014-03-20T15:19:04Z</updated-at> | |
| 54 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 55 | + <version type="integer">7</version> | |
| 56 | + <votes-count type="integer">0</votes-count> | |
| 57 | + <item-count type="integer">3</item-count> | |
| 58 | + </question> | |
| 59 | + | |
| 60 | + http_version: | |
| 61 | + recorded_at: Thu, 20 Mar 2014 15:20:18 GMT | |
| 62 | +- request: | |
| 63 | + method: get | |
| 64 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/6/choices.xml?inactive_ignore_flagged=true | |
| 65 | + body: | |
| 66 | + string: "" | |
| 67 | + headers: | |
| 68 | + Accept: | |
| 69 | + - application/xml | |
| 70 | + response: | |
| 71 | + status: | |
| 72 | + code: 200 | |
| 73 | + message: "OK " | |
| 74 | + headers: | |
| 75 | + Content-Length: | |
| 76 | + - "471" | |
| 77 | + Cache-Control: | |
| 78 | + - private, max-age=0, must-revalidate | |
| 79 | + Server: | |
| 80 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 81 | + Set-Cookie: | |
| 82 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIjovcXVlc3Rpb25zLzYvY2hvaWNlcy54bWw%2FaW5hY3RpdmVfaWdub3JlX2ZsYWdnZWQ9dHJ1ZToPc2Vzc2lvbl9pZCIlMDMwMmIxYjA4NjZiNjE2NTAxM2EwYjM0NjdiMzI1N2Y%3D--f0e1fbb7ab8c04b8001b421abbf0680b20b14ab9; path=/; HttpOnly | |
| 83 | + Date: | |
| 84 | + - Thu, 20 Mar 2014 15:20:19 GMT | |
| 85 | + Content-Type: | |
| 86 | + - application/xml; charset=utf-8 | |
| 87 | + X-Runtime: | |
| 88 | + - "57" | |
| 89 | + Connection: | |
| 90 | + - Keep-Alive | |
| 91 | + Etag: | |
| 92 | + - "\"404952a7933bc1080179d9b9ba1f2e18\"" | |
| 93 | + body: | |
| 94 | + string: | | |
| 95 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 96 | + <choices type="array"> | |
| 97 | + <choice> | |
| 98 | + <active type="boolean">false</active> | |
| 99 | + <created-at type="datetime">2014-03-19T18:38:15Z</created-at> | |
| 100 | + <data>Choice 2</data> | |
| 101 | + <id type="integer">38</id> | |
| 102 | + <losses type="integer">0</losses> | |
| 103 | + <score type="float">50.0</score> | |
| 104 | + <wins type="integer">0</wins> | |
| 105 | + <user-created type="boolean">false</user-created> | |
| 106 | + <creator-identifier>1</creator-identifier> | |
| 107 | + </choice> | |
| 108 | + </choices> | |
| 109 | + | |
| 110 | + http_version: | |
| 111 | + recorded_at: Thu, 20 Mar 2014 15:20:19 GMT | |
| 112 | +- request: | |
| 113 | + method: get | |
| 114 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/6/choices/38.xml | |
| 115 | + body: | |
| 116 | + string: "" | |
| 117 | + headers: | |
| 118 | + Accept: | |
| 119 | + - application/xml | |
| 120 | + response: | |
| 121 | + status: | |
| 122 | + code: 200 | |
| 123 | + message: "OK " | |
| 124 | + headers: | |
| 125 | + Content-Length: | |
| 126 | + - "1048" | |
| 127 | + Cache-Control: | |
| 128 | + - private, max-age=0, must-revalidate | |
| 129 | + Server: | |
| 130 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 131 | + Set-Cookie: | |
| 132 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIiAvcXVlc3Rpb25zLzYvY2hvaWNlcy8zOC54bWw6D3Nlc3Npb25faWQiJWE5ZjA3MjM3NGE3ODdmMzc2MzI1YjkyNGU3ZDRjMTM0--c7700e91fd411a2aa89ceb1ed8629d279038b7d5; path=/; HttpOnly | |
| 133 | + Date: | |
| 134 | + - Thu, 20 Mar 2014 15:20:19 GMT | |
| 135 | + Content-Type: | |
| 136 | + - application/xml; charset=utf-8 | |
| 137 | + X-Runtime: | |
| 138 | + - "74" | |
| 139 | + Connection: | |
| 140 | + - Keep-Alive | |
| 141 | + Etag: | |
| 142 | + - "\"484f2a633216bd272aeb60e35c4dd7e4\"" | |
| 143 | + body: | |
| 144 | + string: | | |
| 145 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 146 | + <choice> | |
| 147 | + <active type="boolean">false</active> | |
| 148 | + <created-at type="datetime">2014-03-19T18:38:15Z</created-at> | |
| 149 | + <creator-id type="integer">4</creator-id> | |
| 150 | + <data>Choice 2</data> | |
| 151 | + <id type="integer">38</id> | |
| 152 | + <item-id type="integer" nil="true"></item-id> | |
| 153 | + <local-identifier nil="true"></local-identifier> | |
| 154 | + <losses type="integer">0</losses> | |
| 155 | + <position type="integer" nil="true"></position> | |
| 156 | + <prompt-id type="integer" nil="true"></prompt-id> | |
| 157 | + <prompts-count type="integer">0</prompts-count> | |
| 158 | + <prompts-on-the-left-count type="integer">0</prompts-on-the-left-count> | |
| 159 | + <prompts-on-the-right-count type="integer">0</prompts-on-the-right-count> | |
| 160 | + <question-id type="integer">6</question-id> | |
| 161 | + <ratings type="integer" nil="true"></ratings> | |
| 162 | + <request-id type="integer" nil="true"></request-id> | |
| 163 | + <score type="float">50.0</score> | |
| 164 | + <tracking nil="true"></tracking> | |
| 165 | + <updated-at type="datetime">2014-03-20T15:19:04Z</updated-at> | |
| 166 | + <version type="integer">4</version> | |
| 167 | + <wins type="integer">0</wins> | |
| 168 | + </choice> | |
| 169 | + | |
| 170 | + http_version: | |
| 171 | + recorded_at: Thu, 20 Mar 2014 15:20:19 GMT | |
| 172 | +- request: | |
| 173 | + method: put | |
| 174 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/6/choices/38/flag.xml?explanation=reproved&visitor_identifier=1 | |
| 175 | + body: | |
| 176 | + string: "" | |
| 177 | + headers: | |
| 178 | + Accept: | |
| 179 | + - "*/*" | |
| 180 | + Content-Type: | |
| 181 | + - application/xml | |
| 182 | + response: | |
| 183 | + status: | |
| 184 | + code: 201 | |
| 185 | + message: "Created " | |
| 186 | + headers: | |
| 187 | + Content-Length: | |
| 188 | + - "1048" | |
| 189 | + Cache-Control: | |
| 190 | + - no-cache | |
| 191 | + Server: | |
| 192 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 193 | + Set-Cookie: | |
| 194 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlMGIxZmU1MGYzZDFhNDNmNzhlMTY1ZmZhYWQ5ZDY4ZDI%3D--7d921de6d0fc3eeb5ef6f37ff00159a427455892; path=/; HttpOnly | |
| 195 | + Date: | |
| 196 | + - Thu, 20 Mar 2014 15:20:19 GMT | |
| 197 | + Content-Type: | |
| 198 | + - application/xml; charset=utf-8 | |
| 199 | + X-Runtime: | |
| 200 | + - "75" | |
| 201 | + Connection: | |
| 202 | + - Keep-Alive | |
| 203 | + body: | |
| 204 | + string: | | |
| 205 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 206 | + <choice> | |
| 207 | + <active type="boolean">false</active> | |
| 208 | + <created-at type="datetime">2014-03-19T18:38:15Z</created-at> | |
| 209 | + <creator-id type="integer">4</creator-id> | |
| 210 | + <data>Choice 2</data> | |
| 211 | + <id type="integer">38</id> | |
| 212 | + <item-id type="integer" nil="true"></item-id> | |
| 213 | + <local-identifier nil="true"></local-identifier> | |
| 214 | + <losses type="integer">0</losses> | |
| 215 | + <position type="integer" nil="true"></position> | |
| 216 | + <prompt-id type="integer" nil="true"></prompt-id> | |
| 217 | + <prompts-count type="integer">0</prompts-count> | |
| 218 | + <prompts-on-the-left-count type="integer">0</prompts-on-the-left-count> | |
| 219 | + <prompts-on-the-right-count type="integer">0</prompts-on-the-right-count> | |
| 220 | + <question-id type="integer">6</question-id> | |
| 221 | + <ratings type="integer" nil="true"></ratings> | |
| 222 | + <request-id type="integer" nil="true"></request-id> | |
| 223 | + <score type="float">50.0</score> | |
| 224 | + <tracking nil="true"></tracking> | |
| 225 | + <updated-at type="datetime">2014-03-20T15:19:04Z</updated-at> | |
| 226 | + <version type="integer">4</version> | |
| 227 | + <wins type="integer">0</wins> | |
| 228 | + </choice> | |
| 229 | + | |
| 230 | + http_version: | |
| 231 | + recorded_at: Thu, 20 Mar 2014 15:20:19 GMT | |
| 232 | +- request: | |
| 233 | + method: get | |
| 234 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/6/choices.xml?inactive_ignore_flagged=true | |
| 235 | + body: | |
| 236 | + string: "" | |
| 237 | + headers: | |
| 238 | + Accept: | |
| 239 | + - application/xml | |
| 240 | + response: | |
| 241 | + status: | |
| 242 | + code: 200 | |
| 243 | + message: "OK " | |
| 244 | + headers: | |
| 245 | + Content-Length: | |
| 246 | + - "67" | |
| 247 | + Cache-Control: | |
| 248 | + - private, max-age=0, must-revalidate | |
| 249 | + Server: | |
| 250 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 251 | + Set-Cookie: | |
| 252 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIjovcXVlc3Rpb25zLzYvY2hvaWNlcy54bWw%2FaW5hY3RpdmVfaWdub3JlX2ZsYWdnZWQ9dHJ1ZToPc2Vzc2lvbl9pZCIlMmU3ZTM1MWYwZWE1NzJiZDlmODVhYWY3ZmIzNmFmZjA%3D--242ddcf0222a1c1d36ca7f34e77ccf541b9cea1c; path=/; HttpOnly | |
| 253 | + Date: | |
| 254 | + - Thu, 20 Mar 2014 15:20:19 GMT | |
| 255 | + Content-Type: | |
| 256 | + - application/xml; charset=utf-8 | |
| 257 | + X-Runtime: | |
| 258 | + - "28" | |
| 259 | + Connection: | |
| 260 | + - Keep-Alive | |
| 261 | + Etag: | |
| 262 | + - "\"4f31ca96db448bb738a3923db737871d\"" | |
| 263 | + body: | |
| 264 | + string: | | |
| 265 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 266 | + <nil-classes type="array"/> | |
| 267 | + | |
| 268 | + http_version: | |
| 269 | + recorded_at: Thu, 20 Mar 2014 15:20:19 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_add_new_choice.yml
0 → 100644
| ... | ... | @@ -0,0 +1,62 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: get | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 7 | + body: | |
| 8 | + string: "" | |
| 9 | + headers: | |
| 10 | + Accept: | |
| 11 | + - application/xml | |
| 12 | + response: | |
| 13 | + status: | |
| 14 | + code: 200 | |
| 15 | + message: "OK " | |
| 16 | + headers: | |
| 17 | + Server: | |
| 18 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 19 | + Content-Length: | |
| 20 | + - "773" | |
| 21 | + Set-Cookie: | |
| 22 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIh0vcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw6D3Nlc3Npb25faWQiJTcwNTViODljNzY0YWYyNTdiOTlmMDJmMTVkMzU3ZDQy--e1ef0b40ed34d06aab2f0770d9f7b2103758934f; path=/; HttpOnly | |
| 23 | + Content-Type: | |
| 24 | + - application/xml; charset=utf-8 | |
| 25 | + Cache-Control: | |
| 26 | + - private, max-age=0, must-revalidate | |
| 27 | + Connection: | |
| 28 | + - Keep-Alive | |
| 29 | + X-Runtime: | |
| 30 | + - "34" | |
| 31 | + Etag: | |
| 32 | + - "\"0813255a93cff945e3f3ce1f6f128460\"" | |
| 33 | + Date: | |
| 34 | + - Tue, 18 Mar 2014 13:53:23 GMT | |
| 35 | + body: | |
| 36 | + string: | | |
| 37 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 38 | + <choices type="array"> | |
| 39 | + <choice> | |
| 40 | + <active type="boolean">true</active> | |
| 41 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 42 | + <data>Choice 1</data> | |
| 43 | + <id type="integer">11</id> | |
| 44 | + <losses type="integer">0</losses> | |
| 45 | + <score type="float">50.0</score> | |
| 46 | + <wins type="integer">0</wins> | |
| 47 | + <user-created type="boolean">false</user-created> | |
| 48 | + </choice> | |
| 49 | + <choice> | |
| 50 | + <active type="boolean">true</active> | |
| 51 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 52 | + <data>Choice 2</data> | |
| 53 | + <id type="integer">12</id> | |
| 54 | + <losses type="integer">0</losses> | |
| 55 | + <score type="float">50.0</score> | |
| 56 | + <wins type="integer">0</wins> | |
| 57 | + <user-created type="boolean">false</user-created> | |
| 58 | + </choice> | |
| 59 | + </choices> | |
| 60 | + | |
| 61 | + http_version: | |
| 62 | + recorded_at: Tue, 18 Mar 2014 13:53:23 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_approve_choice.yml
0 → 100644
| ... | ... | @@ -0,0 +1,644 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: put | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml | |
| 7 | + body: | |
| 8 | + string: | | |
| 9 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 10 | + <question> | |
| 11 | + <prompts-count type="integer">0</prompts-count> | |
| 12 | + <updated-at type="datetime">2014-03-18T13:53:23Z</updated-at> | |
| 13 | + <active type="boolean">true</active> | |
| 14 | + <votes-count type="integer">0</votes-count> | |
| 15 | + <version type="integer">1</version> | |
| 16 | + <it-should-autoactivate-ideas type="boolean">false</it-should-autoactivate-ideas> | |
| 17 | + <information nil="true"></information> | |
| 18 | + <id type="integer">3</id> | |
| 19 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 20 | + <creator-id type="integer">4</creator-id> | |
| 21 | + <tracking nil="true"></tracking> | |
| 22 | + <choices-count type="integer">0</choices-count> | |
| 23 | + <site-id type="integer">1</site-id> | |
| 24 | + <name>Q1</name> | |
| 25 | + <show-results type="boolean">true</show-results> | |
| 26 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 27 | + <local-identifier>1</local-identifier> | |
| 28 | + <visitor-identifier>1</visitor-identifier> | |
| 29 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 30 | + <ideas>Choice 1 | |
| 31 | + Choice 2</ideas> | |
| 32 | + </question> | |
| 33 | + | |
| 34 | + headers: | |
| 35 | + Accept: | |
| 36 | + - "*/*" | |
| 37 | + Content-Type: | |
| 38 | + - application/xml | |
| 39 | + response: | |
| 40 | + status: | |
| 41 | + code: 200 | |
| 42 | + message: "OK " | |
| 43 | + headers: | |
| 44 | + Server: | |
| 45 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 46 | + Content-Length: | |
| 47 | + - "1" | |
| 48 | + Set-Cookie: | |
| 49 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlMTZhMGI4N2M2NjI3ZjBkMTEwYjMxMjkxZmQwMGU5NTk%3D--918486552d2ddd85974c072ed27052e6361cf5bf; path=/; HttpOnly | |
| 50 | + Content-Type: | |
| 51 | + - application/xml; charset=utf-8 | |
| 52 | + Cache-Control: | |
| 53 | + - no-cache | |
| 54 | + Connection: | |
| 55 | + - Keep-Alive | |
| 56 | + X-Runtime: | |
| 57 | + - "42" | |
| 58 | + Date: | |
| 59 | + - Tue, 18 Mar 2014 13:53:23 GMT | |
| 60 | + body: | |
| 61 | + string: " " | |
| 62 | + http_version: | |
| 63 | + recorded_at: Tue, 18 Mar 2014 13:53:23 GMT | |
| 64 | +- request: | |
| 65 | + method: get | |
| 66 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml | |
| 67 | + body: | |
| 68 | + string: "" | |
| 69 | + headers: | |
| 70 | + Accept: | |
| 71 | + - application/xml | |
| 72 | + response: | |
| 73 | + status: | |
| 74 | + code: 200 | |
| 75 | + message: "OK " | |
| 76 | + headers: | |
| 77 | + Server: | |
| 78 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 79 | + Content-Length: | |
| 80 | + - "956" | |
| 81 | + Set-Cookie: | |
| 82 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIhUvcXVlc3Rpb25zLzMueG1sOg9zZXNzaW9uX2lkIiU0NTZjNDRjZjM0MmFjNjNkOThhYzg2NWMyMTNmM2UzMg%3D%3D--09bee603168fd563081f55c581dab952dc5a935b; path=/; HttpOnly | |
| 83 | + Content-Type: | |
| 84 | + - application/xml; charset=utf-8 | |
| 85 | + Cache-Control: | |
| 86 | + - private, max-age=0, must-revalidate | |
| 87 | + Connection: | |
| 88 | + - Keep-Alive | |
| 89 | + X-Runtime: | |
| 90 | + - "87" | |
| 91 | + Etag: | |
| 92 | + - "\"a4aedcf5bbd98d62bb423366ffd4b670\"" | |
| 93 | + Date: | |
| 94 | + - Tue, 18 Mar 2014 13:53:23 GMT | |
| 95 | + body: | |
| 96 | + string: | | |
| 97 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 98 | + <question> | |
| 99 | + <active type="boolean">true</active> | |
| 100 | + <choices-count type="integer">2</choices-count> | |
| 101 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 102 | + <creator-id type="integer">4</creator-id> | |
| 103 | + <id type="integer">3</id> | |
| 104 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 105 | + <information nil="true"></information> | |
| 106 | + <it-should-autoactivate-ideas type="boolean">false</it-should-autoactivate-ideas> | |
| 107 | + <local-identifier>1</local-identifier> | |
| 108 | + <name>Q1</name> | |
| 109 | + <prompts-count type="integer">0</prompts-count> | |
| 110 | + <show-results type="boolean">true</show-results> | |
| 111 | + <site-id type="integer">1</site-id> | |
| 112 | + <tracking nil="true"></tracking> | |
| 113 | + <updated-at type="datetime">2014-03-18T13:53:23Z</updated-at> | |
| 114 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 115 | + <version type="integer">3</version> | |
| 116 | + <votes-count type="integer">0</votes-count> | |
| 117 | + <item-count type="integer">2</item-count> | |
| 118 | + </question> | |
| 119 | + | |
| 120 | + http_version: | |
| 121 | + recorded_at: Tue, 18 Mar 2014 13:53:23 GMT | |
| 122 | +- request: | |
| 123 | + method: post | |
| 124 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 125 | + body: | |
| 126 | + string: | | |
| 127 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 128 | + <choice> | |
| 129 | + <data>New inactive choice</data> | |
| 130 | + <local-identifier>1</local-identifier> | |
| 131 | + <visitor-identifier>1</visitor-identifier> | |
| 132 | + </choice> | |
| 133 | + | |
| 134 | + headers: | |
| 135 | + Accept: | |
| 136 | + - "*/*" | |
| 137 | + Content-Type: | |
| 138 | + - application/xml | |
| 139 | + response: | |
| 140 | + status: | |
| 141 | + code: 201 | |
| 142 | + message: "Created " | |
| 143 | + headers: | |
| 144 | + Server: | |
| 145 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 146 | + Content-Length: | |
| 147 | + - "1049" | |
| 148 | + Location: | |
| 149 | + - http://localhost:3030/questions/3/choices/13 | |
| 150 | + Set-Cookie: | |
| 151 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlNGUzMzg0MmZhNGRjOWU2MmUzNzRmZTgyMWNiMjRlMzI%3D--a743d79d192e7d00d3e6c6eb5569b3f8851fc47c; path=/; HttpOnly | |
| 152 | + Content-Type: | |
| 153 | + - application/xml; charset=utf-8 | |
| 154 | + Cache-Control: | |
| 155 | + - no-cache | |
| 156 | + Connection: | |
| 157 | + - Keep-Alive | |
| 158 | + X-Runtime: | |
| 159 | + - "155" | |
| 160 | + Date: | |
| 161 | + - Tue, 18 Mar 2014 13:53:24 GMT | |
| 162 | + body: | |
| 163 | + string: | | |
| 164 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 165 | + <choice> | |
| 166 | + <active type="boolean">false</active> | |
| 167 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 168 | + <creator-id type="integer">4</creator-id> | |
| 169 | + <data>New inactive choice</data> | |
| 170 | + <id type="integer">13</id> | |
| 171 | + <item-id type="integer" nil="true"></item-id> | |
| 172 | + <local-identifier>1</local-identifier> | |
| 173 | + <losses type="integer">0</losses> | |
| 174 | + <position type="integer" nil="true"></position> | |
| 175 | + <prompt-id type="integer" nil="true"></prompt-id> | |
| 176 | + <prompts-count type="integer">0</prompts-count> | |
| 177 | + <prompts-on-the-left-count type="integer">0</prompts-on-the-left-count> | |
| 178 | + <prompts-on-the-right-count type="integer">0</prompts-on-the-right-count> | |
| 179 | + <question-id type="integer">3</question-id> | |
| 180 | + <ratings type="integer" nil="true"></ratings> | |
| 181 | + <request-id type="integer" nil="true"></request-id> | |
| 182 | + <score type="float">50.0</score> | |
| 183 | + <tracking nil="true"></tracking> | |
| 184 | + <updated-at type="datetime">2014-03-18T13:53:24Z</updated-at> | |
| 185 | + <version type="integer">1</version> | |
| 186 | + <wins type="integer">0</wins> | |
| 187 | + </choice> | |
| 188 | + | |
| 189 | + http_version: | |
| 190 | + recorded_at: Tue, 18 Mar 2014 13:53:24 GMT | |
| 191 | +- request: | |
| 192 | + method: get | |
| 193 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml?include_inactive=true | |
| 194 | + body: | |
| 195 | + string: "" | |
| 196 | + headers: | |
| 197 | + Accept: | |
| 198 | + - application/xml | |
| 199 | + response: | |
| 200 | + status: | |
| 201 | + code: 200 | |
| 202 | + message: "OK " | |
| 203 | + headers: | |
| 204 | + Server: | |
| 205 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 206 | + Content-Length: | |
| 207 | + - "1135" | |
| 208 | + Set-Cookie: | |
| 209 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIjMvcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw%2FaW5jbHVkZV9pbmFjdGl2ZT10cnVlOg9zZXNzaW9uX2lkIiVmYTJiN2JlNTk4OTg1ZGQzYzA2ZmNmMTdjZmRhY2EyYg%3D%3D--105dc6ae0881fbbd34864a93aff4adfe4e885b3c; path=/; HttpOnly | |
| 210 | + Content-Type: | |
| 211 | + - application/xml; charset=utf-8 | |
| 212 | + Cache-Control: | |
| 213 | + - private, max-age=0, must-revalidate | |
| 214 | + Connection: | |
| 215 | + - Keep-Alive | |
| 216 | + X-Runtime: | |
| 217 | + - "39" | |
| 218 | + Etag: | |
| 219 | + - "\"d84f7f32e1b78fb781400017b6c29802\"" | |
| 220 | + Date: | |
| 221 | + - Tue, 18 Mar 2014 13:53:24 GMT | |
| 222 | + body: | |
| 223 | + string: | | |
| 224 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 225 | + <choices type="array"> | |
| 226 | + <choice> | |
| 227 | + <active type="boolean">true</active> | |
| 228 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 229 | + <data>Choice 1</data> | |
| 230 | + <id type="integer">11</id> | |
| 231 | + <losses type="integer">0</losses> | |
| 232 | + <score type="float">50.0</score> | |
| 233 | + <wins type="integer">0</wins> | |
| 234 | + <user-created type="boolean">false</user-created> | |
| 235 | + </choice> | |
| 236 | + <choice> | |
| 237 | + <active type="boolean">true</active> | |
| 238 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 239 | + <data>Choice 2</data> | |
| 240 | + <id type="integer">12</id> | |
| 241 | + <losses type="integer">0</losses> | |
| 242 | + <score type="float">50.0</score> | |
| 243 | + <wins type="integer">0</wins> | |
| 244 | + <user-created type="boolean">false</user-created> | |
| 245 | + </choice> | |
| 246 | + <choice> | |
| 247 | + <active type="boolean">false</active> | |
| 248 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 249 | + <data>New inactive choice</data> | |
| 250 | + <id type="integer">13</id> | |
| 251 | + <losses type="integer">0</losses> | |
| 252 | + <score type="float">50.0</score> | |
| 253 | + <wins type="integer">0</wins> | |
| 254 | + <user-created type="boolean">false</user-created> | |
| 255 | + </choice> | |
| 256 | + </choices> | |
| 257 | + | |
| 258 | + http_version: | |
| 259 | + recorded_at: Tue, 18 Mar 2014 13:53:24 GMT | |
| 260 | +- request: | |
| 261 | + method: get | |
| 262 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 263 | + body: | |
| 264 | + string: "" | |
| 265 | + headers: | |
| 266 | + Accept: | |
| 267 | + - application/xml | |
| 268 | + response: | |
| 269 | + status: | |
| 270 | + code: 200 | |
| 271 | + message: "OK " | |
| 272 | + headers: | |
| 273 | + Server: | |
| 274 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 275 | + Content-Length: | |
| 276 | + - "773" | |
| 277 | + Set-Cookie: | |
| 278 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIh0vcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw6D3Nlc3Npb25faWQiJWY0OTQ2OWIwZTBkNGFmNDNjNDA5NzE1MWM2NWNmYTFm--c6c11e071bf7549ee9f28eb084c57a545a4c7b6f; path=/; HttpOnly | |
| 279 | + Content-Type: | |
| 280 | + - application/xml; charset=utf-8 | |
| 281 | + Cache-Control: | |
| 282 | + - private, max-age=0, must-revalidate | |
| 283 | + Connection: | |
| 284 | + - Keep-Alive | |
| 285 | + X-Runtime: | |
| 286 | + - "33" | |
| 287 | + Etag: | |
| 288 | + - "\"0813255a93cff945e3f3ce1f6f128460\"" | |
| 289 | + Date: | |
| 290 | + - Tue, 18 Mar 2014 13:53:24 GMT | |
| 291 | + body: | |
| 292 | + string: | | |
| 293 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 294 | + <choices type="array"> | |
| 295 | + <choice> | |
| 296 | + <active type="boolean">true</active> | |
| 297 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 298 | + <data>Choice 1</data> | |
| 299 | + <id type="integer">11</id> | |
| 300 | + <losses type="integer">0</losses> | |
| 301 | + <score type="float">50.0</score> | |
| 302 | + <wins type="integer">0</wins> | |
| 303 | + <user-created type="boolean">false</user-created> | |
| 304 | + </choice> | |
| 305 | + <choice> | |
| 306 | + <active type="boolean">true</active> | |
| 307 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 308 | + <data>Choice 2</data> | |
| 309 | + <id type="integer">12</id> | |
| 310 | + <losses type="integer">0</losses> | |
| 311 | + <score type="float">50.0</score> | |
| 312 | + <wins type="integer">0</wins> | |
| 313 | + <user-created type="boolean">false</user-created> | |
| 314 | + </choice> | |
| 315 | + </choices> | |
| 316 | + | |
| 317 | + http_version: | |
| 318 | + recorded_at: Tue, 18 Mar 2014 13:53:24 GMT | |
| 319 | +- request: | |
| 320 | + method: get | |
| 321 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices/13.xml | |
| 322 | + body: | |
| 323 | + string: "" | |
| 324 | + headers: | |
| 325 | + Accept: | |
| 326 | + - application/xml | |
| 327 | + response: | |
| 328 | + status: | |
| 329 | + code: 200 | |
| 330 | + message: "OK " | |
| 331 | + headers: | |
| 332 | + Server: | |
| 333 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 334 | + Content-Length: | |
| 335 | + - "1049" | |
| 336 | + Set-Cookie: | |
| 337 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIiAvcXVlc3Rpb25zLzMvY2hvaWNlcy8xMy54bWw6D3Nlc3Npb25faWQiJTA1YjZkOTRkMzUyNjQwMmFlYzFhNjRjNjU4MDg2YWE2--114aca8aa089105631e0d908f3d12ad06132588d; path=/; HttpOnly | |
| 338 | + Content-Type: | |
| 339 | + - application/xml; charset=utf-8 | |
| 340 | + Cache-Control: | |
| 341 | + - private, max-age=0, must-revalidate | |
| 342 | + Connection: | |
| 343 | + - Keep-Alive | |
| 344 | + X-Runtime: | |
| 345 | + - "24" | |
| 346 | + Etag: | |
| 347 | + - "\"323b6fd72f7ceb8579523f15601a8fd8\"" | |
| 348 | + Date: | |
| 349 | + - Tue, 18 Mar 2014 13:53:24 GMT | |
| 350 | + body: | |
| 351 | + string: | | |
| 352 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 353 | + <choice> | |
| 354 | + <active type="boolean">false</active> | |
| 355 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 356 | + <creator-id type="integer">4</creator-id> | |
| 357 | + <data>New inactive choice</data> | |
| 358 | + <id type="integer">13</id> | |
| 359 | + <item-id type="integer" nil="true"></item-id> | |
| 360 | + <local-identifier>1</local-identifier> | |
| 361 | + <losses type="integer">0</losses> | |
| 362 | + <position type="integer" nil="true"></position> | |
| 363 | + <prompt-id type="integer" nil="true"></prompt-id> | |
| 364 | + <prompts-count type="integer">0</prompts-count> | |
| 365 | + <prompts-on-the-left-count type="integer">0</prompts-on-the-left-count> | |
| 366 | + <prompts-on-the-right-count type="integer">0</prompts-on-the-right-count> | |
| 367 | + <question-id type="integer">3</question-id> | |
| 368 | + <ratings type="integer" nil="true"></ratings> | |
| 369 | + <request-id type="integer" nil="true"></request-id> | |
| 370 | + <score type="float">50.0</score> | |
| 371 | + <tracking nil="true"></tracking> | |
| 372 | + <updated-at type="datetime">2014-03-18T13:53:24Z</updated-at> | |
| 373 | + <version type="integer">1</version> | |
| 374 | + <wins type="integer">0</wins> | |
| 375 | + </choice> | |
| 376 | + | |
| 377 | + http_version: | |
| 378 | + recorded_at: Tue, 18 Mar 2014 13:53:24 GMT | |
| 379 | +- request: | |
| 380 | + method: put | |
| 381 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices/13.xml | |
| 382 | + body: | |
| 383 | + string: | | |
| 384 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 385 | + <choice> | |
| 386 | + <prompts-count type="integer">0</prompts-count> | |
| 387 | + <updated-at type="datetime">2014-03-18T13:53:24Z</updated-at> | |
| 388 | + <active type="boolean">true</active> | |
| 389 | + <wins type="integer">0</wins> | |
| 390 | + <prompt-id nil="true"></prompt-id> | |
| 391 | + <version type="integer">1</version> | |
| 392 | + <request-id nil="true"></request-id> | |
| 393 | + <position nil="true"></position> | |
| 394 | + <prompts-on-the-right-count type="integer">0</prompts-on-the-right-count> | |
| 395 | + <id type="integer">13</id> | |
| 396 | + <data>New inactive choice</data> | |
| 397 | + <losses type="integer">0</losses> | |
| 398 | + <creator-id type="integer">4</creator-id> | |
| 399 | + <score type="float">50.0</score> | |
| 400 | + <tracking nil="true"></tracking> | |
| 401 | + <ratings nil="true"></ratings> | |
| 402 | + <local-identifier>1</local-identifier> | |
| 403 | + <item-id nil="true"></item-id> | |
| 404 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 405 | + <prompts-on-the-left-count type="integer">0</prompts-on-the-left-count> | |
| 406 | + </choice> | |
| 407 | + | |
| 408 | + headers: | |
| 409 | + Accept: | |
| 410 | + - "*/*" | |
| 411 | + Content-Type: | |
| 412 | + - application/xml | |
| 413 | + response: | |
| 414 | + status: | |
| 415 | + code: 200 | |
| 416 | + message: "OK " | |
| 417 | + headers: | |
| 418 | + Server: | |
| 419 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 420 | + Content-Length: | |
| 421 | + - "1" | |
| 422 | + Set-Cookie: | |
| 423 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlZDk5ZGE3ZWE2NmJiNTJmYWMzMmI5YzY5YmQxM2IyYjg%3D--3358d7c14ea6e9bfc5c2c1b1c0462ebe4e4c4d8b; path=/; HttpOnly | |
| 424 | + Content-Type: | |
| 425 | + - application/xml; charset=utf-8 | |
| 426 | + Cache-Control: | |
| 427 | + - no-cache | |
| 428 | + Connection: | |
| 429 | + - Keep-Alive | |
| 430 | + X-Runtime: | |
| 431 | + - "140" | |
| 432 | + Date: | |
| 433 | + - Tue, 18 Mar 2014 13:53:25 GMT | |
| 434 | + body: | |
| 435 | + string: " " | |
| 436 | + http_version: | |
| 437 | + recorded_at: Tue, 18 Mar 2014 13:53:25 GMT | |
| 438 | +- request: | |
| 439 | + method: get | |
| 440 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml?include_inactive=true | |
| 441 | + body: | |
| 442 | + string: "" | |
| 443 | + headers: | |
| 444 | + Accept: | |
| 445 | + - application/xml | |
| 446 | + response: | |
| 447 | + status: | |
| 448 | + code: 200 | |
| 449 | + message: "OK " | |
| 450 | + headers: | |
| 451 | + Server: | |
| 452 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 453 | + Content-Length: | |
| 454 | + - "1134" | |
| 455 | + Set-Cookie: | |
| 456 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIjMvcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw%2FaW5jbHVkZV9pbmFjdGl2ZT10cnVlOg9zZXNzaW9uX2lkIiU0ZTEwOGMwNDljYWQwZTc2MmU1NTM5OWI3NzM4M2FkZg%3D%3D--fbc1753c1d7065794142c62c81041089e63b306f; path=/; HttpOnly | |
| 457 | + Content-Type: | |
| 458 | + - application/xml; charset=utf-8 | |
| 459 | + Cache-Control: | |
| 460 | + - private, max-age=0, must-revalidate | |
| 461 | + Connection: | |
| 462 | + - Keep-Alive | |
| 463 | + X-Runtime: | |
| 464 | + - "38" | |
| 465 | + Etag: | |
| 466 | + - "\"3d3cc6bfd093918ac1b1b8c8e465efa7\"" | |
| 467 | + Date: | |
| 468 | + - Tue, 18 Mar 2014 13:53:25 GMT | |
| 469 | + body: | |
| 470 | + string: | | |
| 471 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 472 | + <choices type="array"> | |
| 473 | + <choice> | |
| 474 | + <active type="boolean">true</active> | |
| 475 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 476 | + <data>Choice 1</data> | |
| 477 | + <id type="integer">11</id> | |
| 478 | + <losses type="integer">0</losses> | |
| 479 | + <score type="float">50.0</score> | |
| 480 | + <wins type="integer">0</wins> | |
| 481 | + <user-created type="boolean">false</user-created> | |
| 482 | + </choice> | |
| 483 | + <choice> | |
| 484 | + <active type="boolean">true</active> | |
| 485 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 486 | + <data>Choice 2</data> | |
| 487 | + <id type="integer">12</id> | |
| 488 | + <losses type="integer">0</losses> | |
| 489 | + <score type="float">50.0</score> | |
| 490 | + <wins type="integer">0</wins> | |
| 491 | + <user-created type="boolean">false</user-created> | |
| 492 | + </choice> | |
| 493 | + <choice> | |
| 494 | + <active type="boolean">true</active> | |
| 495 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 496 | + <data>New inactive choice</data> | |
| 497 | + <id type="integer">13</id> | |
| 498 | + <losses type="integer">0</losses> | |
| 499 | + <score type="float">50.0</score> | |
| 500 | + <wins type="integer">0</wins> | |
| 501 | + <user-created type="boolean">false</user-created> | |
| 502 | + </choice> | |
| 503 | + </choices> | |
| 504 | + | |
| 505 | + http_version: | |
| 506 | + recorded_at: Tue, 18 Mar 2014 13:53:25 GMT | |
| 507 | +- request: | |
| 508 | + method: get | |
| 509 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 510 | + body: | |
| 511 | + string: "" | |
| 512 | + headers: | |
| 513 | + Accept: | |
| 514 | + - application/xml | |
| 515 | + response: | |
| 516 | + status: | |
| 517 | + code: 200 | |
| 518 | + message: "OK " | |
| 519 | + headers: | |
| 520 | + Server: | |
| 521 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 522 | + Content-Length: | |
| 523 | + - "1134" | |
| 524 | + Set-Cookie: | |
| 525 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIh0vcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw6D3Nlc3Npb25faWQiJWMzMmI0ODZiY2FiOGQ5ZTRiOTFlMThkMGIwNWEwZDU1--c17c6f4b6f52d774507c14c7869114329cc4a822; path=/; HttpOnly | |
| 526 | + Content-Type: | |
| 527 | + - application/xml; charset=utf-8 | |
| 528 | + Cache-Control: | |
| 529 | + - private, max-age=0, must-revalidate | |
| 530 | + Connection: | |
| 531 | + - Keep-Alive | |
| 532 | + X-Runtime: | |
| 533 | + - "41" | |
| 534 | + Etag: | |
| 535 | + - "\"3d3cc6bfd093918ac1b1b8c8e465efa7\"" | |
| 536 | + Date: | |
| 537 | + - Tue, 18 Mar 2014 13:53:25 GMT | |
| 538 | + body: | |
| 539 | + string: | | |
| 540 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 541 | + <choices type="array"> | |
| 542 | + <choice> | |
| 543 | + <active type="boolean">true</active> | |
| 544 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 545 | + <data>Choice 1</data> | |
| 546 | + <id type="integer">11</id> | |
| 547 | + <losses type="integer">0</losses> | |
| 548 | + <score type="float">50.0</score> | |
| 549 | + <wins type="integer">0</wins> | |
| 550 | + <user-created type="boolean">false</user-created> | |
| 551 | + </choice> | |
| 552 | + <choice> | |
| 553 | + <active type="boolean">true</active> | |
| 554 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 555 | + <data>Choice 2</data> | |
| 556 | + <id type="integer">12</id> | |
| 557 | + <losses type="integer">0</losses> | |
| 558 | + <score type="float">50.0</score> | |
| 559 | + <wins type="integer">0</wins> | |
| 560 | + <user-created type="boolean">false</user-created> | |
| 561 | + </choice> | |
| 562 | + <choice> | |
| 563 | + <active type="boolean">true</active> | |
| 564 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 565 | + <data>New inactive choice</data> | |
| 566 | + <id type="integer">13</id> | |
| 567 | + <losses type="integer">0</losses> | |
| 568 | + <score type="float">50.0</score> | |
| 569 | + <wins type="integer">0</wins> | |
| 570 | + <user-created type="boolean">false</user-created> | |
| 571 | + </choice> | |
| 572 | + </choices> | |
| 573 | + | |
| 574 | + http_version: | |
| 575 | + recorded_at: Tue, 18 Mar 2014 13:53:25 GMT | |
| 576 | +- request: | |
| 577 | + method: get | |
| 578 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 579 | + body: | |
| 580 | + string: "" | |
| 581 | + headers: | |
| 582 | + Accept: | |
| 583 | + - application/xml | |
| 584 | + response: | |
| 585 | + status: | |
| 586 | + code: 200 | |
| 587 | + message: "OK " | |
| 588 | + headers: | |
| 589 | + Server: | |
| 590 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 591 | + Content-Length: | |
| 592 | + - "1134" | |
| 593 | + Set-Cookie: | |
| 594 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIh0vcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw6D3Nlc3Npb25faWQiJTUwNGEzNDgxMTI4NThmZTUzM2JlY2ZjZjZlNDQxYzVl--10cef7014de7c9b7a84b3226a696b7ff62f9631a; path=/; HttpOnly | |
| 595 | + Content-Type: | |
| 596 | + - application/xml; charset=utf-8 | |
| 597 | + Cache-Control: | |
| 598 | + - private, max-age=0, must-revalidate | |
| 599 | + Connection: | |
| 600 | + - Keep-Alive | |
| 601 | + X-Runtime: | |
| 602 | + - "45" | |
| 603 | + Etag: | |
| 604 | + - "\"3d3cc6bfd093918ac1b1b8c8e465efa7\"" | |
| 605 | + Date: | |
| 606 | + - Tue, 18 Mar 2014 13:53:25 GMT | |
| 607 | + body: | |
| 608 | + string: | | |
| 609 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 610 | + <choices type="array"> | |
| 611 | + <choice> | |
| 612 | + <active type="boolean">true</active> | |
| 613 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 614 | + <data>Choice 1</data> | |
| 615 | + <id type="integer">11</id> | |
| 616 | + <losses type="integer">0</losses> | |
| 617 | + <score type="float">50.0</score> | |
| 618 | + <wins type="integer">0</wins> | |
| 619 | + <user-created type="boolean">false</user-created> | |
| 620 | + </choice> | |
| 621 | + <choice> | |
| 622 | + <active type="boolean">true</active> | |
| 623 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 624 | + <data>Choice 2</data> | |
| 625 | + <id type="integer">12</id> | |
| 626 | + <losses type="integer">0</losses> | |
| 627 | + <score type="float">50.0</score> | |
| 628 | + <wins type="integer">0</wins> | |
| 629 | + <user-created type="boolean">false</user-created> | |
| 630 | + </choice> | |
| 631 | + <choice> | |
| 632 | + <active type="boolean">true</active> | |
| 633 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 634 | + <data>New inactive choice</data> | |
| 635 | + <id type="integer">13</id> | |
| 636 | + <losses type="integer">0</losses> | |
| 637 | + <score type="float">50.0</score> | |
| 638 | + <wins type="integer">0</wins> | |
| 639 | + <user-created type="boolean">false</user-created> | |
| 640 | + </choice> | |
| 641 | + </choices> | |
| 642 | + | |
| 643 | + http_version: | |
| 644 | + recorded_at: Tue, 18 Mar 2014 13:53:25 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_blank_value.yml
0 → 100644
| ... | ... | @@ -0,0 +1,132 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: get | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 7 | + body: | |
| 8 | + string: "" | |
| 9 | + headers: | |
| 10 | + Accept: | |
| 11 | + - application/xml | |
| 12 | + response: | |
| 13 | + status: | |
| 14 | + code: 200 | |
| 15 | + message: "OK " | |
| 16 | + headers: | |
| 17 | + Server: | |
| 18 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 19 | + Content-Length: | |
| 20 | + - "1134" | |
| 21 | + Set-Cookie: | |
| 22 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIh0vcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw6D3Nlc3Npb25faWQiJTcxMmUwYTYyOTE3NGE0OWU3MzhiMjA4MDFmOGJiNDM4--8d93999812fc4be458135b01a42d53e8ff9b58de; path=/; HttpOnly | |
| 23 | + Content-Type: | |
| 24 | + - application/xml; charset=utf-8 | |
| 25 | + Cache-Control: | |
| 26 | + - private, max-age=0, must-revalidate | |
| 27 | + Connection: | |
| 28 | + - Keep-Alive | |
| 29 | + X-Runtime: | |
| 30 | + - "100" | |
| 31 | + Etag: | |
| 32 | + - "\"3d3cc6bfd093918ac1b1b8c8e465efa7\"" | |
| 33 | + Date: | |
| 34 | + - Tue, 18 Mar 2014 13:53:26 GMT | |
| 35 | + body: | |
| 36 | + string: | | |
| 37 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 38 | + <choices type="array"> | |
| 39 | + <choice> | |
| 40 | + <active type="boolean">true</active> | |
| 41 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 42 | + <data>Choice 1</data> | |
| 43 | + <id type="integer">11</id> | |
| 44 | + <losses type="integer">0</losses> | |
| 45 | + <score type="float">50.0</score> | |
| 46 | + <wins type="integer">0</wins> | |
| 47 | + <user-created type="boolean">false</user-created> | |
| 48 | + </choice> | |
| 49 | + <choice> | |
| 50 | + <active type="boolean">true</active> | |
| 51 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 52 | + <data>Choice 2</data> | |
| 53 | + <id type="integer">12</id> | |
| 54 | + <losses type="integer">0</losses> | |
| 55 | + <score type="float">50.0</score> | |
| 56 | + <wins type="integer">0</wins> | |
| 57 | + <user-created type="boolean">false</user-created> | |
| 58 | + </choice> | |
| 59 | + <choice> | |
| 60 | + <active type="boolean">true</active> | |
| 61 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 62 | + <data>New inactive choice</data> | |
| 63 | + <id type="integer">13</id> | |
| 64 | + <losses type="integer">0</losses> | |
| 65 | + <score type="float">50.0</score> | |
| 66 | + <wins type="integer">0</wins> | |
| 67 | + <user-created type="boolean">false</user-created> | |
| 68 | + </choice> | |
| 69 | + </choices> | |
| 70 | + | |
| 71 | + http_version: | |
| 72 | + recorded_at: Tue, 18 Mar 2014 13:53:26 GMT | |
| 73 | +- request: | |
| 74 | + method: get | |
| 75 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices/11.xml | |
| 76 | + body: | |
| 77 | + string: "" | |
| 78 | + headers: | |
| 79 | + Accept: | |
| 80 | + - application/xml | |
| 81 | + response: | |
| 82 | + status: | |
| 83 | + code: 200 | |
| 84 | + message: "OK " | |
| 85 | + headers: | |
| 86 | + Server: | |
| 87 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 88 | + Content-Length: | |
| 89 | + - "1047" | |
| 90 | + Set-Cookie: | |
| 91 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIiAvcXVlc3Rpb25zLzMvY2hvaWNlcy8xMS54bWw6D3Nlc3Npb25faWQiJTM1NmM3MmJmNTczYzIwYzcyODBjMWFlNDBkNTAxNzlm--2dc46b515e26ca772b36dab15b0359c7317e28ca; path=/; HttpOnly | |
| 92 | + Content-Type: | |
| 93 | + - application/xml; charset=utf-8 | |
| 94 | + Cache-Control: | |
| 95 | + - private, max-age=0, must-revalidate | |
| 96 | + Connection: | |
| 97 | + - Keep-Alive | |
| 98 | + X-Runtime: | |
| 99 | + - "25" | |
| 100 | + Etag: | |
| 101 | + - "\"05b426e3208a00fc0be6d435b75cc361\"" | |
| 102 | + Date: | |
| 103 | + - Tue, 18 Mar 2014 13:53:26 GMT | |
| 104 | + body: | |
| 105 | + string: | | |
| 106 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 107 | + <choice> | |
| 108 | + <active type="boolean">true</active> | |
| 109 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 110 | + <creator-id type="integer">4</creator-id> | |
| 111 | + <data>Choice 1</data> | |
| 112 | + <id type="integer">11</id> | |
| 113 | + <item-id type="integer" nil="true"></item-id> | |
| 114 | + <local-identifier nil="true"></local-identifier> | |
| 115 | + <losses type="integer">0</losses> | |
| 116 | + <position type="integer" nil="true"></position> | |
| 117 | + <prompt-id type="integer" nil="true"></prompt-id> | |
| 118 | + <prompts-count type="integer">0</prompts-count> | |
| 119 | + <prompts-on-the-left-count type="integer">0</prompts-on-the-left-count> | |
| 120 | + <prompts-on-the-right-count type="integer">0</prompts-on-the-right-count> | |
| 121 | + <question-id type="integer">3</question-id> | |
| 122 | + <ratings type="integer" nil="true"></ratings> | |
| 123 | + <request-id type="integer" nil="true"></request-id> | |
| 124 | + <score type="float">50.0</score> | |
| 125 | + <tracking nil="true"></tracking> | |
| 126 | + <updated-at type="datetime">2014-03-18T13:53:23Z</updated-at> | |
| 127 | + <version type="integer">1</version> | |
| 128 | + <wins type="integer">0</wins> | |
| 129 | + </choice> | |
| 130 | + | |
| 131 | + http_version: | |
| 132 | + recorded_at: Tue, 18 Mar 2014 13:53:26 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_create_question.yml
0 → 100644
| ... | ... | @@ -0,0 +1,131 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: post | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions.xml | |
| 7 | + body: | |
| 8 | + string: | | |
| 9 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 10 | + <question> | |
| 11 | + <name>Q1</name> | |
| 12 | + <local-identifier>1</local-identifier> | |
| 13 | + <visitor-identifier>1</visitor-identifier> | |
| 14 | + <ideas>Choice 1 | |
| 15 | + Choice 2</ideas> | |
| 16 | + </question> | |
| 17 | + | |
| 18 | + headers: | |
| 19 | + Accept: | |
| 20 | + - "*/*" | |
| 21 | + Content-Type: | |
| 22 | + - application/xml | |
| 23 | + response: | |
| 24 | + status: | |
| 25 | + code: 200 | |
| 26 | + message: "OK " | |
| 27 | + headers: | |
| 28 | + Server: | |
| 29 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 30 | + Content-Length: | |
| 31 | + - "913" | |
| 32 | + Set-Cookie: | |
| 33 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlY2RiMDVkZWU4YjMyZDgzYWY0MzMxMDM3ODFkNzdkMzk%3D--b37e44bec446d3860dc1bf888a36e36e940cb2e0; path=/; HttpOnly | |
| 34 | + Content-Type: | |
| 35 | + - application/xml; charset=utf-8 | |
| 36 | + Cache-Control: | |
| 37 | + - private, max-age=0, must-revalidate | |
| 38 | + Connection: | |
| 39 | + - Keep-Alive | |
| 40 | + X-Runtime: | |
| 41 | + - "175" | |
| 42 | + Etag: | |
| 43 | + - "\"59680dc7fa311f91dd47e51a799904d8\"" | |
| 44 | + Date: | |
| 45 | + - Tue, 18 Mar 2014 13:53:23 GMT | |
| 46 | + body: | |
| 47 | + string: | | |
| 48 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 49 | + <question> | |
| 50 | + <active type="boolean">false</active> | |
| 51 | + <choices-count type="integer">0</choices-count> | |
| 52 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 53 | + <creator-id type="integer">4</creator-id> | |
| 54 | + <id type="integer">3</id> | |
| 55 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 56 | + <information nil="true"></information> | |
| 57 | + <it-should-autoactivate-ideas type="boolean">false</it-should-autoactivate-ideas> | |
| 58 | + <local-identifier>1</local-identifier> | |
| 59 | + <name>Q1</name> | |
| 60 | + <prompts-count type="integer">0</prompts-count> | |
| 61 | + <show-results type="boolean">true</show-results> | |
| 62 | + <site-id type="integer">1</site-id> | |
| 63 | + <tracking nil="true"></tracking> | |
| 64 | + <updated-at type="datetime">2014-03-18T13:53:23Z</updated-at> | |
| 65 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 66 | + <version type="integer">1</version> | |
| 67 | + <votes-count type="integer">0</votes-count> | |
| 68 | + </question> | |
| 69 | + | |
| 70 | + http_version: | |
| 71 | + recorded_at: Tue, 18 Mar 2014 13:53:23 GMT | |
| 72 | +- request: | |
| 73 | + method: put | |
| 74 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml | |
| 75 | + body: | |
| 76 | + string: | | |
| 77 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 78 | + <question> | |
| 79 | + <prompts-count type="integer">0</prompts-count> | |
| 80 | + <updated-at type="datetime">2014-03-18T13:53:23Z</updated-at> | |
| 81 | + <active type="boolean">true</active> | |
| 82 | + <votes-count type="integer">0</votes-count> | |
| 83 | + <version type="integer">1</version> | |
| 84 | + <it-should-autoactivate-ideas type="boolean">true</it-should-autoactivate-ideas> | |
| 85 | + <information nil="true"></information> | |
| 86 | + <id type="integer">3</id> | |
| 87 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 88 | + <creator-id type="integer">4</creator-id> | |
| 89 | + <tracking nil="true"></tracking> | |
| 90 | + <choices-count type="integer">0</choices-count> | |
| 91 | + <site-id type="integer">1</site-id> | |
| 92 | + <name>Q1</name> | |
| 93 | + <show-results type="boolean">true</show-results> | |
| 94 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 95 | + <local-identifier>1</local-identifier> | |
| 96 | + <visitor-identifier>1</visitor-identifier> | |
| 97 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 98 | + <ideas>Choice 1 | |
| 99 | + Choice 2</ideas> | |
| 100 | + </question> | |
| 101 | + | |
| 102 | + headers: | |
| 103 | + Accept: | |
| 104 | + - "*/*" | |
| 105 | + Content-Type: | |
| 106 | + - application/xml | |
| 107 | + response: | |
| 108 | + status: | |
| 109 | + code: 200 | |
| 110 | + message: "OK " | |
| 111 | + headers: | |
| 112 | + Server: | |
| 113 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 114 | + Content-Length: | |
| 115 | + - "1" | |
| 116 | + Set-Cookie: | |
| 117 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlNzQ0Mjc3YzFhNzdlOTI2MDMyNzdiMTMxYjc5MzdiM2M%3D--84b0fbf2d2803c8fbe89ac4571d99fca0a2293ab; path=/; HttpOnly | |
| 118 | + Content-Type: | |
| 119 | + - application/xml; charset=utf-8 | |
| 120 | + Cache-Control: | |
| 121 | + - no-cache | |
| 122 | + Connection: | |
| 123 | + - Keep-Alive | |
| 124 | + X-Runtime: | |
| 125 | + - "43" | |
| 126 | + Date: | |
| 127 | + - Tue, 18 Mar 2014 13:53:23 GMT | |
| 128 | + body: | |
| 129 | + string: " " | |
| 130 | + http_version: | |
| 131 | + recorded_at: Tue, 18 Mar 2014 13:53:23 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_create_question_dynamic.yml
0 → 100644
| ... | ... | @@ -0,0 +1,129 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: post | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions.xml | |
| 7 | + body: | |
| 8 | + string: | | |
| 9 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 10 | + <question> | |
| 11 | + <visitor-identifier>1</visitor-identifier> | |
| 12 | + <name><%= question_name %></name> | |
| 13 | + <local-identifier>1</local-identifier> | |
| 14 | + <ideas><%= choices %></ideas> | |
| 15 | + </question> | |
| 16 | + | |
| 17 | + headers: | |
| 18 | + Accept: | |
| 19 | + - "*/*" | |
| 20 | + Content-Type: | |
| 21 | + - application/xml | |
| 22 | + response: | |
| 23 | + status: | |
| 24 | + code: 200 | |
| 25 | + message: "OK " | |
| 26 | + headers: | |
| 27 | + Connection: | |
| 28 | + - Keep-Alive | |
| 29 | + Server: | |
| 30 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 31 | + Content-Length: | |
| 32 | + - "915" | |
| 33 | + Content-Type: | |
| 34 | + - application/xml; charset=utf-8 | |
| 35 | + X-Runtime: | |
| 36 | + - "173" | |
| 37 | + Set-Cookie: | |
| 38 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlNDMxNTYxNzdlODhiMjk2ZjI1YTMyNjNhMTIxOTMwOGE%3D--0bbc7b694ddc26c1c225eb50ac18b2232d294100; path=/; HttpOnly | |
| 39 | + Etag: | |
| 40 | + - "\"78556b001eadd8e658d5219148956316\"" | |
| 41 | + Cache-Control: | |
| 42 | + - private, max-age=0, must-revalidate | |
| 43 | + Date: | |
| 44 | + - Tue, 25 Feb 2014 14:16:26 GMT | |
| 45 | + body: | |
| 46 | + string: | | |
| 47 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 48 | + <question> | |
| 49 | + <active type="boolean">false</active> | |
| 50 | + <choices-count type="integer">0</choices-count> | |
| 51 | + <created-at type="datetime">2014-02-25T14:16:26Z</created-at> | |
| 52 | + <creator-id type="integer">8</creator-id> | |
| 53 | + <id type="integer"><%= id_question %></id> | |
| 54 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 55 | + <information nil="true"></information> | |
| 56 | + <it-should-autoactivate-ideas type="boolean">false</it-should-autoactivate-ideas> | |
| 57 | + <local-identifier>1</local-identifier> | |
| 58 | + <name><%= question_name %></name> | |
| 59 | + <prompts-count type="integer">0</prompts-count> | |
| 60 | + <show-results type="boolean">true</show-results> | |
| 61 | + <site-id type="integer">1</site-id> | |
| 62 | + <tracking nil="true"></tracking> | |
| 63 | + <updated-at type="datetime">2014-02-25T14:16:26Z</updated-at> | |
| 64 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 65 | + <version type="integer">1</version> | |
| 66 | + <votes-count type="integer">0</votes-count> | |
| 67 | + </question> | |
| 68 | + | |
| 69 | + http_version: | |
| 70 | + recorded_at: Tue, 25 Feb 2014 14:16:26 GMT | |
| 71 | +- request: | |
| 72 | + method: put | |
| 73 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/<%=id_question%>.xml | |
| 74 | + body: | |
| 75 | + string: | | |
| 76 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 77 | + <question> | |
| 78 | + <active type="boolean">true</active> | |
| 79 | + <prompts-count type="integer">0</prompts-count> | |
| 80 | + <version type="integer">1</version> | |
| 81 | + <site-id type="integer">1</site-id> | |
| 82 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 83 | + <it-should-autoactivate-ideas type="boolean">true</it-should-autoactivate-ideas> | |
| 84 | + <information nil="true"></information> | |
| 85 | + <choices-count type="integer">0</choices-count> | |
| 86 | + <creator-id type="integer">8</creator-id> | |
| 87 | + <tracking nil="true"></tracking> | |
| 88 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 89 | + <votes-count type="integer">0</votes-count> | |
| 90 | + <id type="integer"><%= id_question %></id> | |
| 91 | + <visitor-identifier>1</visitor-identifier> | |
| 92 | + <name><%= question_name %></name> | |
| 93 | + <local-identifier>1</local-identifier> | |
| 94 | + <updated-at type="datetime">2014-02-25T14:16:26Z</updated-at> | |
| 95 | + <show-results type="boolean">true</show-results> | |
| 96 | + <ideas><%= choices %></ideas> | |
| 97 | + <created-at type="datetime">2014-02-25T14:16:26Z</created-at> | |
| 98 | + </question> | |
| 99 | + | |
| 100 | + headers: | |
| 101 | + Accept: | |
| 102 | + - "*/*" | |
| 103 | + Content-Type: | |
| 104 | + - application/xml | |
| 105 | + response: | |
| 106 | + status: | |
| 107 | + code: 200 | |
| 108 | + message: "OK " | |
| 109 | + headers: | |
| 110 | + Connection: | |
| 111 | + - Keep-Alive | |
| 112 | + Server: | |
| 113 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 114 | + Content-Length: | |
| 115 | + - "1" | |
| 116 | + Content-Type: | |
| 117 | + - application/xml; charset=utf-8 | |
| 118 | + X-Runtime: | |
| 119 | + - "57" | |
| 120 | + Set-Cookie: | |
| 121 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlMjk3YzEwMDk0MzIwZmRiYWQwNDc3OTk4OTRkYWU1MTY%3D--f33badfd5f25126de46a042621203f8a3fb8df5b; path=/; HttpOnly | |
| 122 | + Cache-Control: | |
| 123 | + - no-cache | |
| 124 | + Date: | |
| 125 | + - Tue, 25 Feb 2014 14:16:26 GMT | |
| 126 | + body: | |
| 127 | + string: " " | |
| 128 | + http_version: | |
| 129 | + recorded_at: Tue, 25 Feb 2014 14:16:26 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_not_register_votes.yml
0 → 100644
| ... | ... | @@ -0,0 +1,221 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: get | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml?creator_id=1&visitor_identifier=guest&with_appearance=true&with_prompt=true | |
| 7 | + body: | |
| 8 | + string: "" | |
| 9 | + headers: | |
| 10 | + Accept: | |
| 11 | + - application/xml | |
| 12 | + response: | |
| 13 | + status: | |
| 14 | + code: 200 | |
| 15 | + message: "OK " | |
| 16 | + headers: | |
| 17 | + Server: | |
| 18 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 19 | + Content-Length: | |
| 20 | + - "1064" | |
| 21 | + Set-Cookie: | |
| 22 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvImEvcXVlc3Rpb25zLzMueG1sP2NyZWF0b3JfaWQ9MSZ2aXNpdG9yX2lkZW50aWZpZXI9Z3Vlc3Qmd2l0aF9hcHBlYXJhbmNlPXRydWUmd2l0aF9wcm9tcHQ9dHJ1ZToPc2Vzc2lvbl9pZCIlY2ZjMmU2MmRlMjkyNDQyMDlmMGNmYzU4NDJkZmU5MDQ%3D--428dd8b3e0c6690f28d07b312de8fbf335eea099; path=/; HttpOnly | |
| 23 | + Content-Type: | |
| 24 | + - application/xml; charset=utf-8 | |
| 25 | + Cache-Control: | |
| 26 | + - private, max-age=0, must-revalidate | |
| 27 | + Connection: | |
| 28 | + - Keep-Alive | |
| 29 | + X-Runtime: | |
| 30 | + - "156" | |
| 31 | + Etag: | |
| 32 | + - "\"317ba026722fb4381c030bcc1fa7f953\"" | |
| 33 | + Date: | |
| 34 | + - Tue, 18 Mar 2014 13:53:26 GMT | |
| 35 | + body: | |
| 36 | + string: | | |
| 37 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 38 | + <question> | |
| 39 | + <active type="boolean">true</active> | |
| 40 | + <choices-count type="integer">3</choices-count> | |
| 41 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 42 | + <creator-id type="integer">4</creator-id> | |
| 43 | + <id type="integer">3</id> | |
| 44 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 45 | + <information nil="true"></information> | |
| 46 | + <it-should-autoactivate-ideas type="boolean">false</it-should-autoactivate-ideas> | |
| 47 | + <local-identifier>1</local-identifier> | |
| 48 | + <name>Q1</name> | |
| 49 | + <prompts-count type="integer">0</prompts-count> | |
| 50 | + <show-results type="boolean">true</show-results> | |
| 51 | + <site-id type="integer">1</site-id> | |
| 52 | + <tracking nil="true"></tracking> | |
| 53 | + <updated-at type="datetime">2014-03-18T13:53:25Z</updated-at> | |
| 54 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 55 | + <version type="integer">5</version> | |
| 56 | + <votes-count type="integer">0</votes-count> | |
| 57 | + <item-count type="integer">3</item-count> | |
| 58 | + <appearance_id>7fb7e9aefb38b3ead7e75c87cbbc2e46</appearance_id> | |
| 59 | + <picked_prompt_id>11</picked_prompt_id> | |
| 60 | + </question> | |
| 61 | + | |
| 62 | + http_version: | |
| 63 | + recorded_at: Tue, 18 Mar 2014 13:53:26 GMT | |
| 64 | +- request: | |
| 65 | + method: get | |
| 66 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/prompts/11.xml | |
| 67 | + body: | |
| 68 | + string: "" | |
| 69 | + headers: | |
| 70 | + Accept: | |
| 71 | + - application/xml | |
| 72 | + response: | |
| 73 | + status: | |
| 74 | + code: 200 | |
| 75 | + message: "OK " | |
| 76 | + headers: | |
| 77 | + Server: | |
| 78 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 79 | + Content-Length: | |
| 80 | + - "559" | |
| 81 | + Set-Cookie: | |
| 82 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIiAvcXVlc3Rpb25zLzMvcHJvbXB0cy8xMS54bWw6D3Nlc3Npb25faWQiJTk2ODk5Njg4MjRhNjNlNzYzMGQwNGFiNDUwZjFmNTE1--25da5da7ea058b396e345f68c3e58dbed76622f5; path=/; HttpOnly | |
| 83 | + Content-Type: | |
| 84 | + - application/xml; charset=utf-8 | |
| 85 | + Cache-Control: | |
| 86 | + - private, max-age=0, must-revalidate | |
| 87 | + Connection: | |
| 88 | + - Keep-Alive | |
| 89 | + X-Runtime: | |
| 90 | + - "39" | |
| 91 | + Etag: | |
| 92 | + - "\"a3c909043cb826bc0f39faabc7471bcd\"" | |
| 93 | + Date: | |
| 94 | + - Tue, 18 Mar 2014 13:53:26 GMT | |
| 95 | + body: | |
| 96 | + string: | | |
| 97 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 98 | + <prompt> | |
| 99 | + <created-at type="datetime">2014-03-18T13:53:26Z</created-at> | |
| 100 | + <id type="integer">11</id> | |
| 101 | + <left-choice-id type="integer">13</left-choice-id> | |
| 102 | + <question-id type="integer">3</question-id> | |
| 103 | + <right-choice-id type="integer">11</right-choice-id> | |
| 104 | + <tracking nil="true"></tracking> | |
| 105 | + <updated-at type="datetime">2014-03-18T13:53:26Z</updated-at> | |
| 106 | + <votes-count type="integer">0</votes-count> | |
| 107 | + <left-choice-text>New inactive choice</left-choice-text> | |
| 108 | + <right-choice-text>Choice 1</right-choice-text> | |
| 109 | + </prompt> | |
| 110 | + | |
| 111 | + http_version: | |
| 112 | + recorded_at: Tue, 18 Mar 2014 13:53:26 GMT | |
| 113 | +- request: | |
| 114 | + method: get | |
| 115 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/prompts/11.xml | |
| 116 | + body: | |
| 117 | + string: "" | |
| 118 | + headers: | |
| 119 | + Accept: | |
| 120 | + - application/xml | |
| 121 | + response: | |
| 122 | + status: | |
| 123 | + code: 200 | |
| 124 | + message: "OK " | |
| 125 | + headers: | |
| 126 | + Server: | |
| 127 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 128 | + Content-Length: | |
| 129 | + - "559" | |
| 130 | + Set-Cookie: | |
| 131 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIiAvcXVlc3Rpb25zLzMvcHJvbXB0cy8xMS54bWw6D3Nlc3Npb25faWQiJThhYWM1YTQzMTczNzRjOGM2MmM2OTZmODZmNjE4ZjVj--93243b55accf34cc2f2f9917e08954e5e601a8d2; path=/; HttpOnly | |
| 132 | + Content-Type: | |
| 133 | + - application/xml; charset=utf-8 | |
| 134 | + Cache-Control: | |
| 135 | + - private, max-age=0, must-revalidate | |
| 136 | + Connection: | |
| 137 | + - Keep-Alive | |
| 138 | + X-Runtime: | |
| 139 | + - "39" | |
| 140 | + Etag: | |
| 141 | + - "\"a3c909043cb826bc0f39faabc7471bcd\"" | |
| 142 | + Date: | |
| 143 | + - Tue, 18 Mar 2014 13:53:26 GMT | |
| 144 | + body: | |
| 145 | + string: | | |
| 146 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 147 | + <prompt> | |
| 148 | + <created-at type="datetime">2014-03-18T13:53:26Z</created-at> | |
| 149 | + <id type="integer">11</id> | |
| 150 | + <left-choice-id type="integer">13</left-choice-id> | |
| 151 | + <question-id type="integer">3</question-id> | |
| 152 | + <right-choice-id type="integer">11</right-choice-id> | |
| 153 | + <tracking nil="true"></tracking> | |
| 154 | + <updated-at type="datetime">2014-03-18T13:53:26Z</updated-at> | |
| 155 | + <votes-count type="integer">0</votes-count> | |
| 156 | + <left-choice-text>New inactive choice</left-choice-text> | |
| 157 | + <right-choice-text>Choice 1</right-choice-text> | |
| 158 | + </prompt> | |
| 159 | + | |
| 160 | + http_version: | |
| 161 | + recorded_at: Tue, 18 Mar 2014 13:53:26 GMT | |
| 162 | +- request: | |
| 163 | + method: post | |
| 164 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/prompts/11/vote.xml?next_prompt%5Bvisitor_identifier%5D=guest-tester&next_prompt%5Bwith_appearance%5D=true&next_prompt%5Bwith_visitor_stats%5D=true&question_id=3&vote%5Bappearance_lookup%5D=&vote%5Bdirection%5D=left&vote%5Bvisitor_identifier%5D=guest-tester | |
| 165 | + body: | |
| 166 | + string: | | |
| 167 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 168 | + <prompt> | |
| 169 | + <updated-at type="datetime">2014-03-18T13:53:26Z</updated-at> | |
| 170 | + <votes-count type="integer">0</votes-count> | |
| 171 | + <id type="integer">11</id> | |
| 172 | + <right-choice-id type="integer">11</right-choice-id> | |
| 173 | + <left-choice-id type="integer">13</left-choice-id> | |
| 174 | + <tracking nil="true"></tracking> | |
| 175 | + <left-choice-text>New inactive choice</left-choice-text> | |
| 176 | + <right-choice-text>Choice 1</right-choice-text> | |
| 177 | + <created-at type="datetime">2014-03-18T13:53:26Z</created-at> | |
| 178 | + </prompt> | |
| 179 | + | |
| 180 | + headers: | |
| 181 | + Accept: | |
| 182 | + - "*/*" | |
| 183 | + Content-Type: | |
| 184 | + - application/xml | |
| 185 | + response: | |
| 186 | + status: | |
| 187 | + code: 422 | |
| 188 | + message: "" | |
| 189 | + headers: | |
| 190 | + Server: | |
| 191 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 192 | + Content-Length: | |
| 193 | + - "450" | |
| 194 | + Set-Cookie: | |
| 195 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlYjIxZjkwY2Q5MDcxMjI2ZThhYmQ2MDljMDIzODViYWY%3D--bc3c89b56744d9adb9f647e3c233c8cbd5ca8cac; path=/; HttpOnly | |
| 196 | + Content-Type: | |
| 197 | + - application/xml; charset=utf-8 | |
| 198 | + Cache-Control: | |
| 199 | + - no-cache | |
| 200 | + Connection: | |
| 201 | + - Keep-Alive | |
| 202 | + X-Runtime: | |
| 203 | + - "149" | |
| 204 | + Date: | |
| 205 | + - Tue, 18 Mar 2014 13:53:27 GMT | |
| 206 | + body: | |
| 207 | + string: | | |
| 208 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 209 | + <prompt> | |
| 210 | + <created-at type="datetime">2014-03-18T13:53:26Z</created-at> | |
| 211 | + <id type="integer">11</id> | |
| 212 | + <left-choice-id type="integer">13</left-choice-id> | |
| 213 | + <question-id type="integer">3</question-id> | |
| 214 | + <right-choice-id type="integer">11</right-choice-id> | |
| 215 | + <tracking nil="true"></tracking> | |
| 216 | + <updated-at type="datetime">2014-03-18T13:53:26Z</updated-at> | |
| 217 | + <votes-count type="integer">0</votes-count> | |
| 218 | + </prompt> | |
| 219 | + | |
| 220 | + http_version: | |
| 221 | + recorded_at: Tue, 18 Mar 2014 13:53:27 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_register_votes.yml
0 → 100644
| ... | ... | @@ -0,0 +1,228 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: get | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml?creator_id=1&visitor_identifier=guest&with_appearance=true&with_prompt=true | |
| 7 | + body: | |
| 8 | + string: "" | |
| 9 | + headers: | |
| 10 | + Accept: | |
| 11 | + - application/xml | |
| 12 | + response: | |
| 13 | + status: | |
| 14 | + code: 200 | |
| 15 | + message: "OK " | |
| 16 | + headers: | |
| 17 | + Server: | |
| 18 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 19 | + Content-Length: | |
| 20 | + - "1064" | |
| 21 | + Set-Cookie: | |
| 22 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvImEvcXVlc3Rpb25zLzMueG1sP2NyZWF0b3JfaWQ9MSZ2aXNpdG9yX2lkZW50aWZpZXI9Z3Vlc3Qmd2l0aF9hcHBlYXJhbmNlPXRydWUmd2l0aF9wcm9tcHQ9dHJ1ZToPc2Vzc2lvbl9pZCIlYWMzZmU3ZDNhYmVkODZmZGYyNTYxYzRjN2RlNjY0YjM%3D--3a4f27f429286fc546a6e938019fa32fdb91b70f; path=/; HttpOnly | |
| 23 | + Content-Type: | |
| 24 | + - application/xml; charset=utf-8 | |
| 25 | + Cache-Control: | |
| 26 | + - private, max-age=0, must-revalidate | |
| 27 | + Connection: | |
| 28 | + - Keep-Alive | |
| 29 | + X-Runtime: | |
| 30 | + - "82" | |
| 31 | + Etag: | |
| 32 | + - "\"7f078ba830c502f3e05c5572f949f4f4\"" | |
| 33 | + Date: | |
| 34 | + - Tue, 18 Mar 2014 13:53:27 GMT | |
| 35 | + body: | |
| 36 | + string: | | |
| 37 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 38 | + <question> | |
| 39 | + <active type="boolean">true</active> | |
| 40 | + <choices-count type="integer">3</choices-count> | |
| 41 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 42 | + <creator-id type="integer">4</creator-id> | |
| 43 | + <id type="integer">3</id> | |
| 44 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 45 | + <information nil="true"></information> | |
| 46 | + <it-should-autoactivate-ideas type="boolean">false</it-should-autoactivate-ideas> | |
| 47 | + <local-identifier>1</local-identifier> | |
| 48 | + <name>Q1</name> | |
| 49 | + <prompts-count type="integer">2</prompts-count> | |
| 50 | + <show-results type="boolean">true</show-results> | |
| 51 | + <site-id type="integer">1</site-id> | |
| 52 | + <tracking nil="true"></tracking> | |
| 53 | + <updated-at type="datetime">2014-03-18T13:53:25Z</updated-at> | |
| 54 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 55 | + <version type="integer">5</version> | |
| 56 | + <votes-count type="integer">0</votes-count> | |
| 57 | + <item-count type="integer">3</item-count> | |
| 58 | + <appearance_id>7fb7e9aefb38b3ead7e75c87cbbc2e46</appearance_id> | |
| 59 | + <picked_prompt_id>11</picked_prompt_id> | |
| 60 | + </question> | |
| 61 | + | |
| 62 | + http_version: | |
| 63 | + recorded_at: Tue, 18 Mar 2014 13:53:27 GMT | |
| 64 | +- request: | |
| 65 | + method: get | |
| 66 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/prompts/11.xml | |
| 67 | + body: | |
| 68 | + string: "" | |
| 69 | + headers: | |
| 70 | + Accept: | |
| 71 | + - application/xml | |
| 72 | + response: | |
| 73 | + status: | |
| 74 | + code: 200 | |
| 75 | + message: "OK " | |
| 76 | + headers: | |
| 77 | + Server: | |
| 78 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 79 | + Content-Length: | |
| 80 | + - "559" | |
| 81 | + Set-Cookie: | |
| 82 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIiAvcXVlc3Rpb25zLzMvcHJvbXB0cy8xMS54bWw6D3Nlc3Npb25faWQiJTc2NWY2ZmE2ZDZkZWZiZmI0YmM4NTI3ZDY2MWY5OTIx--8355c5afeb8191f3d3c86ebe80a4dccfdc44ae59; path=/; HttpOnly | |
| 83 | + Content-Type: | |
| 84 | + - application/xml; charset=utf-8 | |
| 85 | + Cache-Control: | |
| 86 | + - private, max-age=0, must-revalidate | |
| 87 | + Connection: | |
| 88 | + - Keep-Alive | |
| 89 | + X-Runtime: | |
| 90 | + - "50" | |
| 91 | + Etag: | |
| 92 | + - "\"a3c909043cb826bc0f39faabc7471bcd\"" | |
| 93 | + Date: | |
| 94 | + - Tue, 18 Mar 2014 13:53:28 GMT | |
| 95 | + body: | |
| 96 | + string: | | |
| 97 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 98 | + <prompt> | |
| 99 | + <created-at type="datetime">2014-03-18T13:53:26Z</created-at> | |
| 100 | + <id type="integer">11</id> | |
| 101 | + <left-choice-id type="integer">13</left-choice-id> | |
| 102 | + <question-id type="integer">3</question-id> | |
| 103 | + <right-choice-id type="integer">11</right-choice-id> | |
| 104 | + <tracking nil="true"></tracking> | |
| 105 | + <updated-at type="datetime">2014-03-18T13:53:26Z</updated-at> | |
| 106 | + <votes-count type="integer">0</votes-count> | |
| 107 | + <left-choice-text>New inactive choice</left-choice-text> | |
| 108 | + <right-choice-text>Choice 1</right-choice-text> | |
| 109 | + </prompt> | |
| 110 | + | |
| 111 | + http_version: | |
| 112 | + recorded_at: Tue, 18 Mar 2014 13:53:28 GMT | |
| 113 | +- request: | |
| 114 | + method: get | |
| 115 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/prompts/11.xml | |
| 116 | + body: | |
| 117 | + string: "" | |
| 118 | + headers: | |
| 119 | + Accept: | |
| 120 | + - application/xml | |
| 121 | + response: | |
| 122 | + status: | |
| 123 | + code: 200 | |
| 124 | + message: "OK " | |
| 125 | + headers: | |
| 126 | + Server: | |
| 127 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 128 | + Content-Length: | |
| 129 | + - "559" | |
| 130 | + Set-Cookie: | |
| 131 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIiAvcXVlc3Rpb25zLzMvcHJvbXB0cy8xMS54bWw6D3Nlc3Npb25faWQiJWEyMjY5N2ZiZTVhNWUxMDMyZTM2NmU1OTdhM2Y0YmQ2--75d6ab708fef2f4eff3a1e27617bcdc0053dab4b; path=/; HttpOnly | |
| 132 | + Content-Type: | |
| 133 | + - application/xml; charset=utf-8 | |
| 134 | + Cache-Control: | |
| 135 | + - private, max-age=0, must-revalidate | |
| 136 | + Connection: | |
| 137 | + - Keep-Alive | |
| 138 | + X-Runtime: | |
| 139 | + - "108" | |
| 140 | + Etag: | |
| 141 | + - "\"a3c909043cb826bc0f39faabc7471bcd\"" | |
| 142 | + Date: | |
| 143 | + - Tue, 18 Mar 2014 13:53:28 GMT | |
| 144 | + body: | |
| 145 | + string: | | |
| 146 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 147 | + <prompt> | |
| 148 | + <created-at type="datetime">2014-03-18T13:53:26Z</created-at> | |
| 149 | + <id type="integer">11</id> | |
| 150 | + <left-choice-id type="integer">13</left-choice-id> | |
| 151 | + <question-id type="integer">3</question-id> | |
| 152 | + <right-choice-id type="integer">11</right-choice-id> | |
| 153 | + <tracking nil="true"></tracking> | |
| 154 | + <updated-at type="datetime">2014-03-18T13:53:26Z</updated-at> | |
| 155 | + <votes-count type="integer">0</votes-count> | |
| 156 | + <left-choice-text>New inactive choice</left-choice-text> | |
| 157 | + <right-choice-text>Choice 1</right-choice-text> | |
| 158 | + </prompt> | |
| 159 | + | |
| 160 | + http_version: | |
| 161 | + recorded_at: Tue, 18 Mar 2014 13:53:28 GMT | |
| 162 | +- request: | |
| 163 | + method: post | |
| 164 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/prompts/11/vote.xml?next_prompt%5Bvisitor_identifier%5D=guest-tester&next_prompt%5Bwith_appearance%5D=true&next_prompt%5Bwith_visitor_stats%5D=true&question_id=3&vote%5Bappearance_lookup%5D=7fb7e9aefb38b3ead7e75c87cbbc2e46&vote%5Bdirection%5D=left&vote%5Bvisitor_identifier%5D=guest-tester | |
| 165 | + body: | |
| 166 | + string: | | |
| 167 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 168 | + <prompt> | |
| 169 | + <updated-at type="datetime">2014-03-18T13:53:26Z</updated-at> | |
| 170 | + <votes-count type="integer">0</votes-count> | |
| 171 | + <id type="integer">11</id> | |
| 172 | + <right-choice-id type="integer">11</right-choice-id> | |
| 173 | + <left-choice-id type="integer">13</left-choice-id> | |
| 174 | + <tracking nil="true"></tracking> | |
| 175 | + <left-choice-text>New inactive choice</left-choice-text> | |
| 176 | + <right-choice-text>Choice 1</right-choice-text> | |
| 177 | + <created-at type="datetime">2014-03-18T13:53:26Z</created-at> | |
| 178 | + </prompt> | |
| 179 | + | |
| 180 | + headers: | |
| 181 | + Accept: | |
| 182 | + - "*/*" | |
| 183 | + Content-Type: | |
| 184 | + - application/xml | |
| 185 | + response: | |
| 186 | + status: | |
| 187 | + code: 200 | |
| 188 | + message: "OK " | |
| 189 | + headers: | |
| 190 | + Server: | |
| 191 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 192 | + Content-Length: | |
| 193 | + - "695" | |
| 194 | + Set-Cookie: | |
| 195 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlZjlhODY1NWQxMWE2ZTRlMGM0YzI0YTFmOGM4OGQ3M2Y%3D--51a238d54ad7d76107c9b3f27db3bbdd162edbb0; path=/; HttpOnly | |
| 196 | + Content-Type: | |
| 197 | + - application/xml; charset=utf-8 | |
| 198 | + Cache-Control: | |
| 199 | + - private, max-age=0, must-revalidate | |
| 200 | + Connection: | |
| 201 | + - Keep-Alive | |
| 202 | + X-Runtime: | |
| 203 | + - "189" | |
| 204 | + Etag: | |
| 205 | + - "\"99bb2329ad4ffcb4a022ddcb352c151b\"" | |
| 206 | + Date: | |
| 207 | + - Tue, 18 Mar 2014 13:53:28 GMT | |
| 208 | + body: | |
| 209 | + string: | | |
| 210 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 211 | + <prompt> | |
| 212 | + <created-at type="datetime">2014-03-18T13:53:27Z</created-at> | |
| 213 | + <id type="integer">12</id> | |
| 214 | + <left-choice-id type="integer">11</left-choice-id> | |
| 215 | + <question-id type="integer">3</question-id> | |
| 216 | + <right-choice-id type="integer">13</right-choice-id> | |
| 217 | + <tracking nil="true"></tracking> | |
| 218 | + <updated-at type="datetime">2014-03-18T13:53:27Z</updated-at> | |
| 219 | + <votes-count type="integer">0</votes-count> | |
| 220 | + <left-choice-text>Choice 1</left-choice-text> | |
| 221 | + <right-choice-text>New inactive choice</right-choice-text> | |
| 222 | + <visitor_votes>1</visitor_votes> | |
| 223 | + <appearance_id>37d36e84a28d6b9c2d7766e78b6c0128</appearance_id> | |
| 224 | + <visitor_ideas>0</visitor_ideas> | |
| 225 | + </prompt> | |
| 226 | + | |
| 227 | + http_version: | |
| 228 | + recorded_at: Tue, 18 Mar 2014 13:53:28 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_retrieve_correct_values.yml
0 → 100644
| ... | ... | @@ -0,0 +1,61 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: get | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml | |
| 7 | + body: | |
| 8 | + string: "" | |
| 9 | + headers: | |
| 10 | + Accept: | |
| 11 | + - application/xml | |
| 12 | + response: | |
| 13 | + status: | |
| 14 | + code: 200 | |
| 15 | + message: "OK " | |
| 16 | + headers: | |
| 17 | + Server: | |
| 18 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 19 | + Content-Length: | |
| 20 | + - "956" | |
| 21 | + Set-Cookie: | |
| 22 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIhUvcXVlc3Rpb25zLzMueG1sOg9zZXNzaW9uX2lkIiVmNmNiMDRhYmE0NTJjMWUxY2QwZDU4ODJhMzA5ZDFmNA%3D%3D--5f5c2a5a6288a460a46ca282b0f0ab501c8b216f; path=/; HttpOnly | |
| 23 | + Content-Type: | |
| 24 | + - application/xml; charset=utf-8 | |
| 25 | + Cache-Control: | |
| 26 | + - private, max-age=0, must-revalidate | |
| 27 | + Connection: | |
| 28 | + - Keep-Alive | |
| 29 | + X-Runtime: | |
| 30 | + - "38" | |
| 31 | + Etag: | |
| 32 | + - "\"136a4319c14522cafd554602fe195a14\"" | |
| 33 | + Date: | |
| 34 | + - Tue, 18 Mar 2014 13:53:29 GMT | |
| 35 | + body: | |
| 36 | + string: | | |
| 37 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 38 | + <question> | |
| 39 | + <active type="boolean">true</active> | |
| 40 | + <choices-count type="integer">3</choices-count> | |
| 41 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 42 | + <creator-id type="integer">4</creator-id> | |
| 43 | + <id type="integer">3</id> | |
| 44 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 45 | + <information nil="true"></information> | |
| 46 | + <it-should-autoactivate-ideas type="boolean">false</it-should-autoactivate-ideas> | |
| 47 | + <local-identifier>1</local-identifier> | |
| 48 | + <name>Q1</name> | |
| 49 | + <prompts-count type="integer">2</prompts-count> | |
| 50 | + <show-results type="boolean">true</show-results> | |
| 51 | + <site-id type="integer">1</site-id> | |
| 52 | + <tracking nil="true"></tracking> | |
| 53 | + <updated-at type="datetime">2014-03-18T13:53:25Z</updated-at> | |
| 54 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 55 | + <version type="integer">5</version> | |
| 56 | + <votes-count type="integer">1</votes-count> | |
| 57 | + <item-count type="integer">3</item-count> | |
| 58 | + </question> | |
| 59 | + | |
| 60 | + http_version: | |
| 61 | + recorded_at: Tue, 18 Mar 2014 13:53:29 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_retrieve_question.yml
0 → 100644
| ... | ... | @@ -0,0 +1,61 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: get | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml | |
| 7 | + body: | |
| 8 | + string: "" | |
| 9 | + headers: | |
| 10 | + Accept: | |
| 11 | + - application/xml | |
| 12 | + response: | |
| 13 | + status: | |
| 14 | + code: 200 | |
| 15 | + message: "OK " | |
| 16 | + headers: | |
| 17 | + Server: | |
| 18 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 19 | + Content-Length: | |
| 20 | + - "956" | |
| 21 | + Set-Cookie: | |
| 22 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIhUvcXVlc3Rpb25zLzMueG1sOg9zZXNzaW9uX2lkIiViNDNhZjdhNzY0YTk5Yjg1YzMyOTcyYjM2YzExNGQwNg%3D%3D--43f1cfa66b564c94c154466e9076731ef1815293; path=/; HttpOnly | |
| 23 | + Content-Type: | |
| 24 | + - application/xml; charset=utf-8 | |
| 25 | + Cache-Control: | |
| 26 | + - private, max-age=0, must-revalidate | |
| 27 | + Connection: | |
| 28 | + - Keep-Alive | |
| 29 | + X-Runtime: | |
| 30 | + - "101" | |
| 31 | + Etag: | |
| 32 | + - "\"136a4319c14522cafd554602fe195a14\"" | |
| 33 | + Date: | |
| 34 | + - Tue, 18 Mar 2014 13:53:29 GMT | |
| 35 | + body: | |
| 36 | + string: | | |
| 37 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 38 | + <question> | |
| 39 | + <active type="boolean">true</active> | |
| 40 | + <choices-count type="integer">3</choices-count> | |
| 41 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 42 | + <creator-id type="integer">4</creator-id> | |
| 43 | + <id type="integer">3</id> | |
| 44 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 45 | + <information nil="true"></information> | |
| 46 | + <it-should-autoactivate-ideas type="boolean">false</it-should-autoactivate-ideas> | |
| 47 | + <local-identifier>1</local-identifier> | |
| 48 | + <name>Q1</name> | |
| 49 | + <prompts-count type="integer">2</prompts-count> | |
| 50 | + <show-results type="boolean">true</show-results> | |
| 51 | + <site-id type="integer">1</site-id> | |
| 52 | + <tracking nil="true"></tracking> | |
| 53 | + <updated-at type="datetime">2014-03-18T13:53:25Z</updated-at> | |
| 54 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 55 | + <version type="integer">5</version> | |
| 56 | + <votes-count type="integer">1</votes-count> | |
| 57 | + <item-count type="integer">3</item-count> | |
| 58 | + </question> | |
| 59 | + | |
| 60 | + http_version: | |
| 61 | + recorded_at: Tue, 18 Mar 2014 13:53:29 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_retrieve_question_choices.yml
0 → 100644
| ... | ... | @@ -0,0 +1,199 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: get | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml | |
| 7 | + body: | |
| 8 | + string: "" | |
| 9 | + headers: | |
| 10 | + Accept: | |
| 11 | + - application/xml | |
| 12 | + response: | |
| 13 | + status: | |
| 14 | + code: 200 | |
| 15 | + message: "OK " | |
| 16 | + headers: | |
| 17 | + Set-Cookie: | |
| 18 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIhUvcXVlc3Rpb25zLzMueG1sOg9zZXNzaW9uX2lkIiVmZGM4OWFkYmRiMmFjYzg1MDJkZGNiNDMwNmQxM2JjOQ%3D%3D--bd186dd42dd0910a7b4a288ababa51e9fe89938c; path=/; HttpOnly | |
| 19 | + Content-Type: | |
| 20 | + - application/xml; charset=utf-8 | |
| 21 | + Cache-Control: | |
| 22 | + - private, max-age=0, must-revalidate | |
| 23 | + Content-Length: | |
| 24 | + - "955" | |
| 25 | + X-Runtime: | |
| 26 | + - "32" | |
| 27 | + Connection: | |
| 28 | + - Keep-Alive | |
| 29 | + Server: | |
| 30 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 31 | + Etag: | |
| 32 | + - "\"02fabf29f70655795720421eaeb60eff\"" | |
| 33 | + Date: | |
| 34 | + - Tue, 18 Mar 2014 14:03:30 GMT | |
| 35 | + body: | |
| 36 | + string: | | |
| 37 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 38 | + <question> | |
| 39 | + <active type="boolean">true</active> | |
| 40 | + <choices-count type="integer">4</choices-count> | |
| 41 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 42 | + <creator-id type="integer">4</creator-id> | |
| 43 | + <id type="integer">3</id> | |
| 44 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 45 | + <information nil="true"></information> | |
| 46 | + <it-should-autoactivate-ideas type="boolean">true</it-should-autoactivate-ideas> | |
| 47 | + <local-identifier>1</local-identifier> | |
| 48 | + <name>Q1</name> | |
| 49 | + <prompts-count type="integer">2</prompts-count> | |
| 50 | + <show-results type="boolean">true</show-results> | |
| 51 | + <site-id type="integer">1</site-id> | |
| 52 | + <tracking nil="true"></tracking> | |
| 53 | + <updated-at type="datetime">2014-03-18T13:53:30Z</updated-at> | |
| 54 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 55 | + <version type="integer">6</version> | |
| 56 | + <votes-count type="integer">1</votes-count> | |
| 57 | + <item-count type="integer">4</item-count> | |
| 58 | + </question> | |
| 59 | + | |
| 60 | + http_version: | |
| 61 | + recorded_at: Tue, 18 Mar 2014 14:03:30 GMT | |
| 62 | +- request: | |
| 63 | + method: get | |
| 64 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 65 | + body: | |
| 66 | + string: "" | |
| 67 | + headers: | |
| 68 | + Accept: | |
| 69 | + - application/xml | |
| 70 | + response: | |
| 71 | + status: | |
| 72 | + code: 200 | |
| 73 | + message: "OK " | |
| 74 | + headers: | |
| 75 | + Set-Cookie: | |
| 76 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIh0vcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw6D3Nlc3Npb25faWQiJWM5ODM4YWI1YTY4MGM1NzkyYTA4NzZiMDRmZTdiNTNh--cbd780784d8f3de7a81dcf7c4c8006349f97dc21; path=/; HttpOnly | |
| 77 | + Content-Type: | |
| 78 | + - application/xml; charset=utf-8 | |
| 79 | + Cache-Control: | |
| 80 | + - private, max-age=0, must-revalidate | |
| 81 | + Content-Length: | |
| 82 | + - "1523" | |
| 83 | + X-Runtime: | |
| 84 | + - "105" | |
| 85 | + Connection: | |
| 86 | + - Keep-Alive | |
| 87 | + Server: | |
| 88 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 89 | + Etag: | |
| 90 | + - "\"eeca0792e33b8baef6a91a806cbe6a37\"" | |
| 91 | + Date: | |
| 92 | + - Tue, 18 Mar 2014 14:03:30 GMT | |
| 93 | + body: | |
| 94 | + string: | | |
| 95 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 96 | + <choices type="array"> | |
| 97 | + <choice> | |
| 98 | + <active type="boolean">true</active> | |
| 99 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 100 | + <data>New inactive choice Changes</data> | |
| 101 | + <id type="integer">13</id> | |
| 102 | + <losses type="integer">0</losses> | |
| 103 | + <score type="float">66.6666666666667</score> | |
| 104 | + <wins type="integer">1</wins> | |
| 105 | + <user-created type="boolean">false</user-created> | |
| 106 | + </choice> | |
| 107 | + <choice> | |
| 108 | + <active type="boolean">true</active> | |
| 109 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 110 | + <data>Choice 2</data> | |
| 111 | + <id type="integer">12</id> | |
| 112 | + <losses type="integer">0</losses> | |
| 113 | + <score type="float">50.0</score> | |
| 114 | + <wins type="integer">0</wins> | |
| 115 | + <user-created type="boolean">false</user-created> | |
| 116 | + </choice> | |
| 117 | + <choice> | |
| 118 | + <active type="boolean">true</active> | |
| 119 | + <created-at type="datetime">2014-03-18T14:00:51Z</created-at> | |
| 120 | + <data>New Choice</data> | |
| 121 | + <id type="integer">16</id> | |
| 122 | + <losses type="integer">0</losses> | |
| 123 | + <score type="float">50.0</score> | |
| 124 | + <wins type="integer">0</wins> | |
| 125 | + <user-created type="boolean">true</user-created> | |
| 126 | + </choice> | |
| 127 | + <choice> | |
| 128 | + <active type="boolean">true</active> | |
| 129 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 130 | + <data>Choice Renamed</data> | |
| 131 | + <id type="integer">11</id> | |
| 132 | + <losses type="integer">1</losses> | |
| 133 | + <score type="float">33.3333333333333</score> | |
| 134 | + <wins type="integer">0</wins> | |
| 135 | + <user-created type="boolean">false</user-created> | |
| 136 | + </choice> | |
| 137 | + </choices> | |
| 138 | + | |
| 139 | + http_version: | |
| 140 | + recorded_at: Tue, 18 Mar 2014 14:03:30 GMT | |
| 141 | +- request: | |
| 142 | + method: get | |
| 143 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 144 | + body: | |
| 145 | + string: "" | |
| 146 | + headers: | |
| 147 | + Accept: | |
| 148 | + - application/xml | |
| 149 | + response: | |
| 150 | + status: | |
| 151 | + code: 200 | |
| 152 | + message: "OK " | |
| 153 | + headers: | |
| 154 | + Set-Cookie: | |
| 155 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIh0vcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw6D3Nlc3Npb25faWQiJTFkYTY1YTI4YzJhZGVhMjcwODM4YjBkYmE5MWM3MTU1--357b1dcc8c88cdcee7b6c6df9dd22113282f690b; path=/; HttpOnly | |
| 156 | + Content-Type: | |
| 157 | + - application/xml; charset=utf-8 | |
| 158 | + Cache-Control: | |
| 159 | + - private, max-age=0, must-revalidate | |
| 160 | + Content-Length: | |
| 161 | + - "1523" | |
| 162 | + X-Runtime: | |
| 163 | + - "35" | |
| 164 | + Connection: | |
| 165 | + - Keep-Alive | |
| 166 | + Server: | |
| 167 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 168 | + Etag: | |
| 169 | + - "\"eeca0792e33b8baef6a91a806cbe6a37\"" | |
| 170 | + Date: | |
| 171 | + - Tue, 18 Mar 2014 14:03:31 GMT | |
| 172 | + body: | |
| 173 | + string: | | |
| 174 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 175 | + <choices type="array"> | |
| 176 | + <choice> | |
| 177 | + <active type="boolean">true</active> | |
| 178 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 179 | + <data>Choice 1</data> | |
| 180 | + <id type="integer">13</id> | |
| 181 | + <losses type="integer">0</losses> | |
| 182 | + <score type="float">66.6666666666667</score> | |
| 183 | + <wins type="integer">1</wins> | |
| 184 | + <user-created type="boolean">false</user-created> | |
| 185 | + </choice> | |
| 186 | + <choice> | |
| 187 | + <active type="boolean">true</active> | |
| 188 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 189 | + <data>Choice 2</data> | |
| 190 | + <id type="integer">12</id> | |
| 191 | + <losses type="integer">0</losses> | |
| 192 | + <score type="float">50.0</score> | |
| 193 | + <wins type="integer">0</wins> | |
| 194 | + <user-created type="boolean">false</user-created> | |
| 195 | + </choice> | |
| 196 | + </choices> | |
| 197 | + | |
| 198 | + http_version: | |
| 199 | + recorded_at: Tue, 18 Mar 2014 14:03:31 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_toggle_autactivate_ideas.yml
0 → 100644
| ... | ... | @@ -0,0 +1,121 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: get | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml | |
| 7 | + body: | |
| 8 | + string: "" | |
| 9 | + headers: | |
| 10 | + Accept: | |
| 11 | + - application/xml | |
| 12 | + response: | |
| 13 | + status: | |
| 14 | + code: 200 | |
| 15 | + message: "OK " | |
| 16 | + headers: | |
| 17 | + Server: | |
| 18 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 19 | + Content-Length: | |
| 20 | + - "956" | |
| 21 | + Set-Cookie: | |
| 22 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIhUvcXVlc3Rpb25zLzMueG1sOg9zZXNzaW9uX2lkIiVlMDU4ZjNiMWMyMjdhYjc3NzM1MDY3ZDA0Yjk5MjQwOA%3D%3D--b459f53957ba48ab323b64547a1388ccc21519ae; path=/; HttpOnly | |
| 23 | + Content-Type: | |
| 24 | + - application/xml; charset=utf-8 | |
| 25 | + Cache-Control: | |
| 26 | + - private, max-age=0, must-revalidate | |
| 27 | + Connection: | |
| 28 | + - Keep-Alive | |
| 29 | + X-Runtime: | |
| 30 | + - "38" | |
| 31 | + Etag: | |
| 32 | + - "\"136a4319c14522cafd554602fe195a14\"" | |
| 33 | + Date: | |
| 34 | + - Tue, 18 Mar 2014 13:53:30 GMT | |
| 35 | + body: | |
| 36 | + string: | | |
| 37 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 38 | + <question> | |
| 39 | + <active type="boolean">true</active> | |
| 40 | + <choices-count type="integer">3</choices-count> | |
| 41 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 42 | + <creator-id type="integer">4</creator-id> | |
| 43 | + <id type="integer">3</id> | |
| 44 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 45 | + <information nil="true"></information> | |
| 46 | + <it-should-autoactivate-ideas type="boolean"><%= autoactivateidea %></it-should-autoactivate-ideas> | |
| 47 | + <local-identifier>1</local-identifier> | |
| 48 | + <name>Q1</name> | |
| 49 | + <prompts-count type="integer">2</prompts-count> | |
| 50 | + <show-results type="boolean">true</show-results> | |
| 51 | + <site-id type="integer">1</site-id> | |
| 52 | + <tracking nil="true"></tracking> | |
| 53 | + <updated-at type="datetime">2014-03-18T13:53:25Z</updated-at> | |
| 54 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 55 | + <version type="integer">5</version> | |
| 56 | + <votes-count type="integer">1</votes-count> | |
| 57 | + <item-count type="integer">3</item-count> | |
| 58 | + </question> | |
| 59 | + | |
| 60 | + http_version: | |
| 61 | + recorded_at: Tue, 18 Mar 2014 13:53:30 GMT | |
| 62 | +- request: | |
| 63 | + method: put | |
| 64 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml | |
| 65 | + body: | |
| 66 | + string: | | |
| 67 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 68 | + <question> | |
| 69 | + <prompts-count type="integer">0</prompts-count> | |
| 70 | + <updated-at type="datetime">2014-03-18T13:53:23Z</updated-at> | |
| 71 | + <active type="boolean">true</active> | |
| 72 | + <votes-count type="integer">0</votes-count> | |
| 73 | + <version type="integer">1</version> | |
| 74 | + <it-should-autoactivate-ideas type="boolean"><%= autoactivateidea %></it-should-autoactivate-ideas> | |
| 75 | + <information nil="true"></information> | |
| 76 | + <id type="integer">3</id> | |
| 77 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 78 | + <creator-id type="integer">4</creator-id> | |
| 79 | + <tracking nil="true"></tracking> | |
| 80 | + <choices-count type="integer">0</choices-count> | |
| 81 | + <site-id type="integer">1</site-id> | |
| 82 | + <name>Q1</name> | |
| 83 | + <show-results type="boolean">true</show-results> | |
| 84 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 85 | + <local-identifier>1</local-identifier> | |
| 86 | + <visitor-identifier>1</visitor-identifier> | |
| 87 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 88 | + <ideas>Choice 1 | |
| 89 | + Choice 2</ideas> | |
| 90 | + </question> | |
| 91 | + | |
| 92 | + headers: | |
| 93 | + Accept: | |
| 94 | + - "*/*" | |
| 95 | + Content-Type: | |
| 96 | + - application/xml | |
| 97 | + response: | |
| 98 | + status: | |
| 99 | + code: 200 | |
| 100 | + message: "OK " | |
| 101 | + headers: | |
| 102 | + Server: | |
| 103 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 104 | + Content-Length: | |
| 105 | + - "1" | |
| 106 | + Set-Cookie: | |
| 107 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlYTUxYWFkMjI3YmU5OTJkNzUzNmQyZTIyMWFmMjY1ODE%3D--5a099c1625bf09a2f0dbfccf7ac4ccf70ab7f15f; path=/; HttpOnly | |
| 108 | + Content-Type: | |
| 109 | + - application/xml; charset=utf-8 | |
| 110 | + Cache-Control: | |
| 111 | + - no-cache | |
| 112 | + Connection: | |
| 113 | + - Keep-Alive | |
| 114 | + X-Runtime: | |
| 115 | + - "46" | |
| 116 | + Date: | |
| 117 | + - Tue, 18 Mar 2014 13:53:30 GMT | |
| 118 | + body: | |
| 119 | + string: " " | |
| 120 | + http_version: | |
| 121 | + recorded_at: Tue, 18 Mar 2014 13:53:30 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_update_choice.yml
0 → 100644
| ... | ... | @@ -0,0 +1,309 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: get | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 7 | + body: | |
| 8 | + string: "" | |
| 9 | + headers: | |
| 10 | + Accept: | |
| 11 | + - application/xml | |
| 12 | + response: | |
| 13 | + status: | |
| 14 | + code: 200 | |
| 15 | + message: "OK " | |
| 16 | + headers: | |
| 17 | + Server: | |
| 18 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 19 | + Content-Length: | |
| 20 | + - "1164" | |
| 21 | + Set-Cookie: | |
| 22 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIh0vcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw6D3Nlc3Npb25faWQiJWQ2OGI0OGY2OTQxNTQyMDczODA0NWZlMjQ5Y2IzZThi--4aa8834cf7ce8aef4d9cba1b0865112eeb431fd2; path=/; HttpOnly | |
| 23 | + Content-Type: | |
| 24 | + - application/xml; charset=utf-8 | |
| 25 | + Cache-Control: | |
| 26 | + - private, max-age=0, must-revalidate | |
| 27 | + Connection: | |
| 28 | + - Keep-Alive | |
| 29 | + X-Runtime: | |
| 30 | + - "36" | |
| 31 | + Etag: | |
| 32 | + - "\"69f5a8090e05f8f10004245d647cd2dc\"" | |
| 33 | + Date: | |
| 34 | + - Tue, 18 Mar 2014 13:53:33 GMT | |
| 35 | + body: | |
| 36 | + string: | | |
| 37 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 38 | + <choices type="array"> | |
| 39 | + <choice> | |
| 40 | + <active type="boolean">true</active> | |
| 41 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 42 | + <data>New inactive choice</data> | |
| 43 | + <id type="integer">13</id> | |
| 44 | + <losses type="integer">0</losses> | |
| 45 | + <score type="float">66.6666666666667</score> | |
| 46 | + <wins type="integer">1</wins> | |
| 47 | + <user-created type="boolean">false</user-created> | |
| 48 | + </choice> | |
| 49 | + <choice> | |
| 50 | + <active type="boolean">true</active> | |
| 51 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 52 | + <data>Choice 2</data> | |
| 53 | + <id type="integer">12</id> | |
| 54 | + <losses type="integer">0</losses> | |
| 55 | + <score type="float">50.0</score> | |
| 56 | + <wins type="integer">0</wins> | |
| 57 | + <user-created type="boolean">false</user-created> | |
| 58 | + </choice> | |
| 59 | + <choice> | |
| 60 | + <active type="boolean">true</active> | |
| 61 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 62 | + <data>Choice Renamed</data> | |
| 63 | + <id type="integer">11</id> | |
| 64 | + <losses type="integer">1</losses> | |
| 65 | + <score type="float">33.3333333333333</score> | |
| 66 | + <wins type="integer">0</wins> | |
| 67 | + <user-created type="boolean">false</user-created> | |
| 68 | + </choice> | |
| 69 | + </choices> | |
| 70 | + | |
| 71 | + http_version: | |
| 72 | + recorded_at: Tue, 18 Mar 2014 13:53:33 GMT | |
| 73 | +- request: | |
| 74 | + method: get | |
| 75 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices/13.xml | |
| 76 | + body: | |
| 77 | + string: "" | |
| 78 | + headers: | |
| 79 | + Accept: | |
| 80 | + - application/xml | |
| 81 | + response: | |
| 82 | + status: | |
| 83 | + code: 200 | |
| 84 | + message: "OK " | |
| 85 | + headers: | |
| 86 | + Server: | |
| 87 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 88 | + Content-Length: | |
| 89 | + - "1060" | |
| 90 | + Set-Cookie: | |
| 91 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIiAvcXVlc3Rpb25zLzMvY2hvaWNlcy8xMy54bWw6D3Nlc3Npb25faWQiJTBiMzRmOGNmM2UwYmM2NDI1NmYwOTI5YjQxY2E5MGQ0--8c662ffceec610d8e1fa5cc84e326d54785349f1; path=/; HttpOnly | |
| 92 | + Content-Type: | |
| 93 | + - application/xml; charset=utf-8 | |
| 94 | + Cache-Control: | |
| 95 | + - private, max-age=0, must-revalidate | |
| 96 | + Connection: | |
| 97 | + - Keep-Alive | |
| 98 | + X-Runtime: | |
| 99 | + - "29" | |
| 100 | + Etag: | |
| 101 | + - "\"3bfe38df8adc8b51f7668b6bd9b7fac8\"" | |
| 102 | + Date: | |
| 103 | + - Tue, 18 Mar 2014 13:53:33 GMT | |
| 104 | + body: | |
| 105 | + string: | | |
| 106 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 107 | + <choice> | |
| 108 | + <active type="boolean">true</active> | |
| 109 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 110 | + <creator-id type="integer">4</creator-id> | |
| 111 | + <data>New inactive choice</data> | |
| 112 | + <id type="integer">13</id> | |
| 113 | + <item-id type="integer" nil="true"></item-id> | |
| 114 | + <local-identifier>1</local-identifier> | |
| 115 | + <losses type="integer">0</losses> | |
| 116 | + <position type="integer" nil="true"></position> | |
| 117 | + <prompt-id type="integer" nil="true"></prompt-id> | |
| 118 | + <prompts-count type="integer">0</prompts-count> | |
| 119 | + <prompts-on-the-left-count type="integer">1</prompts-on-the-left-count> | |
| 120 | + <prompts-on-the-right-count type="integer">1</prompts-on-the-right-count> | |
| 121 | + <question-id type="integer">3</question-id> | |
| 122 | + <ratings type="integer" nil="true"></ratings> | |
| 123 | + <request-id type="integer" nil="true"></request-id> | |
| 124 | + <score type="float">66.6666666666667</score> | |
| 125 | + <tracking nil="true"></tracking> | |
| 126 | + <updated-at type="datetime">2014-03-18T13:53:28Z</updated-at> | |
| 127 | + <version type="integer">2</version> | |
| 128 | + <wins type="integer">1</wins> | |
| 129 | + </choice> | |
| 130 | + | |
| 131 | + http_version: | |
| 132 | + recorded_at: Tue, 18 Mar 2014 13:53:33 GMT | |
| 133 | +- request: | |
| 134 | + method: put | |
| 135 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices/13.xml | |
| 136 | + body: | |
| 137 | + string: | | |
| 138 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 139 | + <choice> | |
| 140 | + <prompts-count type="integer">0</prompts-count> | |
| 141 | + <updated-at type="datetime">2014-03-18T13:53:28Z</updated-at> | |
| 142 | + <active type="boolean">true</active> | |
| 143 | + <wins type="integer">1</wins> | |
| 144 | + <prompt-id nil="true"></prompt-id> | |
| 145 | + <version type="integer">2</version> | |
| 146 | + <request-id nil="true"></request-id> | |
| 147 | + <position nil="true"></position> | |
| 148 | + <prompts-on-the-right-count type="integer">1</prompts-on-the-right-count> | |
| 149 | + <id type="integer">13</id> | |
| 150 | + <data>New inactive choice Changes</data> | |
| 151 | + <losses type="integer">0</losses> | |
| 152 | + <creator-id type="integer">4</creator-id> | |
| 153 | + <score type="float">66.6666666666667</score> | |
| 154 | + <tracking nil="true"></tracking> | |
| 155 | + <ratings nil="true"></ratings> | |
| 156 | + <local-identifier>1</local-identifier> | |
| 157 | + <item-id nil="true"></item-id> | |
| 158 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 159 | + <prompts-on-the-left-count type="integer">1</prompts-on-the-left-count> | |
| 160 | + </choice> | |
| 161 | + | |
| 162 | + headers: | |
| 163 | + Accept: | |
| 164 | + - "*/*" | |
| 165 | + Content-Type: | |
| 166 | + - application/xml | |
| 167 | + response: | |
| 168 | + status: | |
| 169 | + code: 200 | |
| 170 | + message: "OK " | |
| 171 | + headers: | |
| 172 | + Server: | |
| 173 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 174 | + Content-Length: | |
| 175 | + - "1" | |
| 176 | + Set-Cookie: | |
| 177 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlYWY5MTQ0ODk4ZjFiZTQyMGQ1YjA4OWYzZGQ4ZGM0Nzg%3D--6e7bebf904ab8d762617352a3d8f4714b992a6d6; path=/; HttpOnly | |
| 178 | + Content-Type: | |
| 179 | + - application/xml; charset=utf-8 | |
| 180 | + Cache-Control: | |
| 181 | + - no-cache | |
| 182 | + Connection: | |
| 183 | + - Keep-Alive | |
| 184 | + X-Runtime: | |
| 185 | + - "71" | |
| 186 | + Date: | |
| 187 | + - Tue, 18 Mar 2014 13:53:33 GMT | |
| 188 | + body: | |
| 189 | + string: " " | |
| 190 | + http_version: | |
| 191 | + recorded_at: Tue, 18 Mar 2014 13:53:33 GMT | |
| 192 | +- request: | |
| 193 | + method: get | |
| 194 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml | |
| 195 | + body: | |
| 196 | + string: "" | |
| 197 | + headers: | |
| 198 | + Accept: | |
| 199 | + - application/xml | |
| 200 | + response: | |
| 201 | + status: | |
| 202 | + code: 200 | |
| 203 | + message: "OK " | |
| 204 | + headers: | |
| 205 | + Server: | |
| 206 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 207 | + Content-Length: | |
| 208 | + - "955" | |
| 209 | + Set-Cookie: | |
| 210 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIhUvcXVlc3Rpb25zLzMueG1sOg9zZXNzaW9uX2lkIiU2ZTMzYzY4NDQwNGVkY2MzZmM4ZmE3YjlkODJjYjE5ZA%3D%3D--e9058c1f1929399cd13aa89dc7ccfbb9dcacfa71; path=/; HttpOnly | |
| 211 | + Content-Type: | |
| 212 | + - application/xml; charset=utf-8 | |
| 213 | + Cache-Control: | |
| 214 | + - private, max-age=0, must-revalidate | |
| 215 | + Connection: | |
| 216 | + - Keep-Alive | |
| 217 | + X-Runtime: | |
| 218 | + - "35" | |
| 219 | + Etag: | |
| 220 | + - "\"6cf98e7e9708e9d7badfffd9accdc061\"" | |
| 221 | + Date: | |
| 222 | + - Tue, 18 Mar 2014 13:53:33 GMT | |
| 223 | + body: | |
| 224 | + string: | | |
| 225 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 226 | + <question> | |
| 227 | + <active type="boolean">true</active> | |
| 228 | + <choices-count type="integer">3</choices-count> | |
| 229 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 230 | + <creator-id type="integer">4</creator-id> | |
| 231 | + <id type="integer">3</id> | |
| 232 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 233 | + <information nil="true"></information> | |
| 234 | + <it-should-autoactivate-ideas type="boolean">true</it-should-autoactivate-ideas> | |
| 235 | + <local-identifier>1</local-identifier> | |
| 236 | + <name>Q1</name> | |
| 237 | + <prompts-count type="integer">2</prompts-count> | |
| 238 | + <show-results type="boolean">true</show-results> | |
| 239 | + <site-id type="integer">1</site-id> | |
| 240 | + <tracking nil="true"></tracking> | |
| 241 | + <updated-at type="datetime">2014-03-18T13:53:30Z</updated-at> | |
| 242 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 243 | + <version type="integer">6</version> | |
| 244 | + <votes-count type="integer">1</votes-count> | |
| 245 | + <item-count type="integer">3</item-count> | |
| 246 | + </question> | |
| 247 | + | |
| 248 | + http_version: | |
| 249 | + recorded_at: Tue, 18 Mar 2014 13:53:33 GMT | |
| 250 | +- request: | |
| 251 | + method: get | |
| 252 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices/13.xml?include_inactive=true | |
| 253 | + body: | |
| 254 | + string: "" | |
| 255 | + headers: | |
| 256 | + Accept: | |
| 257 | + - application/xml | |
| 258 | + response: | |
| 259 | + status: | |
| 260 | + code: 200 | |
| 261 | + message: "OK " | |
| 262 | + headers: | |
| 263 | + Server: | |
| 264 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 265 | + Content-Length: | |
| 266 | + - "1068" | |
| 267 | + Set-Cookie: | |
| 268 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIjYvcXVlc3Rpb25zLzMvY2hvaWNlcy8xMy54bWw%2FaW5jbHVkZV9pbmFjdGl2ZT10cnVlOg9zZXNzaW9uX2lkIiUwMzFkMGRiYzIzZmFkZmVlYWRjMTJmYWI1ZjQ2Y2QwMg%3D%3D--737cab737a413d46b798135bc710f5f3aa4dadbe; path=/; HttpOnly | |
| 269 | + Content-Type: | |
| 270 | + - application/xml; charset=utf-8 | |
| 271 | + Cache-Control: | |
| 272 | + - private, max-age=0, must-revalidate | |
| 273 | + Connection: | |
| 274 | + - Keep-Alive | |
| 275 | + X-Runtime: | |
| 276 | + - "92" | |
| 277 | + Etag: | |
| 278 | + - "\"fa59c6db820376f577981a0439ec0544\"" | |
| 279 | + Date: | |
| 280 | + - Tue, 18 Mar 2014 13:53:33 GMT | |
| 281 | + body: | |
| 282 | + string: | | |
| 283 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 284 | + <choice> | |
| 285 | + <active type="boolean">true</active> | |
| 286 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 287 | + <creator-id type="integer">4</creator-id> | |
| 288 | + <data>New inactive choice Changes</data> | |
| 289 | + <id type="integer">13</id> | |
| 290 | + <item-id type="integer" nil="true"></item-id> | |
| 291 | + <local-identifier>1</local-identifier> | |
| 292 | + <losses type="integer">0</losses> | |
| 293 | + <position type="integer" nil="true"></position> | |
| 294 | + <prompt-id type="integer" nil="true"></prompt-id> | |
| 295 | + <prompts-count type="integer">0</prompts-count> | |
| 296 | + <prompts-on-the-left-count type="integer">1</prompts-on-the-left-count> | |
| 297 | + <prompts-on-the-right-count type="integer">1</prompts-on-the-right-count> | |
| 298 | + <question-id type="integer">3</question-id> | |
| 299 | + <ratings type="integer" nil="true"></ratings> | |
| 300 | + <request-id type="integer" nil="true"></request-id> | |
| 301 | + <score type="float">66.6666666666667</score> | |
| 302 | + <tracking nil="true"></tracking> | |
| 303 | + <updated-at type="datetime">2014-03-18T13:53:33Z</updated-at> | |
| 304 | + <version type="integer">3</version> | |
| 305 | + <wins type="integer">1</wins> | |
| 306 | + </choice> | |
| 307 | + | |
| 308 | + http_version: | |
| 309 | + recorded_at: Tue, 18 Mar 2014 13:53:33 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_update_choice_text.yml
0 → 100644
| ... | ... | @@ -0,0 +1,387 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: get | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 7 | + body: | |
| 8 | + string: "" | |
| 9 | + headers: | |
| 10 | + Accept: | |
| 11 | + - application/xml | |
| 12 | + response: | |
| 13 | + status: | |
| 14 | + code: 200 | |
| 15 | + message: "OK " | |
| 16 | + headers: | |
| 17 | + Server: | |
| 18 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 19 | + Content-Length: | |
| 20 | + - "1158" | |
| 21 | + Set-Cookie: | |
| 22 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIh0vcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw6D3Nlc3Npb25faWQiJTA2MzFlYTI5MjNhYzVkNDdjMWE0NDAxMDdhYTkyM2M2--e6dda2b61067b8850f33c271d3b5053f3ef24b35; path=/; HttpOnly | |
| 23 | + Content-Type: | |
| 24 | + - application/xml; charset=utf-8 | |
| 25 | + Cache-Control: | |
| 26 | + - private, max-age=0, must-revalidate | |
| 27 | + Connection: | |
| 28 | + - Keep-Alive | |
| 29 | + X-Runtime: | |
| 30 | + - "94" | |
| 31 | + Etag: | |
| 32 | + - "\"36c2be193a2606eea188bd73a67bf117\"" | |
| 33 | + Date: | |
| 34 | + - Tue, 18 Mar 2014 13:53:30 GMT | |
| 35 | + body: | |
| 36 | + string: | | |
| 37 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 38 | + <choices type="array"> | |
| 39 | + <choice> | |
| 40 | + <active type="boolean">true</active> | |
| 41 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 42 | + <data>New inactive choice</data> | |
| 43 | + <id type="integer">13</id> | |
| 44 | + <losses type="integer">0</losses> | |
| 45 | + <score type="float">66.6666666666667</score> | |
| 46 | + <wins type="integer">1</wins> | |
| 47 | + <user-created type="boolean">false</user-created> | |
| 48 | + </choice> | |
| 49 | + <choice> | |
| 50 | + <active type="boolean">true</active> | |
| 51 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 52 | + <data>Choice 2</data> | |
| 53 | + <id type="integer">12</id> | |
| 54 | + <losses type="integer">0</losses> | |
| 55 | + <score type="float">50.0</score> | |
| 56 | + <wins type="integer">0</wins> | |
| 57 | + <user-created type="boolean">false</user-created> | |
| 58 | + </choice> | |
| 59 | + <choice> | |
| 60 | + <active type="boolean">true</active> | |
| 61 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 62 | + <data>Choice 1</data> | |
| 63 | + <id type="integer">11</id> | |
| 64 | + <losses type="integer">1</losses> | |
| 65 | + <score type="float">33.3333333333333</score> | |
| 66 | + <wins type="integer">0</wins> | |
| 67 | + <user-created type="boolean">false</user-created> | |
| 68 | + </choice> | |
| 69 | + </choices> | |
| 70 | + | |
| 71 | + http_version: | |
| 72 | + recorded_at: Tue, 18 Mar 2014 13:53:30 GMT | |
| 73 | +- request: | |
| 74 | + method: get | |
| 75 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices/11.xml | |
| 76 | + body: | |
| 77 | + string: "" | |
| 78 | + headers: | |
| 79 | + Accept: | |
| 80 | + - application/xml | |
| 81 | + response: | |
| 82 | + status: | |
| 83 | + code: 200 | |
| 84 | + message: "OK " | |
| 85 | + headers: | |
| 86 | + Server: | |
| 87 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 88 | + Content-Length: | |
| 89 | + - "1059" | |
| 90 | + Set-Cookie: | |
| 91 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIiAvcXVlc3Rpb25zLzMvY2hvaWNlcy8xMS54bWw6D3Nlc3Npb25faWQiJTAwM2U5NmEzYjI2ZTg5ODdkOTA1ZjBhNzJjZDgyZjZj--dbb3296e74f765aff28204bf6156ecd076dc52d1; path=/; HttpOnly | |
| 92 | + Content-Type: | |
| 93 | + - application/xml; charset=utf-8 | |
| 94 | + Cache-Control: | |
| 95 | + - private, max-age=0, must-revalidate | |
| 96 | + Connection: | |
| 97 | + - Keep-Alive | |
| 98 | + X-Runtime: | |
| 99 | + - "26" | |
| 100 | + Etag: | |
| 101 | + - "\"8a0260eef9947c322ecf01a42b14b856\"" | |
| 102 | + Date: | |
| 103 | + - Tue, 18 Mar 2014 13:53:30 GMT | |
| 104 | + body: | |
| 105 | + string: | | |
| 106 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 107 | + <choice> | |
| 108 | + <active type="boolean">true</active> | |
| 109 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 110 | + <creator-id type="integer">4</creator-id> | |
| 111 | + <data>Choice 1</data> | |
| 112 | + <id type="integer">11</id> | |
| 113 | + <item-id type="integer" nil="true"></item-id> | |
| 114 | + <local-identifier nil="true"></local-identifier> | |
| 115 | + <losses type="integer">1</losses> | |
| 116 | + <position type="integer" nil="true"></position> | |
| 117 | + <prompt-id type="integer" nil="true"></prompt-id> | |
| 118 | + <prompts-count type="integer">0</prompts-count> | |
| 119 | + <prompts-on-the-left-count type="integer">1</prompts-on-the-left-count> | |
| 120 | + <prompts-on-the-right-count type="integer">1</prompts-on-the-right-count> | |
| 121 | + <question-id type="integer">3</question-id> | |
| 122 | + <ratings type="integer" nil="true"></ratings> | |
| 123 | + <request-id type="integer" nil="true"></request-id> | |
| 124 | + <score type="float">33.3333333333333</score> | |
| 125 | + <tracking nil="true"></tracking> | |
| 126 | + <updated-at type="datetime">2014-03-18T13:53:28Z</updated-at> | |
| 127 | + <version type="integer">1</version> | |
| 128 | + <wins type="integer">0</wins> | |
| 129 | + </choice> | |
| 130 | + | |
| 131 | + http_version: | |
| 132 | + recorded_at: Tue, 18 Mar 2014 13:53:30 GMT | |
| 133 | +- request: | |
| 134 | + method: put | |
| 135 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices/11.xml | |
| 136 | + body: | |
| 137 | + string: | | |
| 138 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 139 | + <choice> | |
| 140 | + <prompts-count type="integer">0</prompts-count> | |
| 141 | + <updated-at type="datetime">2014-03-18T13:53:28Z</updated-at> | |
| 142 | + <active type="boolean">true</active> | |
| 143 | + <wins type="integer">0</wins> | |
| 144 | + <prompt-id nil="true"></prompt-id> | |
| 145 | + <version type="integer">1</version> | |
| 146 | + <request-id nil="true"></request-id> | |
| 147 | + <position nil="true"></position> | |
| 148 | + <prompts-on-the-right-count type="integer">1</prompts-on-the-right-count> | |
| 149 | + <id type="integer">11</id> | |
| 150 | + <data>Choice Renamed</data> | |
| 151 | + <losses type="integer">1</losses> | |
| 152 | + <creator-id type="integer">4</creator-id> | |
| 153 | + <score type="float">33.3333333333333</score> | |
| 154 | + <tracking nil="true"></tracking> | |
| 155 | + <ratings nil="true"></ratings> | |
| 156 | + <local-identifier nil="true"></local-identifier> | |
| 157 | + <item-id nil="true"></item-id> | |
| 158 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 159 | + <prompts-on-the-left-count type="integer">1</prompts-on-the-left-count> | |
| 160 | + </choice> | |
| 161 | + | |
| 162 | + headers: | |
| 163 | + Accept: | |
| 164 | + - "*/*" | |
| 165 | + Content-Type: | |
| 166 | + - application/xml | |
| 167 | + response: | |
| 168 | + status: | |
| 169 | + code: 200 | |
| 170 | + message: "OK " | |
| 171 | + headers: | |
| 172 | + Server: | |
| 173 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 174 | + Content-Length: | |
| 175 | + - "1" | |
| 176 | + Set-Cookie: | |
| 177 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlYjA2MDMzOGI1NjMzZjc3ODVjM2E1MWM3OTJhNDVjOWM%3D--530dcfc4c8732f518002a28d1c38e0ef350e8e37; path=/; HttpOnly | |
| 178 | + Content-Type: | |
| 179 | + - application/xml; charset=utf-8 | |
| 180 | + Cache-Control: | |
| 181 | + - no-cache | |
| 182 | + Connection: | |
| 183 | + - Keep-Alive | |
| 184 | + X-Runtime: | |
| 185 | + - "80" | |
| 186 | + Date: | |
| 187 | + - Tue, 18 Mar 2014 13:53:31 GMT | |
| 188 | + body: | |
| 189 | + string: " " | |
| 190 | + http_version: | |
| 191 | + recorded_at: Tue, 18 Mar 2014 13:53:31 GMT | |
| 192 | +- request: | |
| 193 | + method: get | |
| 194 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml | |
| 195 | + body: | |
| 196 | + string: "" | |
| 197 | + headers: | |
| 198 | + Accept: | |
| 199 | + - application/xml | |
| 200 | + response: | |
| 201 | + status: | |
| 202 | + code: 200 | |
| 203 | + message: "OK " | |
| 204 | + headers: | |
| 205 | + Server: | |
| 206 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 207 | + Content-Length: | |
| 208 | + - "955" | |
| 209 | + Set-Cookie: | |
| 210 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIhUvcXVlc3Rpb25zLzMueG1sOg9zZXNzaW9uX2lkIiU4NjQyMGVhYWI5MTliYWJhZWM5ZGNkY2EyZTVjYjk1Nw%3D%3D--7268c2bbdf6f9d714be4207b2a6fd346525d7756; path=/; HttpOnly | |
| 211 | + Content-Type: | |
| 212 | + - application/xml; charset=utf-8 | |
| 213 | + Cache-Control: | |
| 214 | + - private, max-age=0, must-revalidate | |
| 215 | + Connection: | |
| 216 | + - Keep-Alive | |
| 217 | + X-Runtime: | |
| 218 | + - "102" | |
| 219 | + Etag: | |
| 220 | + - "\"6cf98e7e9708e9d7badfffd9accdc061\"" | |
| 221 | + Date: | |
| 222 | + - Tue, 18 Mar 2014 13:53:31 GMT | |
| 223 | + body: | |
| 224 | + string: | | |
| 225 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 226 | + <question> | |
| 227 | + <active type="boolean">true</active> | |
| 228 | + <choices-count type="integer">3</choices-count> | |
| 229 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 230 | + <creator-id type="integer">4</creator-id> | |
| 231 | + <id type="integer">3</id> | |
| 232 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 233 | + <information nil="true"></information> | |
| 234 | + <it-should-autoactivate-ideas type="boolean">true</it-should-autoactivate-ideas> | |
| 235 | + <local-identifier>1</local-identifier> | |
| 236 | + <name>Q1</name> | |
| 237 | + <prompts-count type="integer">2</prompts-count> | |
| 238 | + <show-results type="boolean">true</show-results> | |
| 239 | + <site-id type="integer">1</site-id> | |
| 240 | + <tracking nil="true"></tracking> | |
| 241 | + <updated-at type="datetime">2014-03-18T13:53:30Z</updated-at> | |
| 242 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 243 | + <version type="integer">6</version> | |
| 244 | + <votes-count type="integer">1</votes-count> | |
| 245 | + <item-count type="integer">3</item-count> | |
| 246 | + </question> | |
| 247 | + | |
| 248 | + http_version: | |
| 249 | + recorded_at: Tue, 18 Mar 2014 13:53:31 GMT | |
| 250 | +- request: | |
| 251 | + method: get | |
| 252 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 253 | + body: | |
| 254 | + string: "" | |
| 255 | + headers: | |
| 256 | + Accept: | |
| 257 | + - application/xml | |
| 258 | + response: | |
| 259 | + status: | |
| 260 | + code: 200 | |
| 261 | + message: "OK " | |
| 262 | + headers: | |
| 263 | + Server: | |
| 264 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 265 | + Content-Length: | |
| 266 | + - "1164" | |
| 267 | + Set-Cookie: | |
| 268 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIh0vcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw6D3Nlc3Npb25faWQiJTE2Mzk3ZDE2ZTA3ZDI1ZjhmNDAwNDFjMGY4ZDliYTM0--8d386baca8871c626d42619ec7315b5e17ff11b0; path=/; HttpOnly | |
| 269 | + Content-Type: | |
| 270 | + - application/xml; charset=utf-8 | |
| 271 | + Cache-Control: | |
| 272 | + - private, max-age=0, must-revalidate | |
| 273 | + Connection: | |
| 274 | + - Keep-Alive | |
| 275 | + X-Runtime: | |
| 276 | + - "32" | |
| 277 | + Etag: | |
| 278 | + - "\"69f5a8090e05f8f10004245d647cd2dc\"" | |
| 279 | + Date: | |
| 280 | + - Tue, 18 Mar 2014 13:53:31 GMT | |
| 281 | + body: | |
| 282 | + string: | | |
| 283 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 284 | + <choices type="array"> | |
| 285 | + <choice> | |
| 286 | + <active type="boolean">true</active> | |
| 287 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 288 | + <data>New inactive choice</data> | |
| 289 | + <id type="integer">13</id> | |
| 290 | + <losses type="integer">0</losses> | |
| 291 | + <score type="float">66.6666666666667</score> | |
| 292 | + <wins type="integer">1</wins> | |
| 293 | + <user-created type="boolean">false</user-created> | |
| 294 | + </choice> | |
| 295 | + <choice> | |
| 296 | + <active type="boolean">true</active> | |
| 297 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 298 | + <data>Choice 2</data> | |
| 299 | + <id type="integer">12</id> | |
| 300 | + <losses type="integer">0</losses> | |
| 301 | + <score type="float">50.0</score> | |
| 302 | + <wins type="integer">0</wins> | |
| 303 | + <user-created type="boolean">false</user-created> | |
| 304 | + </choice> | |
| 305 | + <choice> | |
| 306 | + <active type="boolean">true</active> | |
| 307 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 308 | + <data>Choice Renamed</data> | |
| 309 | + <id type="integer">11</id> | |
| 310 | + <losses type="integer">1</losses> | |
| 311 | + <score type="float">33.3333333333333</score> | |
| 312 | + <wins type="integer">0</wins> | |
| 313 | + <user-created type="boolean">false</user-created> | |
| 314 | + </choice> | |
| 315 | + </choices> | |
| 316 | + | |
| 317 | + http_version: | |
| 318 | + recorded_at: Tue, 18 Mar 2014 13:53:31 GMT | |
| 319 | +- request: | |
| 320 | + method: get | |
| 321 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 322 | + body: | |
| 323 | + string: "" | |
| 324 | + headers: | |
| 325 | + Accept: | |
| 326 | + - application/xml | |
| 327 | + response: | |
| 328 | + status: | |
| 329 | + code: 200 | |
| 330 | + message: "OK " | |
| 331 | + headers: | |
| 332 | + Server: | |
| 333 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 334 | + Content-Length: | |
| 335 | + - "1164" | |
| 336 | + Set-Cookie: | |
| 337 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIh0vcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw6D3Nlc3Npb25faWQiJTQ2MjBiZDg0NjRkZjU3MjZjYWFlOTIxNzA2MGYxYzUx--96772cc727d52444b69fad3eef54958acd9e3537; path=/; HttpOnly | |
| 338 | + Content-Type: | |
| 339 | + - application/xml; charset=utf-8 | |
| 340 | + Cache-Control: | |
| 341 | + - private, max-age=0, must-revalidate | |
| 342 | + Connection: | |
| 343 | + - Keep-Alive | |
| 344 | + X-Runtime: | |
| 345 | + - "36" | |
| 346 | + Etag: | |
| 347 | + - "\"69f5a8090e05f8f10004245d647cd2dc\"" | |
| 348 | + Date: | |
| 349 | + - Tue, 18 Mar 2014 13:53:31 GMT | |
| 350 | + body: | |
| 351 | + string: | | |
| 352 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 353 | + <choices type="array"> | |
| 354 | + <choice> | |
| 355 | + <active type="boolean">true</active> | |
| 356 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 357 | + <data>New inactive choice</data> | |
| 358 | + <id type="integer">13</id> | |
| 359 | + <losses type="integer">0</losses> | |
| 360 | + <score type="float">66.6666666666667</score> | |
| 361 | + <wins type="integer">1</wins> | |
| 362 | + <user-created type="boolean">false</user-created> | |
| 363 | + </choice> | |
| 364 | + <choice> | |
| 365 | + <active type="boolean">true</active> | |
| 366 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 367 | + <data>Choice 2</data> | |
| 368 | + <id type="integer">12</id> | |
| 369 | + <losses type="integer">0</losses> | |
| 370 | + <score type="float">50.0</score> | |
| 371 | + <wins type="integer">0</wins> | |
| 372 | + <user-created type="boolean">false</user-created> | |
| 373 | + </choice> | |
| 374 | + <choice> | |
| 375 | + <active type="boolean">true</active> | |
| 376 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 377 | + <data>Choice Renamed</data> | |
| 378 | + <id type="integer">11</id> | |
| 379 | + <losses type="integer">1</losses> | |
| 380 | + <score type="float">33.3333333333333</score> | |
| 381 | + <wins type="integer">0</wins> | |
| 382 | + <user-created type="boolean">false</user-created> | |
| 383 | + </choice> | |
| 384 | + </choices> | |
| 385 | + | |
| 386 | + http_version: | |
| 387 | + recorded_at: Tue, 18 Mar 2014 13:53:31 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/pairwise_update_question.yml
0 → 100644
| ... | ... | @@ -0,0 +1,305 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: post | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions.xml | |
| 7 | + body: | |
| 8 | + string: | | |
| 9 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 10 | + <question> | |
| 11 | + <name>Question 1</name> | |
| 12 | + <local-identifier>1</local-identifier> | |
| 13 | + <visitor-identifier>1</visitor-identifier> | |
| 14 | + <ideas>Choice 1 | |
| 15 | + Choice 2</ideas> | |
| 16 | + </question> | |
| 17 | + | |
| 18 | + headers: | |
| 19 | + Accept: | |
| 20 | + - "*/*" | |
| 21 | + Content-Type: | |
| 22 | + - application/xml | |
| 23 | + response: | |
| 24 | + status: | |
| 25 | + code: 200 | |
| 26 | + message: "OK " | |
| 27 | + headers: | |
| 28 | + Server: | |
| 29 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 30 | + Content-Length: | |
| 31 | + - "921" | |
| 32 | + Set-Cookie: | |
| 33 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlNDU1ZTU4YjczNTAwZThkNzE1ODdkZTU2N2FlODg2OWE%3D--dccbf4094db2e7726c7a7bd6d723687c0f94c550; path=/; HttpOnly | |
| 34 | + Content-Type: | |
| 35 | + - application/xml; charset=utf-8 | |
| 36 | + Cache-Control: | |
| 37 | + - private, max-age=0, must-revalidate | |
| 38 | + Connection: | |
| 39 | + - Keep-Alive | |
| 40 | + X-Runtime: | |
| 41 | + - "142" | |
| 42 | + Etag: | |
| 43 | + - "\"e10a4ecad2ee796de647436a5d754335\"" | |
| 44 | + Date: | |
| 45 | + - Tue, 18 Mar 2014 13:53:32 GMT | |
| 46 | + body: | |
| 47 | + string: | | |
| 48 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 49 | + <question> | |
| 50 | + <active type="boolean">false</active> | |
| 51 | + <choices-count type="integer">0</choices-count> | |
| 52 | + <created-at type="datetime">2014-03-18T13:53:31Z</created-at> | |
| 53 | + <creator-id type="integer">4</creator-id> | |
| 54 | + <id type="integer">4</id> | |
| 55 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 56 | + <information nil="true"></information> | |
| 57 | + <it-should-autoactivate-ideas type="boolean">false</it-should-autoactivate-ideas> | |
| 58 | + <local-identifier>1</local-identifier> | |
| 59 | + <name>Question 1</name> | |
| 60 | + <prompts-count type="integer">0</prompts-count> | |
| 61 | + <show-results type="boolean">true</show-results> | |
| 62 | + <site-id type="integer">1</site-id> | |
| 63 | + <tracking nil="true"></tracking> | |
| 64 | + <updated-at type="datetime">2014-03-18T13:53:31Z</updated-at> | |
| 65 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 66 | + <version type="integer">1</version> | |
| 67 | + <votes-count type="integer">0</votes-count> | |
| 68 | + </question> | |
| 69 | + | |
| 70 | + http_version: | |
| 71 | + recorded_at: Tue, 18 Mar 2014 13:53:32 GMT | |
| 72 | +- request: | |
| 73 | + method: put | |
| 74 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/4.xml | |
| 75 | + body: | |
| 76 | + string: | | |
| 77 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 78 | + <question> | |
| 79 | + <prompts-count type="integer">0</prompts-count> | |
| 80 | + <updated-at type="datetime">2014-03-18T13:53:31Z</updated-at> | |
| 81 | + <active type="boolean">true</active> | |
| 82 | + <votes-count type="integer">0</votes-count> | |
| 83 | + <version type="integer">1</version> | |
| 84 | + <it-should-autoactivate-ideas type="boolean">true</it-should-autoactivate-ideas> | |
| 85 | + <information nil="true"></information> | |
| 86 | + <id type="integer">4</id> | |
| 87 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 88 | + <creator-id type="integer">4</creator-id> | |
| 89 | + <tracking nil="true"></tracking> | |
| 90 | + <choices-count type="integer">0</choices-count> | |
| 91 | + <site-id type="integer">1</site-id> | |
| 92 | + <name>Question 1</name> | |
| 93 | + <show-results type="boolean">true</show-results> | |
| 94 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 95 | + <local-identifier>1</local-identifier> | |
| 96 | + <visitor-identifier>1</visitor-identifier> | |
| 97 | + <created-at type="datetime">2014-03-18T13:53:31Z</created-at> | |
| 98 | + <ideas>Choice 1 | |
| 99 | + Choice 2</ideas> | |
| 100 | + </question> | |
| 101 | + | |
| 102 | + headers: | |
| 103 | + Accept: | |
| 104 | + - "*/*" | |
| 105 | + Content-Type: | |
| 106 | + - application/xml | |
| 107 | + response: | |
| 108 | + status: | |
| 109 | + code: 200 | |
| 110 | + message: "OK " | |
| 111 | + headers: | |
| 112 | + Server: | |
| 113 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 114 | + Content-Length: | |
| 115 | + - "1" | |
| 116 | + Set-Cookie: | |
| 117 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlMDQ0YmY1ZGZlMmY1OWUxYTZlM2RkNTM2OTI1MTUwOGM%3D--1038ef2e280bcada953209be557c671d4ac8f9bc; path=/; HttpOnly | |
| 118 | + Content-Type: | |
| 119 | + - application/xml; charset=utf-8 | |
| 120 | + Cache-Control: | |
| 121 | + - no-cache | |
| 122 | + Connection: | |
| 123 | + - Keep-Alive | |
| 124 | + X-Runtime: | |
| 125 | + - "53" | |
| 126 | + Date: | |
| 127 | + - Tue, 18 Mar 2014 13:53:32 GMT | |
| 128 | + body: | |
| 129 | + string: " " | |
| 130 | + http_version: | |
| 131 | + recorded_at: Tue, 18 Mar 2014 13:53:32 GMT | |
| 132 | +- request: | |
| 133 | + method: get | |
| 134 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/4.xml | |
| 135 | + body: | |
| 136 | + string: "" | |
| 137 | + headers: | |
| 138 | + Accept: | |
| 139 | + - application/xml | |
| 140 | + response: | |
| 141 | + status: | |
| 142 | + code: 200 | |
| 143 | + message: "OK " | |
| 144 | + headers: | |
| 145 | + Server: | |
| 146 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 147 | + Content-Length: | |
| 148 | + - "963" | |
| 149 | + Set-Cookie: | |
| 150 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIhUvcXVlc3Rpb25zLzQueG1sOg9zZXNzaW9uX2lkIiVmMTE3MzE0MjZkZWIzMTA0ZDc2OWUyMmUwY2I1ZmJkMw%3D%3D--931b245e8287eeedaf868537dd26d15dac62d12a; path=/; HttpOnly | |
| 151 | + Content-Type: | |
| 152 | + - application/xml; charset=utf-8 | |
| 153 | + Cache-Control: | |
| 154 | + - private, max-age=0, must-revalidate | |
| 155 | + Connection: | |
| 156 | + - Keep-Alive | |
| 157 | + X-Runtime: | |
| 158 | + - "99" | |
| 159 | + Etag: | |
| 160 | + - "\"47502300372faf4e6c7b5e523025c7a6\"" | |
| 161 | + Date: | |
| 162 | + - Tue, 18 Mar 2014 13:53:32 GMT | |
| 163 | + body: | |
| 164 | + string: | | |
| 165 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 166 | + <question> | |
| 167 | + <active type="boolean">true</active> | |
| 168 | + <choices-count type="integer">2</choices-count> | |
| 169 | + <created-at type="datetime">2014-03-18T13:53:31Z</created-at> | |
| 170 | + <creator-id type="integer">4</creator-id> | |
| 171 | + <id type="integer">4</id> | |
| 172 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 173 | + <information nil="true"></information> | |
| 174 | + <it-should-autoactivate-ideas type="boolean">true</it-should-autoactivate-ideas> | |
| 175 | + <local-identifier>1</local-identifier> | |
| 176 | + <name>Question 1</name> | |
| 177 | + <prompts-count type="integer">0</prompts-count> | |
| 178 | + <show-results type="boolean">true</show-results> | |
| 179 | + <site-id type="integer">1</site-id> | |
| 180 | + <tracking nil="true"></tracking> | |
| 181 | + <updated-at type="datetime">2014-03-18T13:53:32Z</updated-at> | |
| 182 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 183 | + <version type="integer">2</version> | |
| 184 | + <votes-count type="integer">0</votes-count> | |
| 185 | + <item-count type="integer">2</item-count> | |
| 186 | + </question> | |
| 187 | + | |
| 188 | + http_version: | |
| 189 | + recorded_at: Tue, 18 Mar 2014 13:53:32 GMT | |
| 190 | +- request: | |
| 191 | + method: put | |
| 192 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/4.xml | |
| 193 | + body: | |
| 194 | + string: | | |
| 195 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 196 | + <question> | |
| 197 | + <prompts-count type="integer">0</prompts-count> | |
| 198 | + <updated-at type="datetime">2014-03-18T13:53:32Z</updated-at> | |
| 199 | + <active type="boolean">true</active> | |
| 200 | + <votes-count type="integer">0</votes-count> | |
| 201 | + <version type="integer">2</version> | |
| 202 | + <it-should-autoactivate-ideas type="boolean">true</it-should-autoactivate-ideas> | |
| 203 | + <id type="integer">4</id> | |
| 204 | + <information nil="true"></information> | |
| 205 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 206 | + <creator-id type="integer">4</creator-id> | |
| 207 | + <item-count type="integer">2</item-count> | |
| 208 | + <tracking nil="true"></tracking> | |
| 209 | + <name>New name</name> | |
| 210 | + <choices-count type="integer">2</choices-count> | |
| 211 | + <site-id type="integer">1</site-id> | |
| 212 | + <show-results type="boolean">true</show-results> | |
| 213 | + <local-identifier>1</local-identifier> | |
| 214 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 215 | + <created-at type="datetime">2014-03-18T13:53:31Z</created-at> | |
| 216 | + </question> | |
| 217 | + | |
| 218 | + headers: | |
| 219 | + Accept: | |
| 220 | + - "*/*" | |
| 221 | + Content-Type: | |
| 222 | + - application/xml | |
| 223 | + response: | |
| 224 | + status: | |
| 225 | + code: 200 | |
| 226 | + message: "OK " | |
| 227 | + headers: | |
| 228 | + Server: | |
| 229 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 230 | + Content-Length: | |
| 231 | + - "1" | |
| 232 | + Set-Cookie: | |
| 233 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlOWQ0MmMyMDU2ZTg2ZmMxNWJiMWJjOGFmZjU0YzEzMGQ%3D--65e0d4ebabdef5ab35424b49d7d3ba053043bec4; path=/; HttpOnly | |
| 234 | + Content-Type: | |
| 235 | + - application/xml; charset=utf-8 | |
| 236 | + Cache-Control: | |
| 237 | + - no-cache | |
| 238 | + Connection: | |
| 239 | + - Keep-Alive | |
| 240 | + X-Runtime: | |
| 241 | + - "45" | |
| 242 | + Date: | |
| 243 | + - Tue, 18 Mar 2014 13:53:32 GMT | |
| 244 | + body: | |
| 245 | + string: " " | |
| 246 | + http_version: | |
| 247 | + recorded_at: Tue, 18 Mar 2014 13:53:32 GMT | |
| 248 | +- request: | |
| 249 | + method: get | |
| 250 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/4.xml | |
| 251 | + body: | |
| 252 | + string: "" | |
| 253 | + headers: | |
| 254 | + Accept: | |
| 255 | + - application/xml | |
| 256 | + response: | |
| 257 | + status: | |
| 258 | + code: 200 | |
| 259 | + message: "OK " | |
| 260 | + headers: | |
| 261 | + Server: | |
| 262 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 263 | + Content-Length: | |
| 264 | + - "961" | |
| 265 | + Set-Cookie: | |
| 266 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIhUvcXVlc3Rpb25zLzQueG1sOg9zZXNzaW9uX2lkIiVmY2M2YmRkYzIyN2Y4NjdjODlkMzIyMGZjZDEwZWFiZA%3D%3D--69aae7ad54982192c7c145ab10d9d31f2f76e85a; path=/; HttpOnly | |
| 267 | + Content-Type: | |
| 268 | + - application/xml; charset=utf-8 | |
| 269 | + Cache-Control: | |
| 270 | + - private, max-age=0, must-revalidate | |
| 271 | + Connection: | |
| 272 | + - Keep-Alive | |
| 273 | + X-Runtime: | |
| 274 | + - "36" | |
| 275 | + Etag: | |
| 276 | + - "\"0fee6a1f73a2c0d5bceb2e041fcb913d\"" | |
| 277 | + Date: | |
| 278 | + - Tue, 18 Mar 2014 13:53:32 GMT | |
| 279 | + body: | |
| 280 | + string: | | |
| 281 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 282 | + <question> | |
| 283 | + <active type="boolean">true</active> | |
| 284 | + <choices-count type="integer">2</choices-count> | |
| 285 | + <created-at type="datetime">2014-03-18T13:53:31Z</created-at> | |
| 286 | + <creator-id type="integer">4</creator-id> | |
| 287 | + <id type="integer">4</id> | |
| 288 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 289 | + <information nil="true"></information> | |
| 290 | + <it-should-autoactivate-ideas type="boolean">true</it-should-autoactivate-ideas> | |
| 291 | + <local-identifier>1</local-identifier> | |
| 292 | + <name>New name</name> | |
| 293 | + <prompts-count type="integer">0</prompts-count> | |
| 294 | + <show-results type="boolean">true</show-results> | |
| 295 | + <site-id type="integer">1</site-id> | |
| 296 | + <tracking nil="true"></tracking> | |
| 297 | + <updated-at type="datetime">2014-03-18T13:53:32Z</updated-at> | |
| 298 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 299 | + <version type="integer">3</version> | |
| 300 | + <votes-count type="integer">0</votes-count> | |
| 301 | + <item-count type="integer">2</item-count> | |
| 302 | + </question> | |
| 303 | + | |
| 304 | + http_version: | |
| 305 | + recorded_at: Tue, 18 Mar 2014 13:53:32 GMT | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/question_contributors.yml
0 → 100644
| ... | ... | @@ -0,0 +1,180 @@ |
| 1 | +--- | |
| 2 | +http_interactions: | |
| 3 | +- request: | |
| 4 | + method: get | |
| 5 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml | |
| 6 | + body: | |
| 7 | + string: "" | |
| 8 | + headers: | |
| 9 | + Accept: | |
| 10 | + - application/xml | |
| 11 | + response: | |
| 12 | + status: | |
| 13 | + code: 200 | |
| 14 | + message: "OK " | |
| 15 | + headers: | |
| 16 | + Cache-Control: | |
| 17 | + - private, max-age=0, must-revalidate | |
| 18 | + Server: | |
| 19 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 20 | + X-Runtime: | |
| 21 | + - "34" | |
| 22 | + Etag: | |
| 23 | + - "\"39313ba95b65cb4e2d34f30b0a5bd2f8\"" | |
| 24 | + Content-Type: | |
| 25 | + - application/xml; charset=utf-8 | |
| 26 | + Content-Length: | |
| 27 | + - "955" | |
| 28 | + Set-Cookie: | |
| 29 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIhUvcXVlc3Rpb25zLzMueG1sOg9zZXNzaW9uX2lkIiVjNDJlNjkyMGMxOWVkYWYxNTMzMTI2YTZmNjIyODA1NQ%3D%3D--94c39b83716120a25177673b0a21d788dd4af36c; path=/; HttpOnly | |
| 30 | + Date: | |
| 31 | + - Wed, 19 Mar 2014 18:46:05 GMT | |
| 32 | + Connection: | |
| 33 | + - Keep-Alive | |
| 34 | + body: | |
| 35 | + string: | | |
| 36 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 37 | + <question> | |
| 38 | + <active type="boolean">true</active> | |
| 39 | + <choices-count type="integer">9</choices-count> | |
| 40 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 41 | + <creator-id type="integer">4</creator-id> | |
| 42 | + <id type="integer">3</id> | |
| 43 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 44 | + <information nil="true"></information> | |
| 45 | + <it-should-autoactivate-ideas type="boolean">true</it-should-autoactivate-ideas> | |
| 46 | + <local-identifier>1</local-identifier> | |
| 47 | + <name>Q1</name> | |
| 48 | + <prompts-count type="integer">2</prompts-count> | |
| 49 | + <show-results type="boolean">true</show-results> | |
| 50 | + <site-id type="integer">1</site-id> | |
| 51 | + <tracking nil="true"></tracking> | |
| 52 | + <updated-at type="datetime">2014-03-18T13:53:30Z</updated-at> | |
| 53 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 54 | + <version type="integer">6</version> | |
| 55 | + <votes-count type="integer">1</votes-count> | |
| 56 | + <item-count type="integer">9</item-count> | |
| 57 | + </question> | |
| 58 | + | |
| 59 | + http_version: | |
| 60 | + recorded_at: Wed, 19 Mar 2014 18:46:05 GMT | |
| 61 | +- request: | |
| 62 | + method: post | |
| 63 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 64 | + body: | |
| 65 | + string: | | |
| 66 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 67 | + <choice> | |
| 68 | + <local-identifier>1</local-identifier> | |
| 69 | + <data>New Choice</data> | |
| 70 | + <visitor-identifier>John Travolta</visitor-identifier> | |
| 71 | + </choice> | |
| 72 | + | |
| 73 | + headers: | |
| 74 | + Content-Type: | |
| 75 | + - application/xml | |
| 76 | + Accept: | |
| 77 | + - "*/*" | |
| 78 | + response: | |
| 79 | + status: | |
| 80 | + code: 201 | |
| 81 | + message: "Created " | |
| 82 | + headers: | |
| 83 | + Cache-Control: | |
| 84 | + - no-cache | |
| 85 | + Server: | |
| 86 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 87 | + X-Runtime: | |
| 88 | + - "157" | |
| 89 | + Content-Type: | |
| 90 | + - application/xml; charset=utf-8 | |
| 91 | + Content-Length: | |
| 92 | + - "1039" | |
| 93 | + Set-Cookie: | |
| 94 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlM2FhODAxMDFkZmUwZDJmMTgyYjNkNGZjMzEzOTQ0ZTM%3D--0cde22913ec32bc420cafc0e60a84bfd45878c00; path=/; HttpOnly | |
| 95 | + Date: | |
| 96 | + - Wed, 19 Mar 2014 18:46:05 GMT | |
| 97 | + Location: | |
| 98 | + - http://localhost:3030/questions/3/choices/40 | |
| 99 | + Connection: | |
| 100 | + - Keep-Alive | |
| 101 | + body: | |
| 102 | + string: | | |
| 103 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 104 | + <choice> | |
| 105 | + <active type="boolean">true</active> | |
| 106 | + <created-at type="datetime">2014-03-19T18:46:05Z</created-at> | |
| 107 | + <creator-id type="integer">5</creator-id> | |
| 108 | + <data>New Choice</data> | |
| 109 | + <id type="integer">40</id> | |
| 110 | + <item-id type="integer" nil="true"></item-id> | |
| 111 | + <local-identifier>1</local-identifier> | |
| 112 | + <losses type="integer">0</losses> | |
| 113 | + <position type="integer" nil="true"></position> | |
| 114 | + <prompt-id type="integer" nil="true"></prompt-id> | |
| 115 | + <prompts-count type="integer">0</prompts-count> | |
| 116 | + <prompts-on-the-left-count type="integer">0</prompts-on-the-left-count> | |
| 117 | + <prompts-on-the-right-count type="integer">0</prompts-on-the-right-count> | |
| 118 | + <question-id type="integer">3</question-id> | |
| 119 | + <ratings type="integer" nil="true"></ratings> | |
| 120 | + <request-id type="integer" nil="true"></request-id> | |
| 121 | + <score type="float">50.0</score> | |
| 122 | + <tracking nil="true"></tracking> | |
| 123 | + <updated-at type="datetime">2014-03-19T18:46:05Z</updated-at> | |
| 124 | + <version type="integer">1</version> | |
| 125 | + <wins type="integer">0</wins> | |
| 126 | + </choice> | |
| 127 | + | |
| 128 | + http_version: | |
| 129 | + recorded_at: Wed, 19 Mar 2014 18:46:05 GMT | |
| 130 | +- request: | |
| 131 | + method: get | |
| 132 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/visitors.xml?ideas_count=1&page=1&question_id=3 | |
| 133 | + body: | |
| 134 | + string: "" | |
| 135 | + headers: | |
| 136 | + Accept: | |
| 137 | + - application/xml | |
| 138 | + response: | |
| 139 | + status: | |
| 140 | + code: 200 | |
| 141 | + message: "OK " | |
| 142 | + headers: | |
| 143 | + Cache-Control: | |
| 144 | + - private, max-age=0, must-revalidate | |
| 145 | + Server: | |
| 146 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 147 | + X-Runtime: | |
| 148 | + - "107" | |
| 149 | + Etag: | |
| 150 | + - "\"5252e9c48a1957fab7084271c0aed768\"" | |
| 151 | + Content-Type: | |
| 152 | + - application/xml; charset=utf-8 | |
| 153 | + Content-Length: | |
| 154 | + - "527" | |
| 155 | + Set-Cookie: | |
| 156 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIjUvdmlzaXRvcnMueG1sP2lkZWFzX2NvdW50PTEmcGFnZT0xJnF1ZXN0aW9uX2lkPTM6D3Nlc3Npb25faWQiJTNhMzQyOTUyMzY0ZWE4MjA0MzlhNmZjOTY4M2Y5MGRk--215ec52c7edd5d155e2c6cb59c37aadea69c0d65; path=/; HttpOnly | |
| 157 | + Date: | |
| 158 | + - Wed, 19 Mar 2014 18:46:06 GMT | |
| 159 | + Connection: | |
| 160 | + - Keep-Alive | |
| 161 | + body: | |
| 162 | + string: | | |
| 163 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 164 | + <visitors type="array"> | |
| 165 | + <visitor> | |
| 166 | + <activated type="boolean" nil="true"></activated> | |
| 167 | + <created-at type="datetime">2014-03-18T13:48:45Z</created-at> | |
| 168 | + <id type="integer">5</id> | |
| 169 | + <ideas-count type="">7</ideas-count> | |
| 170 | + <identifier>John Travolta</identifier> | |
| 171 | + <site-id type="integer">1</site-id> | |
| 172 | + <tracking nil="true"></tracking> | |
| 173 | + <updated-at type="datetime">2014-03-18T13:48:45Z</updated-at> | |
| 174 | + <user-id type="integer" nil="true"></user-id> | |
| 175 | + </visitor> | |
| 176 | + </visitors> | |
| 177 | + | |
| 178 | + http_version: | |
| 179 | + recorded_at: Wed, 19 Mar 2014 18:46:06 GMT | |
| 180 | +recorded_with: VCR 2.8.0 | ... | ... |
plugins/pairwise/test/fixtures/vcr_cassettes/record_choice_creator.yml
0 → 100644
| ... | ... | @@ -0,0 +1,357 @@ |
| 1 | +--- | |
| 2 | +recorded_with: VCR 2.8.0 | |
| 3 | +http_interactions: | |
| 4 | +- request: | |
| 5 | + method: get | |
| 6 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 7 | + body: | |
| 8 | + string: "" | |
| 9 | + headers: | |
| 10 | + Accept: | |
| 11 | + - application/xml | |
| 12 | + response: | |
| 13 | + status: | |
| 14 | + code: 200 | |
| 15 | + message: "OK " | |
| 16 | + headers: | |
| 17 | + X-Runtime: | |
| 18 | + - "35" | |
| 19 | + Content-Type: | |
| 20 | + - application/xml; charset=utf-8 | |
| 21 | + Connection: | |
| 22 | + - Keep-Alive | |
| 23 | + Etag: | |
| 24 | + - "\"4b2d620734a664b36d31db9fcd8e4297\"" | |
| 25 | + Server: | |
| 26 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 27 | + Content-Length: | |
| 28 | + - "1172" | |
| 29 | + Set-Cookie: | |
| 30 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIh0vcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw6D3Nlc3Npb25faWQiJTM4N2YwYTliMDFhODJhY2ZjOGRjM2E0ZmQ2ZjQwMWIy--fae08f96d043b11de376a04f238f7b8c1f0f3c3f; path=/; HttpOnly | |
| 31 | + Cache-Control: | |
| 32 | + - private, max-age=0, must-revalidate | |
| 33 | + Date: | |
| 34 | + - Tue, 18 Mar 2014 14:00:50 GMT | |
| 35 | + body: | |
| 36 | + string: | | |
| 37 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 38 | + <choices type="array"> | |
| 39 | + <choice> | |
| 40 | + <active type="boolean">true</active> | |
| 41 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 42 | + <data>New inactive choice Changes</data> | |
| 43 | + <id type="integer">13</id> | |
| 44 | + <losses type="integer">0</losses> | |
| 45 | + <score type="float">66.6666666666667</score> | |
| 46 | + <wins type="integer">1</wins> | |
| 47 | + <user-created type="boolean">false</user-created> | |
| 48 | + </choice> | |
| 49 | + <choice> | |
| 50 | + <active type="boolean">true</active> | |
| 51 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 52 | + <data>Choice 2</data> | |
| 53 | + <id type="integer">12</id> | |
| 54 | + <losses type="integer">0</losses> | |
| 55 | + <score type="float">50.0</score> | |
| 56 | + <wins type="integer">0</wins> | |
| 57 | + <user-created type="boolean">false</user-created> | |
| 58 | + </choice> | |
| 59 | + <choice> | |
| 60 | + <active type="boolean">true</active> | |
| 61 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 62 | + <data>Choice Renamed</data> | |
| 63 | + <id type="integer">11</id> | |
| 64 | + <losses type="integer">1</losses> | |
| 65 | + <score type="float">33.3333333333333</score> | |
| 66 | + <wins type="integer">0</wins> | |
| 67 | + <user-created type="boolean">false</user-created> | |
| 68 | + </choice> | |
| 69 | + </choices> | |
| 70 | + | |
| 71 | + http_version: | |
| 72 | + recorded_at: Tue, 18 Mar 2014 14:00:50 GMT | |
| 73 | +- request: | |
| 74 | + method: get | |
| 75 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3.xml | |
| 76 | + body: | |
| 77 | + string: "" | |
| 78 | + headers: | |
| 79 | + Accept: | |
| 80 | + - application/xml | |
| 81 | + response: | |
| 82 | + status: | |
| 83 | + code: 200 | |
| 84 | + message: "OK " | |
| 85 | + headers: | |
| 86 | + X-Runtime: | |
| 87 | + - "32" | |
| 88 | + Content-Type: | |
| 89 | + - application/xml; charset=utf-8 | |
| 90 | + Connection: | |
| 91 | + - Keep-Alive | |
| 92 | + Etag: | |
| 93 | + - "\"6cf98e7e9708e9d7badfffd9accdc061\"" | |
| 94 | + Server: | |
| 95 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 96 | + Content-Length: | |
| 97 | + - "955" | |
| 98 | + Set-Cookie: | |
| 99 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIhUvcXVlc3Rpb25zLzMueG1sOg9zZXNzaW9uX2lkIiVjMmMyNjI3ZDEwYTVkZWY2YTM2ZWMxM2U5YmFiMmIzNg%3D%3D--eb2d4a800975312d07663ff97eff315d887e65b6; path=/; HttpOnly | |
| 100 | + Cache-Control: | |
| 101 | + - private, max-age=0, must-revalidate | |
| 102 | + Date: | |
| 103 | + - Tue, 18 Mar 2014 14:00:51 GMT | |
| 104 | + body: | |
| 105 | + string: | | |
| 106 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 107 | + <question> | |
| 108 | + <active type="boolean">true</active> | |
| 109 | + <choices-count type="integer">3</choices-count> | |
| 110 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 111 | + <creator-id type="integer">4</creator-id> | |
| 112 | + <id type="integer">3</id> | |
| 113 | + <inactive-choices-count type="integer">0</inactive-choices-count> | |
| 114 | + <information nil="true"></information> | |
| 115 | + <it-should-autoactivate-ideas type="boolean">true</it-should-autoactivate-ideas> | |
| 116 | + <local-identifier>1</local-identifier> | |
| 117 | + <name>Q1</name> | |
| 118 | + <prompts-count type="integer">2</prompts-count> | |
| 119 | + <show-results type="boolean">true</show-results> | |
| 120 | + <site-id type="integer">1</site-id> | |
| 121 | + <tracking nil="true"></tracking> | |
| 122 | + <updated-at type="datetime">2014-03-18T13:53:30Z</updated-at> | |
| 123 | + <uses-catchup type="boolean">true</uses-catchup> | |
| 124 | + <version type="integer">6</version> | |
| 125 | + <votes-count type="integer">1</votes-count> | |
| 126 | + <item-count type="integer">3</item-count> | |
| 127 | + </question> | |
| 128 | + | |
| 129 | + http_version: | |
| 130 | + recorded_at: Tue, 18 Mar 2014 14:00:51 GMT | |
| 131 | +- request: | |
| 132 | + method: post | |
| 133 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml | |
| 134 | + body: | |
| 135 | + string: | | |
| 136 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 137 | + <choice> | |
| 138 | + <local-identifier>1</local-identifier> | |
| 139 | + <data>New Choice</data> | |
| 140 | + <visitor-identifier>John Travolta</visitor-identifier> | |
| 141 | + </choice> | |
| 142 | + | |
| 143 | + headers: | |
| 144 | + Accept: | |
| 145 | + - "*/*" | |
| 146 | + Content-Type: | |
| 147 | + - application/xml | |
| 148 | + response: | |
| 149 | + status: | |
| 150 | + code: 201 | |
| 151 | + message: "Created " | |
| 152 | + headers: | |
| 153 | + X-Runtime: | |
| 154 | + - "159" | |
| 155 | + Content-Type: | |
| 156 | + - application/xml; charset=utf-8 | |
| 157 | + Connection: | |
| 158 | + - Keep-Alive | |
| 159 | + Server: | |
| 160 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 161 | + Content-Length: | |
| 162 | + - "1039" | |
| 163 | + Set-Cookie: | |
| 164 | + - _rebirth_session_key=BAh7BjoPc2Vzc2lvbl9pZCIlMGQzMGVkYWY2NjFmYmQ3YWE4Mzg1NGU5NzNkNzhkYmU%3D--5d712da68957bb74bf36d1b58e7b298953114fbe; path=/; HttpOnly | |
| 165 | + Cache-Control: | |
| 166 | + - no-cache | |
| 167 | + Date: | |
| 168 | + - Tue, 18 Mar 2014 14:00:51 GMT | |
| 169 | + Location: | |
| 170 | + - http://localhost:3030/questions/3/choices/16 | |
| 171 | + body: | |
| 172 | + string: | | |
| 173 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 174 | + <choice> | |
| 175 | + <active type="boolean">true</active> | |
| 176 | + <created-at type="datetime">2014-03-18T14:00:51Z</created-at> | |
| 177 | + <creator-id type="integer">5</creator-id> | |
| 178 | + <data>New Choice</data> | |
| 179 | + <id type="integer">16</id> | |
| 180 | + <item-id type="integer" nil="true"></item-id> | |
| 181 | + <local-identifier>1</local-identifier> | |
| 182 | + <losses type="integer">0</losses> | |
| 183 | + <position type="integer" nil="true"></position> | |
| 184 | + <prompt-id type="integer" nil="true"></prompt-id> | |
| 185 | + <prompts-count type="integer">0</prompts-count> | |
| 186 | + <prompts-on-the-left-count type="integer">0</prompts-on-the-left-count> | |
| 187 | + <prompts-on-the-right-count type="integer">0</prompts-on-the-right-count> | |
| 188 | + <question-id type="integer">3</question-id> | |
| 189 | + <ratings type="integer" nil="true"></ratings> | |
| 190 | + <request-id type="integer" nil="true"></request-id> | |
| 191 | + <score type="float">50.0</score> | |
| 192 | + <tracking nil="true"></tracking> | |
| 193 | + <updated-at type="datetime">2014-03-18T14:00:51Z</updated-at> | |
| 194 | + <version type="integer">1</version> | |
| 195 | + <wins type="integer">0</wins> | |
| 196 | + </choice> | |
| 197 | + | |
| 198 | + http_version: | |
| 199 | + recorded_at: Tue, 18 Mar 2014 14:00:51 GMT | |
| 200 | +- request: | |
| 201 | + method: get | |
| 202 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml?include_inactive=true | |
| 203 | + body: | |
| 204 | + string: "" | |
| 205 | + headers: | |
| 206 | + Accept: | |
| 207 | + - application/xml | |
| 208 | + response: | |
| 209 | + status: | |
| 210 | + code: 200 | |
| 211 | + message: "OK " | |
| 212 | + headers: | |
| 213 | + X-Runtime: | |
| 214 | + - "43" | |
| 215 | + Content-Type: | |
| 216 | + - application/xml; charset=utf-8 | |
| 217 | + Connection: | |
| 218 | + - Keep-Alive | |
| 219 | + Etag: | |
| 220 | + - "\"eeca0792e33b8baef6a91a806cbe6a37\"" | |
| 221 | + Server: | |
| 222 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 223 | + Content-Length: | |
| 224 | + - "1523" | |
| 225 | + Set-Cookie: | |
| 226 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIjMvcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw%2FaW5jbHVkZV9pbmFjdGl2ZT10cnVlOg9zZXNzaW9uX2lkIiUwZDZjOWVhZWRjN2I0ZDRmZThjYTVhMmU4M2NmNWM3ZQ%3D%3D--5e669c225a5fe59e510aa3fab3271452f3339e98; path=/; HttpOnly | |
| 227 | + Cache-Control: | |
| 228 | + - private, max-age=0, must-revalidate | |
| 229 | + Date: | |
| 230 | + - Tue, 18 Mar 2014 14:00:51 GMT | |
| 231 | + body: | |
| 232 | + string: | | |
| 233 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 234 | + <choices type="array"> | |
| 235 | + <choice> | |
| 236 | + <active type="boolean">true</active> | |
| 237 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 238 | + <data>New inactive choice Changes</data> | |
| 239 | + <id type="integer">13</id> | |
| 240 | + <losses type="integer">0</losses> | |
| 241 | + <score type="float">66.6666666666667</score> | |
| 242 | + <wins type="integer">1</wins> | |
| 243 | + <user-created type="boolean">false</user-created> | |
| 244 | + </choice> | |
| 245 | + <choice> | |
| 246 | + <active type="boolean">true</active> | |
| 247 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 248 | + <data>Choice 2</data> | |
| 249 | + <id type="integer">12</id> | |
| 250 | + <losses type="integer">0</losses> | |
| 251 | + <score type="float">50.0</score> | |
| 252 | + <wins type="integer">0</wins> | |
| 253 | + <user-created type="boolean">false</user-created> | |
| 254 | + </choice> | |
| 255 | + <choice> | |
| 256 | + <active type="boolean">true</active> | |
| 257 | + <created-at type="datetime">2014-03-18T14:00:51Z</created-at> | |
| 258 | + <data>New Choice</data> | |
| 259 | + <id type="integer">16</id> | |
| 260 | + <losses type="integer">0</losses> | |
| 261 | + <score type="float">50.0</score> | |
| 262 | + <wins type="integer">0</wins> | |
| 263 | + <user-created type="boolean">true</user-created> | |
| 264 | + </choice> | |
| 265 | + <choice> | |
| 266 | + <active type="boolean">true</active> | |
| 267 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 268 | + <data>Choice Renamed</data> | |
| 269 | + <id type="integer">11</id> | |
| 270 | + <losses type="integer">1</losses> | |
| 271 | + <score type="float">33.3333333333333</score> | |
| 272 | + <wins type="integer">0</wins> | |
| 273 | + <user-created type="boolean">false</user-created> | |
| 274 | + </choice> | |
| 275 | + </choices> | |
| 276 | + | |
| 277 | + http_version: | |
| 278 | + recorded_at: Tue, 18 Mar 2014 14:00:51 GMT | |
| 279 | +- request: | |
| 280 | + method: get | |
| 281 | + uri: http://abner.oliveira%40serpro.gov.br:serpro@localhost:3030/questions/3/choices.xml?include_inactive=true | |
| 282 | + body: | |
| 283 | + string: "" | |
| 284 | + headers: | |
| 285 | + Accept: | |
| 286 | + - application/xml | |
| 287 | + response: | |
| 288 | + status: | |
| 289 | + code: 200 | |
| 290 | + message: "OK " | |
| 291 | + headers: | |
| 292 | + X-Runtime: | |
| 293 | + - "40" | |
| 294 | + Content-Type: | |
| 295 | + - application/xml; charset=utf-8 | |
| 296 | + Connection: | |
| 297 | + - Keep-Alive | |
| 298 | + Etag: | |
| 299 | + - "\"eeca0792e33b8baef6a91a806cbe6a37\"" | |
| 300 | + Server: | |
| 301 | + - WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) | |
| 302 | + Content-Length: | |
| 303 | + - "1523" | |
| 304 | + Set-Cookie: | |
| 305 | + - _rebirth_session_key=BAh7BzoOcmV0dXJuX3RvIjMvcXVlc3Rpb25zLzMvY2hvaWNlcy54bWw%2FaW5jbHVkZV9pbmFjdGl2ZT10cnVlOg9zZXNzaW9uX2lkIiVlMmNkNjUwNGUyMTA0Y2JhODQwMGQ4Yzc1NmYwNGI1Ng%3D%3D--0f22b4c9da5493e370bbcfaa2d5510b050652705; path=/; HttpOnly | |
| 306 | + Cache-Control: | |
| 307 | + - private, max-age=0, must-revalidate | |
| 308 | + Date: | |
| 309 | + - Tue, 18 Mar 2014 14:00:51 GMT | |
| 310 | + body: | |
| 311 | + string: | | |
| 312 | + <?xml version="1.0" encoding="UTF-8"?> | |
| 313 | + <choices type="array"> | |
| 314 | + <choice> | |
| 315 | + <active type="boolean">true</active> | |
| 316 | + <created-at type="datetime">2014-03-18T13:53:24Z</created-at> | |
| 317 | + <data>New inactive choice Changes</data> | |
| 318 | + <id type="integer">13</id> | |
| 319 | + <losses type="integer">0</losses> | |
| 320 | + <score type="float">66.6666666666667</score> | |
| 321 | + <wins type="integer">1</wins> | |
| 322 | + <user-created type="boolean">false</user-created> | |
| 323 | + </choice> | |
| 324 | + <choice> | |
| 325 | + <active type="boolean">true</active> | |
| 326 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 327 | + <data>Choice 2</data> | |
| 328 | + <id type="integer">12</id> | |
| 329 | + <losses type="integer">0</losses> | |
| 330 | + <score type="float">50.0</score> | |
| 331 | + <wins type="integer">0</wins> | |
| 332 | + <user-created type="boolean">false</user-created> | |
| 333 | + </choice> | |
| 334 | + <choice> | |
| 335 | + <active type="boolean">true</active> | |
| 336 | + <created-at type="datetime">2014-03-18T14:00:51Z</created-at> | |
| 337 | + <data>New Choice</data> | |
| 338 | + <id type="integer">16</id> | |
| 339 | + <losses type="integer">0</losses> | |
| 340 | + <score type="float">50.0</score> | |
| 341 | + <wins type="integer">0</wins> | |
| 342 | + <user-created type="boolean">true</user-created> | |
| 343 | + </choice> | |
| 344 | + <choice> | |
| 345 | + <active type="boolean">true</active> | |
| 346 | + <created-at type="datetime">2014-03-18T13:53:23Z</created-at> | |
| 347 | + <data>Choice Renamed</data> | |
| 348 | + <id type="integer">11</id> | |
| 349 | + <losses type="integer">1</losses> | |
| 350 | + <score type="float">33.3333333333333</score> | |
| 351 | + <wins type="integer">0</wins> | |
| 352 | + <user-created type="boolean">false</user-created> | |
| 353 | + </choice> | |
| 354 | + </choices> | |
| 355 | + | |
| 356 | + http_version: | |
| 357 | + recorded_at: Tue, 18 Mar 2014 14:00:51 GMT | ... | ... |
plugins/pairwise/test/functional/profile/pairwise_plugin_profile_controller_test.rb
0 → 100644
| ... | ... | @@ -0,0 +1,238 @@ |
| 1 | +require 'test_helper' | |
| 2 | + | |
| 3 | +require "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/pairwise_content_fixtures" | |
| 4 | + | |
| 5 | +class PairwisePluginProfileControllerTest < ActionController::TestCase | |
| 6 | + | |
| 7 | + def pairwise_env_settings | |
| 8 | + { :api_host => "http://localhost:3030/", | |
| 9 | + :username => "abner.oliveira@serpro.gov.br", | |
| 10 | + :password => "serpro" | |
| 11 | + } | |
| 12 | + end | |
| 13 | + | |
| 14 | + def setup | |
| 15 | + @environment = Environment.default | |
| 16 | + | |
| 17 | + @pairwise_client = Pairwise::Client.build(1, pairwise_env_settings) | |
| 18 | + @controller = PairwisePluginProfileController.new | |
| 19 | + @request = ActionController::TestRequest.new | |
| 20 | + @response = ActionController::TestResponse.new | |
| 21 | + | |
| 22 | + @profile = fast_create(Community, :environment_id => @environment.id) | |
| 23 | + @question = PairwiseContentFixtures.pairwise_question_with_prompt | |
| 24 | + @user = create_user('testinguser').person | |
| 25 | + @profile.add_admin(@user) | |
| 26 | + @content = PairwiseContentFixtures.pairwise_content | |
| 27 | + | |
| 28 | + @content.expects(:new_record?).returns(true).at_least_once | |
| 29 | + @content.expects(:valid?).returns(true).at_least_once | |
| 30 | + @content.expects(:send_question_to_service).returns(true).at_least_once | |
| 31 | + @profile.articles << @content | |
| 32 | + end | |
| 33 | + | |
| 34 | + should 'get a first prompt' do | |
| 35 | + login_as(@user.user.login) | |
| 36 | + PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content) | |
| 37 | + @content.expects(:question_with_prompt_for_visitor).with(@user.identifier, nil).returns(@question) | |
| 38 | + get :prompt, | |
| 39 | + :profile => @profile.identifier, | |
| 40 | + :id => @content.id, | |
| 41 | + :question_id => @question.id | |
| 42 | + assert_not_nil assigns(:pairwise_content) | |
| 43 | + assert_match /#{@question.name}/, @response.body | |
| 44 | + assert_match /#{@question.prompt.left_choice_text}/, @response.body | |
| 45 | + assert_match /#{@question.prompt.right_choice_text}/, @response.body | |
| 46 | + end | |
| 47 | + | |
| 48 | + should 'get a prompt by a prompt id' do | |
| 49 | + login_as(@user.user.login) | |
| 50 | + PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content) | |
| 51 | + @content.expects(:question_with_prompt_for_visitor).with(@user.identifier, @question.prompt.id.to_s).returns(@question) | |
| 52 | + get :prompt, | |
| 53 | + :profile => @profile.identifier, | |
| 54 | + :id => @content.id, | |
| 55 | + :question_id => @question.id, | |
| 56 | + :prompt_id => @question.prompt.id | |
| 57 | + | |
| 58 | + assert_not_nil assigns(:pairwise_content) | |
| 59 | + | |
| 60 | + assert_match /#{@question.name}/, @response.body | |
| 61 | + assert_match /#{@question.prompt.left_choice_text}/, @response.body | |
| 62 | + assert_match /#{@question.prompt.right_choice_text}/, @response.body | |
| 63 | + end | |
| 64 | + | |
| 65 | + should 'register a vote' do | |
| 66 | + login_as(@user.user.login) | |
| 67 | + #next prompt will have id = 33 | |
| 68 | + next_prompt_id = 33 | |
| 69 | + vote = { | |
| 70 | + 'prompt' => { | |
| 71 | + "id" => next_prompt_id, | |
| 72 | + "left_choice_id" => 3, | |
| 73 | + "left_choice_test" => "Option 3", | |
| 74 | + "right_choice_id" => 4, | |
| 75 | + "right_choice_text" => "Option 4" | |
| 76 | + } | |
| 77 | + } | |
| 78 | + @content.expects(:vote_to).with(@question.prompt.id.to_s, 'left', @user.identifier, @question.appearance_id).returns(vote).at_least_once | |
| 79 | + #@content.expects(:question_with_prompt_for_visitor).with(@user.identifier, nil).returns(@question).at_least_once | |
| 80 | + | |
| 81 | + PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content).at_least_once | |
| 82 | + | |
| 83 | + get :choose, | |
| 84 | + :profile => @profile.identifier, | |
| 85 | + :id => @content.id, | |
| 86 | + :question_id => @question.id, | |
| 87 | + :prompt_id => @question.prompt.id, | |
| 88 | + :appearance_id => @question.appearance_id, | |
| 89 | + :direction => 'left' | |
| 90 | + assert_response :redirect | |
| 91 | + assert_redirected_to @content.url | |
| 92 | + end | |
| 93 | + | |
| 94 | + should 'show new ideas elements when new ideas were allowed' do | |
| 95 | + login_as(@user.user.login) | |
| 96 | + PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content) | |
| 97 | + get :prompt, | |
| 98 | + :profile => @profile.identifier, | |
| 99 | + :id => @content.id, | |
| 100 | + :question_id => @question.id, | |
| 101 | + :prompt_id => @question.prompt.id | |
| 102 | + assert_not_nil assigns(:pairwise_content) | |
| 103 | + | |
| 104 | + assert_select "div[class='suggestion_form']", 1 | |
| 105 | + assert_select "div#suggestions_box", 1 | |
| 106 | + end | |
| 107 | + | |
| 108 | + should 'not show new ideas elements when new ideas were not allowed' do | |
| 109 | + login_as(@user.user.login) | |
| 110 | + @content.allow_new_ideas = false | |
| 111 | + PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content) | |
| 112 | + get :prompt, | |
| 113 | + :profile => @profile.identifier, | |
| 114 | + :id => @content.id, | |
| 115 | + :question_id => @question.id, | |
| 116 | + :prompt_id => @question.prompt.id | |
| 117 | + assert_not_nil assigns(:pairwise_content) | |
| 118 | + | |
| 119 | + assert_select "div[class='suggestion_form']", 0 | |
| 120 | + assert_select "div#suggestions_box", 0 | |
| 121 | + end | |
| 122 | + | |
| 123 | + should 'skip prompt' do | |
| 124 | + login_as @user.user.login | |
| 125 | + next_prompt_id = 33 | |
| 126 | + next_prompt = { | |
| 127 | + 'prompt' => { | |
| 128 | + "id" => next_prompt_id, | |
| 129 | + "left_choice_id" => 3, | |
| 130 | + "left_choice_test" => "Option 3", | |
| 131 | + "right_choice_id" => 4, | |
| 132 | + "right_choice_text" => "Option 4" | |
| 133 | + } | |
| 134 | + } | |
| 135 | + @content.expects(:skip_prompt).with(@question.prompt.id.to_s, @user.identifier, @question.appearance_id, 'some reason').returns(next_prompt).at_least_once | |
| 136 | + #@content.expects(:question_with_prompt_for_visitor).with(@user.identifier, nil).returns(@question).at_least_once | |
| 137 | + | |
| 138 | + PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content).at_least_once | |
| 139 | + get :skip_prompt, | |
| 140 | + :profile => @profile.identifier, | |
| 141 | + :id => @content.id, | |
| 142 | + :question_id => @question.id, | |
| 143 | + :prompt_id => @question.prompt.id, | |
| 144 | + :appearance_id => @question.appearance_id, | |
| 145 | + :reason => 'some reason' | |
| 146 | + assert_not_nil assigns(:pairwise_content) | |
| 147 | + | |
| 148 | + assert_response :redirect | |
| 149 | + assert_redirected_to @content.url | |
| 150 | + end | |
| 151 | + | |
| 152 | + should 'fail to skip prompt if prompt_id param is missing' do | |
| 153 | + login_as @user.user.login | |
| 154 | + next_prompt_id = 33 | |
| 155 | + next_prompt = { | |
| 156 | + 'prompt' => { | |
| 157 | + "id" => next_prompt_id, | |
| 158 | + "left_choice_id" => 3, | |
| 159 | + "left_choice_test" => "Option 3", | |
| 160 | + "right_choice_id" => 4, | |
| 161 | + "right_choice_text" => "Option 4" | |
| 162 | + } | |
| 163 | + } | |
| 164 | + exception = assert_raises RuntimeError do | |
| 165 | + get :skip_prompt, | |
| 166 | + :profile => @profile.identifier, | |
| 167 | + :id => @content.id, | |
| 168 | + :question_id => @question.id, | |
| 169 | + :appearance_id => @question.appearance_id, | |
| 170 | + :reason => 'some reason' | |
| 171 | + end | |
| 172 | + assert_equal _("Invalid request"), exception.message | |
| 173 | + end | |
| 174 | + | |
| 175 | + should 'fail to skip appearance_id param is missing' do | |
| 176 | + login_as @user.user.login | |
| 177 | + next_prompt_id = 33 | |
| 178 | + next_prompt = { | |
| 179 | + 'prompt' => { | |
| 180 | + "id" => next_prompt_id, | |
| 181 | + "left_choice_id" => 3, | |
| 182 | + "left_choice_test" => "Option 3", | |
| 183 | + "right_choice_id" => 4, | |
| 184 | + "right_choice_text" => "Option 4" | |
| 185 | + } | |
| 186 | + } | |
| 187 | + exception = assert_raises RuntimeError do | |
| 188 | + get :skip_prompt, | |
| 189 | + :profile => @profile.identifier, | |
| 190 | + :id => @content.id, | |
| 191 | + :question_id => @question.id, | |
| 192 | + :prompt_id => @question.prompt.id, | |
| 193 | + :reason => 'some reason' | |
| 194 | + end | |
| 195 | + assert_equal _("Invalid request"), exception.message | |
| 196 | + end | |
| 197 | + | |
| 198 | + should 'show result to non logged user' do | |
| 199 | + @question.expects(:get_choices).returns(PairwiseContentFixtures.choices_with_stats).at_least_once | |
| 200 | + PairwisePlugin::PairwiseContent.any_instance.expects(:question).returns(@question).at_least_once | |
| 201 | + PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content).at_least_once | |
| 202 | + | |
| 203 | + get :result, :profile => @profile.identifier, | |
| 204 | + :id => @content.id, :question_id => @question.id | |
| 205 | + | |
| 206 | + assert_select "div[class='total_votes']", 1 | |
| 207 | + end | |
| 208 | + | |
| 209 | + should 'show result to logged user' do | |
| 210 | + login_as(@user.user.login) | |
| 211 | + @question.expects(:get_choices).returns(PairwiseContentFixtures.choices_with_stats).at_least_once | |
| 212 | + PairwisePlugin::PairwiseContent.any_instance.expects(:question).returns(@question).at_least_once | |
| 213 | + PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content).at_least_once | |
| 214 | + | |
| 215 | + get :result, :profile => @profile.identifier, | |
| 216 | + :id => @content.id, :question_id => @question.id | |
| 217 | + | |
| 218 | + assert_select "div[class='total_votes']", 1 | |
| 219 | + end | |
| 220 | + | |
| 221 | + should 'suggest new idea' do | |
| 222 | + login_as(@user.user.login) | |
| 223 | + | |
| 224 | + PairwisePluginProfileController.any_instance.expects(:find_content).returns(@content).at_least_once | |
| 225 | + @content.expects(:add_new_idea).returns(true).at_least_once | |
| 226 | + | |
| 227 | + post :suggest_idea, :id => @content.id, :profile => @profile.identifier, :idea => {:text => "NEW IDEA"} | |
| 228 | + | |
| 229 | + assert_redirected_to @content.url | |
| 230 | + assert_equal "Thanks for your contributtion!", flash[:notice] | |
| 231 | + end | |
| 232 | + | |
| 233 | + should 'not accept ideas from not logged users' do | |
| 234 | + post :suggest_idea, :id => @content.id, :profile => @profile.identifier, :idea => {:text => "NEW IDEA"} | |
| 235 | + assert_redirected_to @content.url | |
| 236 | + assert_equal "Only logged user could suggest new ideas", flash[:error] | |
| 237 | + end | |
| 238 | +end | ... | ... |
| ... | ... | @@ -0,0 +1,176 @@ |
| 1 | +require "test_helper" | |
| 2 | + | |
| 3 | +require 'vcr' | |
| 4 | + | |
| 5 | +VCR.configure do |c| | |
| 6 | + c.cassette_library_dir = "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/vcr_cassettes" | |
| 7 | + c.hook_into :webmock | |
| 8 | +end | |
| 9 | + | |
| 10 | +class Pairwise::ClientTest < ActiveSupport::TestCase | |
| 11 | + def setup | |
| 12 | + pairwise_env_settings = { :api_host => "http://localhost:3030/", | |
| 13 | + :username => "abner.oliveira@serpro.gov.br", | |
| 14 | + :password => "serpro" | |
| 15 | + } | |
| 16 | + @client = Pairwise::Client.build('1', pairwise_env_settings) | |
| 17 | + @choices = "Choice 1\nChoice 2" | |
| 18 | + | |
| 19 | + VCR.use_cassette('pairwise_create_question') do | |
| 20 | + @question = @client.create_question('Q1', @choices) | |
| 21 | + end | |
| 22 | + | |
| 23 | + end | |
| 24 | + | |
| 25 | + should 'create an new question in pairwise service' do | |
| 26 | + assert_not_nil @question.id | |
| 27 | + end | |
| 28 | + | |
| 29 | + should 'update a question' do | |
| 30 | + VCR.use_cassette('pairwise_update_question') do | |
| 31 | + @question_to_be_changed = @client.create_question('Question 1', @choices) | |
| 32 | + @client.update_question(@question_to_be_changed.id, "New name") | |
| 33 | + assert_equal "New name", @client.find_question_by_id(@question_to_be_changed.id).name | |
| 34 | + end | |
| 35 | + end | |
| 36 | + | |
| 37 | + should "add new choice to a question" do | |
| 38 | + VCR.use_cassette('pairwise_add_new_choice') do | |
| 39 | + assert_equal 2, @question.get_choices.size | |
| 40 | + end | |
| 41 | + end | |
| 42 | + should 'record that an user created the choice' do | |
| 43 | + VCR.use_cassette('record_choice_creator') do | |
| 44 | + assert_equal 3, @question.get_choices.size | |
| 45 | + @client.add_choice(@question.id, 'New Choice', 'John Travolta') | |
| 46 | + assert_equal 4, @question.choices_include_inactive.size | |
| 47 | + created_choice = @question.choices_include_inactive[2] | |
| 48 | + assert_equal true, created_choice.user_created | |
| 49 | + end | |
| 50 | + end | |
| 51 | + | |
| 52 | + should 'update a choice text' do | |
| 53 | + VCR.use_cassette('pairwise_update_choice_text') do | |
| 54 | + choice = @question.get_choice_with_text("Choice 1") | |
| 55 | + assert_not_nil choice | |
| 56 | + @client.update_choice(@question, choice.id, 'Choice Renamed', true) | |
| 57 | + @question_after_change = @client.find_question_by_id(@question.id) | |
| 58 | + assert @question_after_change.has_choice_with_text?("Choice Renamed"), "Choice not found" | |
| 59 | + assert ! @question_after_change.has_choice_with_text?("Choice 1"), "Choice 1 should not exist" | |
| 60 | + end | |
| 61 | + end | |
| 62 | + | |
| 63 | + should 'not allow change choice to a blank value' do | |
| 64 | + VCR.use_cassette('pairwise_blank_value') do | |
| 65 | + choice = @question.get_choice_with_text("Choice 1") | |
| 66 | + assert_not_nil choice | |
| 67 | + exception = assert_raises Pairwise::Error do | |
| 68 | + @client.update_choice(@question, choice.id, '', true) | |
| 69 | + end | |
| 70 | + assert_equal "Empty choice text", exception.message | |
| 71 | + end | |
| 72 | + end | |
| 73 | + | |
| 74 | + | |
| 75 | + should 'retrieve question from service' do | |
| 76 | + VCR.use_cassette('pairwise_retrieve_question') do | |
| 77 | + @question_retrieved = @client.find_question_by_id(@question.id) | |
| 78 | + assert_not_nil @question_retrieved | |
| 79 | + assert_equal @question.id, @question_retrieved.id | |
| 80 | + end | |
| 81 | + end | |
| 82 | + | |
| 83 | + should 'retrieve question with values correct attributes values' do | |
| 84 | + VCR.use_cassette('pairwise_retrieve_correct_values') do | |
| 85 | + @question_retrieved = @client.find_question_by_id(@question.id) | |
| 86 | + assert_equal "Q1", @question_retrieved.name | |
| 87 | + end | |
| 88 | + end | |
| 89 | + | |
| 90 | + should 'retrieve question choices' do | |
| 91 | + VCR.use_cassette('pairwise_retrieve_question_choices') do | |
| 92 | + @question_retrieved = @client.find_question_by_id(@question.id) | |
| 93 | + assert_not_nil @question_retrieved.choices | |
| 94 | + @question_retrieved.choices.each do | choice | | |
| 95 | + assert @choices.include?(choice.data), "Choice #{choice} not found in question retrieved" | |
| 96 | + end | |
| 97 | + end | |
| 98 | + end | |
| 99 | + | |
| 100 | + should 'register votes' do | |
| 101 | + VCR.use_cassette('pairwise_register_votes') do | |
| 102 | + @question = @client.question_with_prompt(@question.id) | |
| 103 | + assert_not_nil @question.prompt | |
| 104 | + vote = @client.vote(@question.id, @question.prompt.id, 'left', 'guest-tester', @question.appearance_id) | |
| 105 | + | |
| 106 | + assert vote.is_a?(Hash) | |
| 107 | + assert_not_nil vote["prompt"], "Next prompt hash expected" | |
| 108 | + assert_not_nil vote["prompt"]["id"], "Next prompt id expected" | |
| 109 | + assert_not_nil vote["prompt"]["question_id"], "question_id expected" | |
| 110 | + assert_not_nil vote["prompt"]["appearance_id"], "appearance_id expected" | |
| 111 | + assert_not_nil vote["prompt"]["left_choice_text"], "left_choice_text expected" | |
| 112 | + assert_not_nil vote["prompt"]["right_choice_text"], "right_choice_text expected" | |
| 113 | + end | |
| 114 | + end | |
| 115 | + | |
| 116 | + should 'not register votes when appearance_id is missing' do | |
| 117 | + VCR.use_cassette('pairwise_not_register_votes') do | |
| 118 | + @question = @client.question_with_prompt(@question.id) | |
| 119 | + assert_not_nil @question.prompt | |
| 120 | + exception = assert_raises Pairwise::Error do | |
| 121 | + @client.vote(@question.id, @question.prompt.id, 'left', 'guest-tester') | |
| 122 | + end | |
| 123 | + assert_equal "Vote not registered. Please check if all the necessary parameters were passed.", exception.message | |
| 124 | + end | |
| 125 | + end | |
| 126 | + | |
| 127 | + should 'approve choice' do | |
| 128 | + VCR.use_cassette('pairwise_approve_choice') do | |
| 129 | + @client.toggle_autoactivate_ideas(@question, false) | |
| 130 | + choice = @client.add_choice(@question.id, 'New inactive choice') | |
| 131 | + assert_equal 1, (@question.choices_include_inactive - @question.choices).size | |
| 132 | + @client.approve_choice(@question, choice.id) | |
| 133 | + assert_equal 0, (@question.choices_include_inactive - @question.choices).size | |
| 134 | + assert_equal 3, @question.choices.size | |
| 135 | + end | |
| 136 | + end | |
| 137 | + | |
| 138 | + should 'update choice' do | |
| 139 | + VCR.use_cassette('pairwise_update_choice') do | |
| 140 | + choice = @question.get_choices.first | |
| 141 | + new_choice_text = choice.data + " Changes" | |
| 142 | + assert_equal true, @client.update_choice(@question, choice.id, choice.data + " Changes", true) | |
| 143 | + assert_equal new_choice_text, @client.find_question_by_id(@question.id).find_choice(choice.id).data | |
| 144 | + end | |
| 145 | + end | |
| 146 | + | |
| 147 | + should 'return users whom suggested ideas' do | |
| 148 | + #Rails.logger.level = :debug # at any time | |
| 149 | + #ActiveResource::Base.logger = Logger.new(STDERR) | |
| 150 | + VCR.use_cassette('question_contributors') do | |
| 151 | + @client.add_choice(@question.id, 'New Choice', 'John Travolta') | |
| 152 | + assert_equal 1, @question.get_ideas_contributors().size | |
| 153 | + end | |
| 154 | + end | |
| 155 | + | |
| 156 | + should 'toggle autoactivate ideas' do | |
| 157 | + VCR.use_cassette('pairwise_toggle_autactivate_ideas', :erb => {:autoactivateidea => false}) do | |
| 158 | + assert_equal false, @client.find_question_by_id(@question.id).it_should_autoactivate_ideas | |
| 159 | + @client.toggle_autoactivate_ideas(@question, true) | |
| 160 | + end | |
| 161 | + | |
| 162 | + VCR.use_cassette('pairwise_toggle_autactivate_ideas', :erb => {:autoactivateidea => true}) do | |
| 163 | + assert_equal true, @client.find_question_by_id(@question.id).it_should_autoactivate_ideas | |
| 164 | + end | |
| 165 | + end | |
| 166 | + | |
| 167 | + should 'flag a choice as reproved' do | |
| 168 | + VCR.use_cassette('flag_choice_as_reproved') do | |
| 169 | + question = @client.find_question_by_id 6 | |
| 170 | + choices_waiting_approval = question.pending_choices | |
| 171 | + assert choices_waiting_approval.count > 0, "Expected to find a inactive choice here" | |
| 172 | + @client.flag_choice(question, choices_waiting_approval.first.id, 'reproved') | |
| 173 | + assert_equal 0, question.pending_choices.count | |
| 174 | + end | |
| 175 | + end | |
| 176 | +end | |
| 0 | 177 | \ No newline at end of file | ... | ... |
plugins/pairwise/test/unit/pairwise_plugin/choices_related_test.rb
0 → 100644
| ... | ... | @@ -0,0 +1,53 @@ |
| 1 | +require "test_helper" | |
| 2 | +require "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/pairwise_content_fixtures" | |
| 3 | + | |
| 4 | +class PairwisePlugin::ChoicesRelatedTest < ActiveSupport::TestCase | |
| 5 | + | |
| 6 | + def setup | |
| 7 | + @pairwise_content = PairwiseContentFixtures.pairwise_content | |
| 8 | + end | |
| 9 | + | |
| 10 | + should 'have choice id' do | |
| 11 | + choices_related = PairwisePlugin::ChoicesRelated.new | |
| 12 | + choices_related.valid? | |
| 13 | + assert choices_related.errors.invalid?(:choice_id) | |
| 14 | + | |
| 15 | + choices_related.choice_id = 1 | |
| 16 | + choices_related.valid? | |
| 17 | + assert !choices_related.errors.invalid?(:choice_id) | |
| 18 | + end | |
| 19 | + | |
| 20 | + should 'have parent choice id' do | |
| 21 | + choices_related = PairwisePlugin::ChoicesRelated.new | |
| 22 | + choices_related.valid? | |
| 23 | + assert choices_related.errors.invalid?(:parent_choice_id) | |
| 24 | + | |
| 25 | + choices_related.parent_choice_id = 1 | |
| 26 | + choices_related.valid? | |
| 27 | + assert !choices_related.errors.invalid?(:parent_choice_id) | |
| 28 | + end | |
| 29 | + | |
| 30 | + should 'belongs to a question' do | |
| 31 | + choices_related = PairwisePlugin::ChoicesRelated.new | |
| 32 | + choices_related.valid? | |
| 33 | + assert choices_related.errors.invalid?(:question) | |
| 34 | + | |
| 35 | + choices_related.question = @pairwise_content | |
| 36 | + choices_related.valid? | |
| 37 | + assert !choices_related.errors.invalid?(:question) | |
| 38 | + end | |
| 39 | + | |
| 40 | + should 'optionally have an user' do | |
| 41 | + @user = create_user('testinguser') | |
| 42 | + choices_related = PairwisePlugin::ChoicesRelated.new | |
| 43 | + assert choices_related.user_id.nil? | |
| 44 | + choices_related.user = @user | |
| 45 | + assert_equal @user.id, choices_related.user_id | |
| 46 | + end | |
| 47 | + | |
| 48 | + should 'search for related choices' do | |
| 49 | + PairwisePlugin::ChoicesRelated.create!(:question => @pairwise_content, :choice_id => 1, :parent_choice_id =>2) | |
| 50 | + assert_equal 1, PairwisePlugin::ChoicesRelated.related_choices_for(1).size | |
| 51 | + assert_equal 1, PairwisePlugin::ChoicesRelated.related_choices_for(2).size | |
| 52 | + end | |
| 53 | +end | |
| 0 | 54 | \ No newline at end of file | ... | ... |
plugins/pairwise/test/unit/pairwise_plugin/pairwise_content_test.rb
0 → 100644
| ... | ... | @@ -0,0 +1,198 @@ |
| 1 | +require "test_helper" | |
| 2 | +require "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/pairwise_content_fixtures" | |
| 3 | +require "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/http_stub_fixtures" | |
| 4 | + | |
| 5 | +# require 'vcr' | |
| 6 | + | |
| 7 | +# VCR.configure do |c| | |
| 8 | +# c.cassette_library_dir = "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/vcr_cassettes" | |
| 9 | +# c.hook_into :webmock | |
| 10 | +# c.before_playback do |i| | |
| 11 | +# puts "I in PLAYBACK: #{i.inspect}" | |
| 12 | +# end | |
| 13 | +# end | |
| 14 | + | |
| 15 | +class PairwisePlugin::PairwiseContentTest < ActiveSupport::TestCase | |
| 16 | + | |
| 17 | + fixtures :environments | |
| 18 | + | |
| 19 | + def setup | |
| 20 | + pairwise_env_settings = { :api_host => "http://localhost:3030/", | |
| 21 | + :username => "abner.oliveira@serpro.gov.br", | |
| 22 | + :password => "serpro" | |
| 23 | + } | |
| 24 | + @profile = create_user('testing').person | |
| 25 | + @profile.environment = environments(:colivre_net) | |
| 26 | + @pairwise_client = Pairwise::Client.build(1, pairwise_env_settings) | |
| 27 | + @pairwise_content = PairwiseContentFixtures.pairwise_content | |
| 28 | + @pairwise_content.profile = @profile | |
| 29 | + #PairwisePlugin::PairwiseContent.any_instance.stubs(:send_question_to_service).returns(true) | |
| 30 | + #PairwisePlugin::PairwiseContent.any_instance.stubs(:pairwise_client).returns(@pairwise_client) | |
| 31 | + @http_stub_fixtures = HttpStubFixtures.new(pairwise_env_settings) | |
| 32 | + end | |
| 33 | + | |
| 34 | + should 'be inactive when created' do | |
| 35 | + assert_equal false, @pairwise_content.published? | |
| 36 | + end | |
| 37 | + | |
| 38 | + should 'get question from stubed api call' do | |
| 39 | + question = @http_stub_fixtures.create_question(2, 'Question 2', 'Choice X\nChoice Y') | |
| 40 | + assert_not_nil question | |
| 41 | + assert_equal 2, question.id | |
| 42 | + assert_equal 'Question 2', question.name | |
| 43 | + end | |
| 44 | + | |
| 45 | + should 'provide proper short description' do | |
| 46 | + assert_equal 'Pairwise question', PairwisePlugin::PairwiseContent.short_description | |
| 47 | + end | |
| 48 | + | |
| 49 | + should 'provide proper description' do | |
| 50 | + assert_equal 'Question managed by pairwise', PairwisePlugin::PairwiseContent.description | |
| 51 | + end | |
| 52 | + | |
| 53 | + should 'have an html view' do | |
| 54 | + assert_not_nil @pairwise_content.to_html | |
| 55 | + end | |
| 56 | + | |
| 57 | + should 'have result_url' do | |
| 58 | + assert_not_nil @pairwise_content.result_url | |
| 59 | + assert_equal @pairwise_content.profile.identifier, @pairwise_content.result_url[:profile] | |
| 60 | + assert_equal :pairwise_plugin_profile, @pairwise_content.result_url[:controller] | |
| 61 | + assert_equal :result, @pairwise_content.result_url[:action] | |
| 62 | + end | |
| 63 | + | |
| 64 | + should 'get question from pairwise service' do | |
| 65 | + @question = Pairwise::Question.new(:id => @pairwise_content.pairwise_question_id, :name => 'Question 1') | |
| 66 | + @pairwise_content.expects(:pairwise_client).returns(@pairwise_client) | |
| 67 | + @pairwise_client.expects(:find_question_by_id).with(@question.id).returns(@question) | |
| 68 | + assert_equal @question, @pairwise_content.question | |
| 69 | + end | |
| 70 | + | |
| 71 | + should 'prepare prompt' do | |
| 72 | + @question = Pairwise::Question.new(:id => @pairwise_content.pairwise_question_id, :name => 'Question 1') | |
| 73 | + @pairwise_content.expects(:pairwise_client).returns(@pairwise_client) | |
| 74 | + @pairwise_client.expects(:question_with_prompt).with(@question.id,'any_user', nil).returns(@question) | |
| 75 | + prompt = @pairwise_content.prepare_prompt('any_user') | |
| 76 | + assert_not_nil prompt | |
| 77 | + end | |
| 78 | + | |
| 79 | + should 'add error to base when the question does not exist' do | |
| 80 | + Response = Struct.new(:code, :message) | |
| 81 | + | |
| 82 | + @response = Response.new(422, "Any error") | |
| 83 | + | |
| 84 | + @pairwise_client.expects(:find_question_by_id).with(@pairwise_content.pairwise_question_id).raises(ActiveResource::ResourceNotFound.new(@response)) | |
| 85 | + | |
| 86 | + @pairwise_content.expects(:pairwise_client).returns(@pairwise_client) | |
| 87 | + assert_nil @pairwise_content.errors[:base] | |
| 88 | + @pairwise_content.question | |
| 89 | + | |
| 90 | + assert_not_nil @pairwise_content.errors[:base] | |
| 91 | + assert_equal 'Failed with 422 Any error', @pairwise_content.errors[:base] | |
| 92 | + end | |
| 93 | + | |
| 94 | + should 'send question to pairwise service' do | |
| 95 | + question = Pairwise::Question.new(:id => 3, :name => 'Question 1') | |
| 96 | + #expectations | |
| 97 | + pairwise_content = PairwiseContentFixtures.new_pairwise_content | |
| 98 | + pairwise_content.profile = @profile | |
| 99 | + pairwise_content.expects(:valid?).returns(true) | |
| 100 | + pairwise_content.expects(:create_pairwise_question).returns(question) | |
| 101 | + pairwise_content.expects(:toggle_autoactivate_ideas).at_least_once | |
| 102 | + #save should call before_save which sends the question to pairwise | |
| 103 | + pairwise_content.save! | |
| 104 | + | |
| 105 | + #after save pairwise_question_id should store question id generated by pairwise | |
| 106 | + assert_equal question.id, pairwise_content.pairwise_question_id | |
| 107 | + end | |
| 108 | + | |
| 109 | + should 'send changes in choices to pairwise service' do | |
| 110 | + @question = Pairwise::Question.new(:id => @pairwise_content.pairwise_question_id, :name => 'Question 1', :active => false) | |
| 111 | + @pairwise_content.expects(:question).returns(@question).at_least_once | |
| 112 | + @pairwise_content.expects(:pairwise_client).returns(@pairwise_client).at_least_once | |
| 113 | + @pairwise_content.expects('new_record?').returns(false).at_least_once | |
| 114 | + @pairwise_content.expects('valid?').returns(true).at_least_once | |
| 115 | + @pairwise_content.choices = [] | |
| 116 | + @pairwise_content.choices_saved = {'1' => 'Choice 1', '2' => 'Choice 2'} | |
| 117 | + #save should call update_choice in pairwise_client for each choice already saved | |
| 118 | + @pairwise_client.expects(:update_choice).returns(true).times(2) | |
| 119 | + @pairwise_content.save | |
| 120 | + end | |
| 121 | + | |
| 122 | + should 'send new choices to pairwise_service' do | |
| 123 | + @question = Pairwise::Question.new(:id => @pairwise_content.pairwise_question_id, :name => 'Question 1', :active => false) | |
| 124 | + @pairwise_content.expects('new_record?').returns(false).at_least_once | |
| 125 | + @pairwise_content.expects('valid?').returns(true).at_least_once | |
| 126 | + | |
| 127 | + @pairwise_content.expects(:pairwise_client).returns(@pairwise_client).at_least_once | |
| 128 | + @pairwise_content.expects(:question).returns(@question).at_least_once | |
| 129 | + @pairwise_content.choices = ['New Choice 1', 'New Choice 2'] | |
| 130 | + @pairwise_content.choices_saved = [] | |
| 131 | + | |
| 132 | + @pairwise_client.expects(:approve_choice).returns(true).at_least_once | |
| 133 | + choice_stub = Pairwise::Choice.new(:id=> 1, :data => 'txt') | |
| 134 | + @pairwise_client.expects(:add_choice).with(@pairwise_content.pairwise_question_id, "New Choice 1").returns(choice_stub) | |
| 135 | + @pairwise_client.expects(:add_choice).with(@pairwise_content.pairwise_question_id, "New Choice 2").returns(choice_stub) | |
| 136 | + @pairwise_client.expects(:update_question).with(@question.id, @question.name).returns(true) | |
| 137 | + @pairwise_content.save | |
| 138 | + puts @pairwise_content.errors.full_messages | |
| 139 | + end | |
| 140 | + | |
| 141 | + should 'allow new ideas by default when created' do | |
| 142 | + assert_equal true, @pairwise_content.allow_new_ideas? | |
| 143 | + end | |
| 144 | + | |
| 145 | + should 'add new ideas suggestions when new ideas are allowed' do | |
| 146 | + assert_equal true, @pairwise_content.allow_new_ideas? | |
| 147 | + @question = Pairwise::Question.new(:id => @pairwise_content.pairwise_question_id, :name => 'Question 1', :active => false) | |
| 148 | + @pairwise_content.expects(:pairwise_client).returns(@pairwise_client).at_least_once | |
| 149 | + @pairwise_client.expects(:add_new_idea).with(@question.id, "New idea").returns(true) | |
| 150 | + assert_equal true, @pairwise_content.add_new_idea("New idea") | |
| 151 | + end | |
| 152 | + | |
| 153 | + should 'not add new ideas suggestions when new ideas are not allowed' do | |
| 154 | + assert_equal true, @pairwise_content.allow_new_ideas? | |
| 155 | + @question = Pairwise::Question.new(:id => @pairwise_content.pairwise_question_id, :name => 'Question 1', :active => false) | |
| 156 | + @pairwise_content.allow_new_ideas = false | |
| 157 | + assert_equal false, @pairwise_content.add_new_idea("New idea") | |
| 158 | + end | |
| 159 | + | |
| 160 | + should 'join similar choices' do | |
| 161 | + pairwise_content = PairwiseContentFixtures.content_stub_with_3_choices | |
| 162 | + | |
| 163 | + assert_equal 3, pairwise_content.question.choices.size | |
| 164 | + | |
| 165 | + choices_to_join = pairwise_content.question.choices[1..2].map { |choice| choice.id } | |
| 166 | + parent_choice = pairwise_content.question.choices[0].id | |
| 167 | + | |
| 168 | + pairwise_content.profile = @profile | |
| 169 | + pairwise_content.stubs(:valid? => true) | |
| 170 | + pairwise_content.stubs(:send_question_to_service => true) | |
| 171 | + pairwise_content.join_choices(choices_to_join, parent_choice, user=nil) | |
| 172 | + | |
| 173 | + choices_related = PairwisePlugin::ChoicesRelated.related_choices_for(parent_choice) | |
| 174 | + assert_equal 2, choices_related.size | |
| 175 | + assert_equal 1, choices_related.select { |c| c.choice_id == 2}.size | |
| 176 | + assert_equal 1, choices_related.select { |c| c.choice_id == 3 }.size | |
| 177 | + end | |
| 178 | + | |
| 179 | + # should 'skip prompt' do | |
| 180 | + | |
| 181 | + # end | |
| 182 | + | |
| 183 | + should 'ask skip prompt reasons' do | |
| 184 | + prompt = Pairwise::Prompt.new({"left_choice_text"=>"Choice 1", "right_choice_text"=>"New inactive choice", "left_choice_id"=>1300, "right_choice_id"=>1302, "id"=>194, "tracking"=>nil, "votes_count"=>0}) | |
| 185 | + reasons = @pairwise_content.ask_skip_reasons(prompt) | |
| 186 | + | |
| 187 | + assert_not_nil reasons | |
| 188 | + assert_equal 7, reasons.size | |
| 189 | + | |
| 190 | + assert reasons[0].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[0][:text] | |
| 191 | + assert reasons[1].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[1][:text] | |
| 192 | + assert reasons[2].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[2][:text] | |
| 193 | + assert reasons[3].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[3][:text] | |
| 194 | + assert reasons[4].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[4][:text] | |
| 195 | + assert reasons[5].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[4][:text] | |
| 196 | + assert reasons[6].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[5][:text] | |
| 197 | + end | |
| 198 | +end | ... | ... |
plugins/pairwise/test/unit/pairwise_plugin/questions_group_block_test.rb
0 → 100644
| ... | ... | @@ -0,0 +1,46 @@ |
| 1 | +require 'test_helper' | |
| 2 | +require "#{RAILS_ROOT}/plugins/pairwise/test/fixtures/pairwise_content_fixtures" | |
| 3 | + | |
| 4 | +class PairwisePlugin::QuestionsGroupBlockTest < ActiveSupport::TestCase | |
| 5 | + | |
| 6 | + fixtures :environments | |
| 7 | + | |
| 8 | + def setup | |
| 9 | + @profile = create_user('testing').person | |
| 10 | + @profile.environment = environments(:colivre_net) | |
| 11 | + | |
| 12 | + PairwisePlugin::PairwiseContent.any_instance.stubs(:send_question_to_service).returns(true) | |
| 13 | + | |
| 14 | + @question1 = PairwisePlugin::PairwiseContent.new(:name => 'Question 1', :profile => @profile, :pairwise_question_id => 1, :body => 'Body 1') | |
| 15 | + @question1.stubs(:valid?).returns(true) | |
| 16 | + @question1.save | |
| 17 | + | |
| 18 | + @question2 = PairwisePlugin::PairwiseContent.new(:name => 'Question 2', :profile => @profile, :pairwise_question_id => 2, :body => 'Body 2') | |
| 19 | + @question2.stubs(:valid?).returns(true) | |
| 20 | + @question2.save | |
| 21 | + | |
| 22 | + @block = PairwisePlugin::QuestionsGroupBlock.create(:title => "Pairwise Question Block") | |
| 23 | + @profile.boxes.first.blocks << @block | |
| 24 | + @block.save! | |
| 25 | + end | |
| 26 | + | |
| 27 | + should 'have available question' do | |
| 28 | + assert_equal [@question1, @question2], @block.available_questions | |
| 29 | + end | |
| 30 | + | |
| 31 | + should 'add multiple questions to block' do | |
| 32 | + @block.questions_ids = [@question1.id, @question2.id ] | |
| 33 | + @block.save | |
| 34 | + @block.reload | |
| 35 | + assert_equal 2, @block.questions.length | |
| 36 | + end | |
| 37 | + | |
| 38 | + should 'pick a question to show' do | |
| 39 | + @block.questions_ids = [ @question1.id, @question2.id ] | |
| 40 | + @block.save | |
| 41 | + @block.reload | |
| 42 | + assert_not_nil @block.pick_question | |
| 43 | + assert_equal true, @block.pick_question.is_a?(PairwisePlugin::PairwiseContent) | |
| 44 | + end | |
| 45 | + | |
| 46 | +end | ... | ... |
plugins/pairwise/views/blocks/questions_group_list.rhtml
0 → 100644
| ... | ... | @@ -0,0 +1,46 @@ |
| 1 | +<% extend PairwisePlugin::Helpers::ViewerHelper %> | |
| 2 | + | |
| 3 | +<%= block_title(block.title) %> | |
| 4 | + | |
| 5 | +<div id='pairwise_group_list_block_<%= block.id %>' class='pairwise_group_list_container' data-open-prompt="0"> | |
| 6 | + <div class="description"> | |
| 7 | + <%= block.group_description %> | |
| 8 | + </div> | |
| 9 | + <div class="question container"> | |
| 10 | + <% if block.questions.nil? || block.questions.empty? %> | |
| 11 | + <span><%= _("Empty") %></span> | |
| 12 | + <% else | |
| 13 | + block.questions_for_view.each_with_index do |pairwise_content, index| | |
| 14 | + %> | |
| 15 | + <div class='<%= pairwise_group_row_classes(index) %>'> | |
| 16 | + <div class="number"><p><%= index + 1 %></p></div> | |
| 17 | + <div class="title"><p><%= pairwise_content.title %></p></div> | |
| 18 | + <div class="arrow" ><%= pairwise_span_arrow(index) %></div> | |
| 19 | + </div> | |
| 20 | + <%= pairwise_group_content_body(index, pairwise_content) %> | |
| 21 | + <% end %> | |
| 22 | + <% end %> | |
| 23 | + </div> | |
| 24 | +</div> | |
| 25 | + | |
| 26 | +<script type="text/javascript"> | |
| 27 | +jQuery(document).ready(function($){ | |
| 28 | + var block_id = '#pairwise_group_list_block_<%= block.id %>'; | |
| 29 | + var block_element = $(block_id); | |
| 30 | + var questions_arrows = $(block_id + ' .arrow'); | |
| 31 | + var questions_rows = $(block_id + ' .row'); | |
| 32 | + var questions_bodies = $(block_id + ' .pairwise_inner_body'); | |
| 33 | + questions_rows.click(function(){ | |
| 34 | + var current_open = parseInt(block_element.attr('data-open-prompt')); | |
| 35 | + var index_clicked = questions_rows.index(this); | |
| 36 | + if(index_clicked != current_open){ | |
| 37 | + block_element.attr('data-open-prompt', index_clicked); | |
| 38 | + $(questions_bodies[current_open]).slideToggle(); | |
| 39 | + $(questions_rows[current_open]).toggleClass("secondary"); | |
| 40 | + | |
| 41 | + $(questions_bodies[index_clicked]).slideToggle(); | |
| 42 | + $(questions_rows[index_clicked]).toggleClass("secondary"); | |
| 43 | + } | |
| 44 | + }); | |
| 45 | +}); | |
| 46 | +</script> | ... | ... |
plugins/pairwise/views/box_organizer/pairwise_plugin/_questions_group_block.rhtml
0 → 100644
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | +<div class="article-block-edition"> | |
| 2 | +<% if @block.owner.kind_of?(Environment) and @block.owner.portal_community.nil? %> | |
| 3 | + <p id="no_portal_community"> | |
| 4 | + <%= _("You don't have an community defined as the portal community. Define it before use this block properly.") %> | |
| 5 | + </p> | |
| 6 | +<% else %> | |
| 7 | + <% | |
| 8 | + questions = @block.available_questions | |
| 9 | + %> | |
| 10 | + <div id="questions_content" %> | |
| 11 | + <ul> | |
| 12 | + <% questions.each do |question| %> | |
| 13 | + <li> | |
| 14 | + <%= labelled_check_box(question.name, "block[questions_ids][]", question.id, @block.settings[:questions_ids] !=null && @block.settings[:questions_ids].include?(question.id.to_s) ) %> | |
| 15 | + </li> | |
| 16 | + <% end %> | |
| 17 | + </ul> | |
| 18 | + </div> | |
| 19 | +<% end %> | |
| 0 | 20 | \ No newline at end of file | ... | ... |
plugins/pairwise/views/box_organizer/pairwise_plugin/_questions_group_list_block.rhtml
0 → 100644
| ... | ... | @@ -0,0 +1,34 @@ |
| 1 | +<div class="article-block-edition"> | |
| 2 | +<% if @block.owner.kind_of?(Environment) and @block.owner.portal_community.nil? %> | |
| 3 | + <p id="no_portal_community"> | |
| 4 | + <%= _("You don't have an community defined as the portal community. Define it before use this block properly.") %> | |
| 5 | + </p> | |
| 6 | +<% else %> | |
| 7 | + <% | |
| 8 | + questions = @block.available_questions | |
| 9 | + %> | |
| 10 | + <div class="group_description"> | |
| 11 | + <h3> <%= _('Description:') %> </h3> | |
| 12 | + <%= text_area(:block, :group_description, :rows => 6, :cols => 50) %> | |
| 13 | + </div> | |
| 14 | + <div id="questions_content" %> | |
| 15 | + <h3> <%= _('Choose which attributes should be displayed and drag to reorder them:') %> </h3> | |
| 16 | + <ul id="pairwise_questions_list"> | |
| 17 | + <% questions.each do |question| %> | |
| 18 | + <li> | |
| 19 | + <%= | |
| 20 | + check_box_tag( "block[questions_ids][]", question.id, @block.settings[:questions_ids] && @block.settings[:questions_ids].include?(question.id.to_s), :id => "pairwise_question_#{question.id}" ) + | |
| 21 | + content_tag( 'label', question.name, :for => "pairwise_question_#{question.id}" ) | |
| 22 | + %> | |
| 23 | + </li> | |
| 24 | + <% end %> | |
| 25 | + </ul> | |
| 26 | + <div class="random_sort"> | |
| 27 | + <%= labelled_form_field check_box(:block, :random_sort) + _('Show items in a random order'), '' %> | |
| 28 | + </div> | |
| 29 | + </div> | |
| 30 | +<% end %> | |
| 31 | + | |
| 32 | +<script type="text/javascript"> | |
| 33 | + jQuery( "#pairwise_questions_list" ).sortable(); | |
| 34 | +</script> | ... | ... |
plugins/pairwise/views/cms/pairwise_plugin/_pairwise_content.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | +<style type="text/css"> | |
| 2 | + div#pairwise_form_fields textarea { | |
| 3 | + width: 100% !important; | |
| 4 | + margin-top: 5px; | |
| 5 | + height:30px; | |
| 6 | + | |
| 7 | + } | |
| 8 | +</style> | |
| 9 | +<h1> <%= _(PairwisePlugin::PairwiseContent.short_description) %> </h1> | |
| 10 | + | |
| 11 | +<% | |
| 12 | + @question = @article.title.nil? ? nil : @article.question | |
| 13 | +%> | |
| 14 | + | |
| 15 | +<%= error_messages_for 'question_content' %> | |
| 16 | + | |
| 17 | +<%= hidden_field_tag 'question_content[profile_id]', profile.id %> | |
| 18 | +<%= hidden_field_tag 'pairwise_question_id', @article.pairwise_question_id %> | |
| 19 | +<%= render :partial => "cms/pairwise_plugin/pairwise_content_form", :locals => {:f => f} %> | ... | ... |
plugins/pairwise/views/cms/pairwise_plugin/_pairwise_content_form.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,47 @@ |
| 1 | +<div id="pairwise_form_fields"> | |
| 2 | + | |
| 3 | + <%= hidden_field_tag 'id', @article.id %> | |
| 4 | + <%= required_fields_message %> | |
| 5 | + <%= required f.text_field(:name) %><br/> | |
| 6 | + | |
| 7 | + <%= render :file => 'shared/tiny_mce' %> | |
| 8 | + | |
| 9 | + <%= f.text_area(:body, :style => 'width: 98%; height: 400px;', :class => 'mceEditor') %> | |
| 10 | + | |
| 11 | + <%#= labelled_form_field(_('Text'), text_area(@article, :body, :style => 'width: 98%; height: 400px;', :class => 'mceEditor')) %> | |
| 12 | + | |
| 13 | + <%= required f.check_box :allow_new_ideas %><br/> | |
| 14 | + | |
| 15 | + <div id="choices"> | |
| 16 | + <span class="required-field"> | |
| 17 | + <label class="formlabel" for="choices"><%= _('Choices') %></label> | |
| 18 | + </span> | |
| 19 | + <%#new articles starts with two choices fields %> | |
| 20 | + <div id="pairwise_choices_list"> | |
| 21 | + <% if @article.new_record? %> | |
| 22 | + <%= required text_area_tag 'article[choices][]', '', :id => 'choice1' %> | |
| 23 | + <%= required text_area_tag 'article[choices][]', '', :id => 'choice2' %> | |
| 24 | + | |
| 25 | + <% else #already saved pairwise content show one input for each choice%> | |
| 26 | + <% @article.choices.each do |choice_hash| %> | |
| 27 | + <% choice_hash.each do |id, data| %> | |
| 28 | + <%= required text_area_tag "article[choices_saved[#{id}]", | |
| 29 | + data, :id => "choice_#{id}", :disabled => false %> | |
| 30 | + <% end %> | |
| 31 | + <% end %> | |
| 32 | + <% end %> | |
| 33 | + </div> | |
| 34 | + </div> | |
| 35 | + <div class="button-bar"> | |
| 36 | + <input class="button with-text icon-add" type="button" id="add_new_choice" value="<%= _("New choice") %>"> | |
| 37 | + <br style="clear: left;"> | |
| 38 | + </div> | |
| 39 | + <script type="text/javascript"> | |
| 40 | + jQuery('#add_new_choice').click(function(){ | |
| 41 | + var qty = jQuery("#pairwise_choices_list textarea").size(); | |
| 42 | + var choice_id = 'choice' + qty; | |
| 43 | + jQuery("#pairwise_choices_list").append("<span class='required-field'><textarea id='choices_' name='article[choices][]'></textarea></span>"); | |
| 44 | + return false; | |
| 45 | + }) | |
| 46 | + </script> | |
| 47 | +</div> | |
| 0 | 48 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | +<% extend PairwisePlugin::Helpers::ViewerHelper %> | |
| 2 | + | |
| 3 | +<ul class="pairwise_menu"> | |
| 4 | + <li> | |
| 5 | + <%= pairwise_tab_remote_link _('Pairwise Vote'), pairwise_content.prompt_url, pairwise_content, embeded, :class => active_tab == :prompt ? 'active' : '' %> | |
| 6 | + </li> | |
| 7 | + <li><%= pairwise_tab_remote_link _('Results'), pairwise_content.result_url, pairwise_content, embeded, :class => active_tab == :results ? 'active' : '' %></li> | |
| 8 | + <% if !embeded && pairwise_content.allow_edit?(user) %> | |
| 9 | + <li><%= pairwise_edit_link _('Edit'), pairwise_content %></li> | |
| 10 | + <li><%= ideas_management_link _('Manage Ideas'), pairwise_content, user %></li> | |
| 11 | + <% end %> | |
| 12 | +</ul> | ... | ... |
plugins/pairwise/views/content_viewer/_pairwise_prompts.rhtml
0 → 100644
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | +<div id="pairwise_prompts_<%= pairwise_content.id %>"> | |
| 2 | + <%= pairwise_spinner(pairwise_content) %> | |
| 3 | + <% unless question %> | |
| 4 | + <div style="height: 190px"></div> | |
| 5 | + <script> | |
| 6 | + <%= pairwise_spinner_show_function_call(pairwise_content) %> | |
| 7 | + jQuery.ajax({ | |
| 8 | + url: "<%= url_for :controller=>'pairwise_plugin_profile', :action=>'load_prompt', :profile => pairwise_content.profile.identifier, :id => pairwise_content.id %>", | |
| 9 | + dataType: 'script' | |
| 10 | + }); | |
| 11 | + </script> | |
| 12 | + <% else %> | |
| 13 | + <div class="prompt left"><%= choose_left_link(pairwise_content, question, question.prompt, embeded, source, question.appearance_id) %></div> | |
| 14 | + <div class="separator"></div> | |
| 15 | + <div class="prompt right"><%= choose_right_link(pairwise_content, question, question.prompt, embeded, source, question.appearance_id ) %></div> | |
| 16 | + <% end %> | |
| 17 | +</div> | ... | ... |
plugins/pairwise/views/content_viewer/_pairwise_skips.rhtml
0 → 100644
plugins/pairwise/views/content_viewer/_prompt_body.rhtml
0 → 100644
| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | +<div id="pairwise_<%= pairwise_content.id %>"> | |
| 2 | +<div id="pairwise_main" class="pairwise_main"> | |
| 3 | + <%= render :partial => 'content_viewer/menu', :locals => {:embeded => embeded, :pairwise_content => pairwise_content, :active_tab => :prompt} %> | |
| 4 | + <div class="pairwise_content"> | |
| 5 | + <div class="pairwise_body"><%= pairwise_content.title %></div> | |
| 6 | + <div class="pairwise_call_for_action"><%= pairwise_content.body %></div> | |
| 7 | + <%= render :partial => 'content_viewer/pairwise_prompts', :locals => {:embeded => embeded, :pairwise_content => pairwise_content, :question => question, :source => (defined?(source) ? source : '') } %> | |
| 8 | + <% if embeded %> | |
| 9 | + <div class="footer"><%= _('Powered by') + ' ' + pairwise_content.environment.name%></div> | |
| 10 | + <% end %> | |
| 11 | + </div> | |
| 12 | + <div class="skip_vote"> | |
| 13 | + <%= skip_vote_open_function(pairwise_content) %> | |
| 14 | + </div> | |
| 15 | + <div id="skip_vote_reasons_<%= pairwise_content.id %>" class="skip_vote_reasons"> | |
| 16 | + <% if question %> | |
| 17 | + <%= render :partial => 'content_viewer/pairwise_skips', :locals => {:embeded => embeded, :pairwise_content => pairwise_content, :question => question, :source => (defined?(source) ? source : '') } %> | |
| 18 | + <% end %> | |
| 19 | + </div> | |
| 20 | + | |
| 21 | + <% if pairwise_content.allow_new_ideas? %> | |
| 22 | + <% if user %> | |
| 23 | + <div id="suggestions_box"> | |
| 24 | + <span>Gostaria de sugerir uma ideia?</span> | |
| 25 | + <div class="suggestion_form"> | |
| 26 | + <%= render :partial => "pairwise_plugin_profile/suggestion_form", | |
| 27 | + :locals => {:pairwise_content => pairwise_content, :embeded => embeded, :source => source} %> | |
| 28 | + </div> | |
| 29 | + </div> | |
| 30 | + <% else %> | |
| 31 | + <div id="suggestions_box_not_logged"> | |
| 32 | + <%= link_to(_("Add new idea"), '#', :id => 'new_idea_button_not_logged', :class => 'require-login-popup') %> | |
| 33 | + </div> | |
| 34 | + <% end %> | |
| 35 | + <% end %> | |
| 36 | +</div> | |
| 37 | +</div> | ... | ... |
| ... | ... | @@ -0,0 +1,63 @@ |
| 1 | +<div id="pairwise_<%= pairwise_content.id %>"> | |
| 2 | +<div id="pairwise_main" class="pairwise_main"> | |
| 3 | + | |
| 4 | +<% | |
| 5 | + @question = @page.question | |
| 6 | + %> | |
| 7 | + | |
| 8 | +<% extend PairwisePlugin::Helpers::ViewerHelper %> | |
| 9 | + | |
| 10 | +<% unless @page.errors[:base].nil? %> | |
| 11 | + <h3><%= _('Pairwise Integration Error') %></h3> | |
| 12 | + <p> <%= _('Please contact the administrator') %></p> | |
| 13 | + <pre> | |
| 14 | + <%= @page.errors[:base] %> | |
| 15 | + </pre> | |
| 16 | +<% else %> | |
| 17 | + | |
| 18 | + <%= render :partial => 'content_viewer/menu', :locals => {:embeded => embeded, :pairwise_content => pairwise_content, :active_tab => :results} %> | |
| 19 | + | |
| 20 | + <% cache_timeout("pairwise-result-#{pairwise_content.id}", 1.hours) do %> | |
| 21 | + <div class="pairwise_content"> | |
| 22 | +<%= pairwise_spinner(pairwise_content) %> | |
| 23 | + | |
| 24 | + <div class="total_votes"> | |
| 25 | + <span class="label"><%= _('Total votes:') %></span> | |
| 26 | + <span class="value"><%= @page.question.votes_count %></span> | |
| 27 | + </div> | |
| 28 | + <table> | |
| 29 | + <thead> | |
| 30 | + <tr> | |
| 31 | + <th><%= _('Choice Text') %></th> | |
| 32 | + <th title="<%= _('The ideia is better than the other ideas') %>" ><%= _('Choice Wins') %></th> | |
| 33 | + <th title="<%= _('The other ideas were chosen') %>" ><%= _('Choice Losses') %></th> | |
| 34 | + <th title="<%= _('Rank of the ideias') %>" ><%= _('Choice Score') %></th> | |
| 35 | + </tr> | |
| 36 | + </thead> | |
| 37 | + <tbody> | |
| 38 | + <% @page.question.get_choices.each do |choice| %> | |
| 39 | + <tr> | |
| 40 | + <td><%= choice.data %></td> | |
| 41 | + <td><%= choice.wins %></td> | |
| 42 | + <td><%= choice.losses %></td> | |
| 43 | + <td><%= choice.score.round.to_s %></td> | |
| 44 | + </tr> | |
| 45 | + <% end %> | |
| 46 | + </tbody> | |
| 47 | + </table> | |
| 48 | + </div> | |
| 49 | + <% if @page.allow_edit?(user) %> | |
| 50 | + <div class="embeded_code"> | |
| 51 | + <span class="embeded_code_link"><a href="javascript:;"><%= _("Show/Hide Embeded Code") %></a></span> | |
| 52 | + <div id="pairwise_embeded_box" style="display:none"> | |
| 53 | + <%= pairwise_embeded_code(@page) %> | |
| 54 | + </div> | |
| 55 | + </div> | |
| 56 | + <% end %> | |
| 57 | + <%#= link_to _('Vote'), @page.url, :class=>"button with-text icon-edit" %> | |
| 58 | +<% end %> | |
| 59 | +<% end %> | |
| 60 | + | |
| 61 | +</div> | |
| 62 | +</div> | |
| 63 | + | ... | ... |
| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | +<% extend PairwisePlugin::Helpers::ViewerHelper %> | |
| 2 | + | |
| 3 | +<%= pairwise_plugin_stylesheet %> | |
| 4 | + | |
| 5 | +<% if embeded %> | |
| 6 | + <%= javascript_include_tag :defaults, 'jquery-latest.js', | |
| 7 | + 'jquery.noconflict.js', 'jquery.cycle.all.min.js', 'thickbox.js', 'lightbox', 'colorbox', | |
| 8 | + 'jquery-ui-1.8.2.custom.min', 'jquery.scrollTo', 'jquery.form.js', 'jquery-validation/jquery.validate', | |
| 9 | + 'jquery.cookie', 'jquery.ba-bbq.min.js', 'reflection', 'jquery.tokeninput', | |
| 10 | + 'add-and-join', 'report-abuse', 'catalog', 'manage-products', | |
| 11 | + 'jquery-ui-timepicker-addon', :cache => 'cache-general' %> | |
| 12 | +<% end %> | |
| 13 | + | |
| 14 | +<%= render :partial => 'content_viewer/prompt_body', :locals => {:embeded => embeded, :pairwise_content => pairwise_content, :question => nil, :source => (defined?(source) ? source : '') }%> | ... | ... |
| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | +extend PairwisePlugin::Helpers::ViewerHelper | |
| 2 | + | |
| 3 | +question = @pairwise_content.prepare_prompt(pairwise_user_identifier(user), nil) | |
| 4 | + | |
| 5 | +spinner = "pairwise_spinner#{@pairwise_content.id}" | |
| 6 | + | |
| 7 | +div_id = "pairwise_prompts_#{@pairwise_content.id}" | |
| 8 | + | |
| 9 | +skip_div_id = "skip_vote_reasons_#{@pairwise_content.id}" | |
| 10 | + | |
| 11 | +page.replace div_id, :partial => 'content_viewer/pairwise_prompts', :locals => { | |
| 12 | + :embeded => params[:embeded], | |
| 13 | + :source => params[:source], | |
| 14 | + :pairwise_content => @pairwise_content, | |
| 15 | + :question => question | |
| 16 | + } | |
| 17 | + | |
| 18 | +page.replace_html skip_div_id, :partial => 'content_viewer/pairwise_skips', :locals => { | |
| 19 | + :embeded => params[:embeded], | |
| 20 | + :source => params[:source], | |
| 21 | + :pairwise_content => @pairwise_content, | |
| 22 | + :question => question | |
| 23 | + } | |
| 24 | + | |
| 25 | +page.call pairwise_spinner_hide_function_name(@pairwise_content) | ... | ... |
| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | +extend PairwisePlugin::Helpers::ViewerHelper | |
| 2 | + | |
| 3 | +div_id = "pairwise_#{@pairwise_content.id}" | |
| 4 | + | |
| 5 | +question = @pairwise_content.prepare_prompt(pairwise_user_identifier(user), nil) | |
| 6 | + | |
| 7 | +page.replace div_id, :partial => 'content_viewer/prompt_body', :locals => { | |
| 8 | + :embeded => params[:embeded], | |
| 9 | + :source => params[:source], | |
| 10 | + :pairwise_content => @pairwise_content, | |
| 11 | + :question => question | |
| 12 | + } | |
| 13 | + | |
| 14 | +page.call pairwise_spinner_hide_function_name(@pairwise_content) | ... | ... |
| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | +extend PairwisePlugin::Helpers::ViewerHelper | |
| 2 | + | |
| 3 | +div_id = "pairwise_#{@pairwise_content.id}" | |
| 4 | + | |
| 5 | +page.replace div_id, :partial => 'content_viewer/result', :locals => { | |
| 6 | + :embeded => params[:embeded], | |
| 7 | + :pairwise_content => @pairwise_content, | |
| 8 | + } | |
| 9 | + | |
| 10 | +page.call pairwise_spinner_hide_function_name(@pairwise_content) | ... | ... |
plugins/pairwise/views/environment_design/pairwise_plugin
0 → 120000
| ... | ... | @@ -0,0 +1,34 @@ |
| 1 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| 2 | +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= html_language %>" lang="<%= html_language %>"> | |
| 3 | + <head> | |
| 4 | + <title>Pairwise embed</title> | |
| 5 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| 6 | + | |
| 7 | + <%= noosfero_stylesheets %> | |
| 8 | + <%= noosfero_javascript %> | |
| 9 | + | |
| 10 | + <script type='text/javascript'> | |
| 11 | + DEFAULT_LOADING_MESSAGE = <%="'#{ _('loading...') }'" %>; | |
| 12 | + </script> | |
| 13 | + | |
| 14 | + <style> | |
| 15 | + #pairwise_embed { | |
| 16 | + padding: 20px; | |
| 17 | + margin: 20x; | |
| 18 | + } | |
| 19 | + </style> | |
| 20 | + | |
| 21 | + </head> | |
| 22 | + <body class="<%= h body_classes %>"> | |
| 23 | + <%= | |
| 24 | + @plugins.dispatch(:body_beginning).collect do |content| | |
| 25 | + content.respond_to?(:call) ? content.call : content | |
| 26 | + end.join("\n") | |
| 27 | + %> | |
| 28 | + <div id="pairwise_embed"> | |
| 29 | + | |
| 30 | + <%= yield %> | |
| 31 | + | |
| 32 | + </div> | |
| 33 | + </body> | |
| 34 | +</html> | ... | ... |
plugins/pairwise/views/pairwise_plugin_admin/index.rhtml
0 → 100644
| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | +<h1><%= _('Pairwise settings')%></h1> | |
| 2 | + | |
| 3 | +<% form_for(:settings) do |f| %> | |
| 4 | + | |
| 5 | + <div id="pairwise-config-fields"> | |
| 6 | + <%= labelled_form_field _('Pairwise api host'), f.text_field(:api_host) %> | |
| 7 | + <%= labelled_form_field _('Pairwise username'), f.text_field(:username) %> | |
| 8 | + <%= labelled_form_field _('Pairwise password'), f.text_field(:password) %> | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + <% button_bar do %> | |
| 13 | + <%= submit_button(:save, _('Save'), :cancel => {:controller => 'plugins', :action => 'index'}) %> | |
| 14 | + <% end %> | |
| 15 | + </div> | |
| 16 | +<% end %> | |
| 17 | + | ... | ... |
plugins/pairwise/views/pairwise_plugin_profile/_suggestion_form.rhtml
0 → 100644
| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | + <% remote_form_for('idea', :url => pairwise_suggestion_url(pairwise_content, embeded, source), | |
| 2 | + :html => {:id => "pairwise_suggestion_form_#{pairwise_content.id}"}, :loading => "jQuery('#pairwise_suggestion_form_#{pairwise_content.id} .suggestion_box_fields').hide();jQuery('#pairwise_suggestion_form_#{pairwise_content.id} .suggestion_box_loading').show();", :loaded => "jQuery('#pairwise_suggestion_form_#{pairwise_content.id} .suggestion_box_fields').show();jQuery('#pairwise_suggestion_form_#{pairwise_content.id} .suggestion_box_loading').hide();") do |f| %> | |
| 3 | + <div class="suggestion_box_fields"> | |
| 4 | + <div class="error"> | |
| 5 | + <%= flash[:error] %> | |
| 6 | + </div> | |
| 7 | + <div class="notice"> | |
| 8 | + <%= flash[:notice] %> | |
| 9 | + </div> | |
| 10 | + <div class="div_text_input_container"> | |
| 11 | + <div id="text_idea_content_<%= pairwise_content.id %>" class="div_text_input"> | |
| 12 | + <%= f.text_area 'text', :maxlenght => 160, :rows => 4, :placeholder => _('Type your idea here') %> | |
| 13 | + </div> | |
| 14 | + <div class="suggest_idea_btn"> | |
| 15 | + <%= submit_button('', '', :id => 'new_idea_button', :class => user ? '':'require-login-popup') %> | |
| 16 | + </div> | |
| 17 | + </div> | |
| 18 | + </div> | |
| 19 | + <div class="suggestion_box_loading" style="display: none;"> | |
| 20 | + <span>Processando...</span> | |
| 21 | + </div> | |
| 22 | + <script type='text/javascript'> | |
| 23 | + jQuery(document).ready(function($){ | |
| 24 | + var pairwise_id = '<%=pairwise_content.id %>'; | |
| 25 | + $('#text_idea_content_' + pairwise_id).find('textarea').jqEasyCounter(); | |
| 26 | + }); | |
| 27 | + </script> | |
| 28 | + <% end %> | ... | ... |
plugins/pairwise/views/pairwise_plugin_profile/result.rhtml
0 → 100644
| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | +<% extend PairwisePlugin::Helpers::ViewerHelper %> | |
| 2 | + | |
| 3 | +<%= pairwise_plugin_stylesheet %> | |
| 4 | + | |
| 5 | +<h1 class="title"><%= @page.name %></h1> | |
| 6 | + | |
| 7 | +<%= render :partial => "content_viewer/result", :locals => { | |
| 8 | + :embeded => @embeded, | |
| 9 | + :pairwise_content => @pairwise_content, | |
| 10 | + } %> | ... | ... |
plugins/pairwise/views/pairwise_plugin_profile/suggestion_form.rjs
0 → 100644
| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | +extend PairwisePlugin::Helpers::ViewerHelper | |
| 2 | + | |
| 3 | +page.replace_html "pairwise_suggestion_form_#{@pairwise_content.id}", :partial => "suggestion_form", | |
| 4 | + :locals=> {:pairwise_content => @pairwise_content, :page => @pairwise_content, :embeded => @embeded, :source => @source } | |
| 5 | +#page.visual_effect :slide_down, "suggestions_box" | |
| 0 | 6 | \ No newline at end of file | ... | ... |
plugins/pairwise/views/pairwise_plugin_suggestions/edit.rhtml
0 → 100644
| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | +<h1><%= _("Edit Pairwise Question Choice") %> </h1> | |
| 2 | + | |
| 3 | +<h4><%= @pairwise_content.name %></h4> | |
| 4 | + | |
| 5 | +<% form_for 'choice', | |
| 6 | + :url => { | |
| 7 | + :controller => 'pairwise_plugin_suggestions', | |
| 8 | + :action => 'update', | |
| 9 | + :id => @pairwise_content.id | |
| 10 | + } do |f| %> | |
| 11 | + <%= f.hidden_field 'id' %> | |
| 12 | + <%= f.text_area 'data', :rows => 4, :style => "width:100%" %> | |
| 13 | + <%= f.check_box 'active' %> <%= f.label _('Active') %> | |
| 14 | + <br class="clear"> | |
| 15 | + <%= submit_button('save', _('Update'), :id => 'update_choice_button') %> | |
| 16 | +<% end %> | ... | ... |
plugins/pairwise/views/pairwise_plugin_suggestions/index.rhtml
0 → 100644
| ... | ... | @@ -0,0 +1,154 @@ |
| 1 | +<% extend PairwisePlugin::Helpers::ViewerHelper %> | |
| 2 | +<% extend PairwisePlugin::Helpers::SuggestionsHelper %> | |
| 3 | + | |
| 4 | +<%= pairwise_plugin_stylesheet %> | |
| 5 | + | |
| 6 | +<h1><%= _("Pairwise Question") %></h1> | |
| 7 | +<h4><%= _("Question text" ) %>: </h4><span><%= @pairwise_content.name %></span> | |
| 8 | +<div class="result_label"> | |
| 9 | + <%= pairwise_result_link _("Results"), @pairwise_content %> | |
| 10 | +</div> | |
| 11 | +<% if flash[:error] %> | |
| 12 | + <div class="error"> | |
| 13 | + <%= flash[:error] %> | |
| 14 | + </div> | |
| 15 | +<% end %> | |
| 16 | +<% if flash[:notice] %> | |
| 17 | + <div class="notice"> | |
| 18 | + <%= flash[:notice] %> | |
| 19 | + </div> | |
| 20 | +<% end %> | |
| 21 | + | |
| 22 | +<br /> | |
| 23 | + | |
| 24 | +<style type="text/css" media="all"> | |
| 25 | + | |
| 26 | + #tab_ideas_suggestions td.selected_tab { | |
| 27 | + background-color: #f0f0f0; | |
| 28 | + } | |
| 29 | + | |
| 30 | + #tab_ideas_suggestions td.not_selected_tab { | |
| 31 | + background-color: white; | |
| 32 | + } | |
| 33 | + | |
| 34 | + #tab_ideas_suggestions td.not_used_tab { | |
| 35 | + background-color: white; | |
| 36 | + border-bottom: 0px; | |
| 37 | + } | |
| 38 | + | |
| 39 | + #tab_ideas_suggestions { | |
| 40 | + background-color: #f0f0f0; | |
| 41 | + } | |
| 42 | + | |
| 43 | + #tab_ideas_suggestions tr { | |
| 44 | + border-bottom: 1px solid #c0c0c0; | |
| 45 | + } | |
| 46 | + | |
| 47 | + #pairwise_search tr { | |
| 48 | + background-color: white; | |
| 49 | + } | |
| 50 | + | |
| 51 | + .pairwise_search_field { | |
| 52 | + border: 1px solid #c0c0c0; | |
| 53 | + background-color:white; | |
| 54 | + width: 100%; | |
| 55 | + height: 25px; | |
| 56 | + } | |
| 57 | + | |
| 58 | + .selected_column { | |
| 59 | + background-color: #f0f0f0; | |
| 60 | + } | |
| 61 | + | |
| 62 | + .not_selected_column { | |
| 63 | + background-color: #ffffff; | |
| 64 | + } | |
| 65 | + | |
| 66 | + .soAscending { | |
| 67 | + background:url(/designs/icons/default/outras/16x16/actions/go-up.gif) no-repeat 99% 60% #f0f0f0; | |
| 68 | + } | |
| 69 | + .soDescending { | |
| 70 | + background:url(/designs/icons/default/outras/16x16/actions/go-down.gif) no-repeat 99% 60% #f0f0f0; | |
| 71 | + } | |
| 72 | + | |
| 73 | +</style> | |
| 74 | + | |
| 75 | +<table border="0" id="tab_ideas_suggestions"> | |
| 76 | + <tr> | |
| 77 | + <td align="center" width="50%" class="<%= ! has_param_pending_choices? ? "selected_tab" : "not_selected_tab" %>"> | |
| 78 | + <h5><%= link_to_if has_param_pending_choices?, _('Ideas'), :pending => '' %></h5> | |
| 79 | + </td> | |
| 80 | + <td align="center" width="50%" colspan="2" class="<%= has_param_pending_choices? ? "selected_tab" : "not_selected_tab" %>"> | |
| 81 | + <h5><%= link_to_if ! has_param_pending_choices?, _('Suggestions'), :pending => '1', :reproved => '' %></h5> | |
| 82 | + </td> | |
| 83 | + </tr> | |
| 84 | + <% if params[:pending] == '1' %> | |
| 85 | + <tr> | |
| 86 | + <td align="center" class="not_used_tab"> </td> | |
| 87 | + <td align="center" width="25%" class="<%= ! has_param_reproved_choices? ? "selected_tab" : "not_selected_tab" %>"> | |
| 88 | + <%= link_to_if has_param_reproved_choices?, _('Pending'), :pending => '1', :reproved => '' %> | |
| 89 | + </td> | |
| 90 | + <td align="center" width="25%" class="<%= has_param_reproved_choices? ? "selected_tab" : "not_selected_tab" %>"> | |
| 91 | + <%= link_to_if ! has_param_reproved_choices?, _('Reproved'), :pending => '1', :reproved => '1' %> | |
| 92 | + </td> | |
| 93 | + </tr> | |
| 94 | + <% end %> | |
| 95 | +</table> | |
| 96 | + | |
| 97 | +<br /> | |
| 98 | + | |
| 99 | +<% form_for( | |
| 100 | + :filter, { | |
| 101 | + :action => :index, | |
| 102 | + :controller => 'pairwise_plugin_suggestions', | |
| 103 | + :profile => profile.identifier | |
| 104 | + }) do %> | |
| 105 | +<table border="0" id="pairwise_search"> | |
| 106 | + <tr> | |
| 107 | + <td> | |
| 108 | + <%= hidden_field_tag 'pending', params[:pending] %> | |
| 109 | + <%= hidden_field_tag 'reproved', params[:reproved] %> | |
| 110 | + <%= text_field_tag( | |
| 111 | + 'filter[data]', | |
| 112 | + params[:filter] ? params[:filter][:data]:'', | |
| 113 | + :placeholder => _('Type words about ideas/suggestions you\'re looking for'), | |
| 114 | + :class => "pairwise_search_field" | |
| 115 | + ) %> | |
| 116 | + </td> | |
| 117 | + <td width="40px"><%= submit_button :search, _('Search') %></td> | |
| 118 | + </tr> | |
| 119 | +</table> | |
| 120 | +<% end %> | |
| 121 | + | |
| 122 | +<br /> | |
| 123 | + | |
| 124 | +<table class="pairwise_choices_table"> | |
| 125 | + <tr> | |
| 126 | + <th class="<%= class_to_order_column("data", params[:order]) %>"> | |
| 127 | + <%= link_to_sort_choices(@pairwise_content, _("Text"), "data") %> | |
| 128 | + </th> | |
| 129 | + <th class="<%= class_to_order_column("created_date", params[:order]) %>"> | |
| 130 | + <%= link_to_sort_choices(@pairwise_content, _("Date"), "created_date") %> | |
| 131 | + </th> | |
| 132 | + <th class="<%= class_to_order_column("visitor_identifier", params[:order]) %>"> | |
| 133 | + <%= link_to_sort_choices(@pairwise_content, _("Author"), "visitor_identifier") %> | |
| 134 | + </th> | |
| 135 | + <th></th> | |
| 136 | + </tr> | |
| 137 | + | |
| 138 | + <% @choices.each do |choice| %> | |
| 139 | + <tr> | |
| 140 | + <td width="270px"><%= choice.data %></td> | |
| 141 | + <td><%= show_date choice.created_at %></td> | |
| 142 | + <td width="105px" ><%= choice.user_created ? choice.creator_identifier : profile.identifier %></td> | |
| 143 | + <td width="50px"> | |
| 144 | + <%= link_to_edit_choice(@pairwise_content, choice) unless choice.reproved %> | |
| 145 | + <% unless choice.active || choice.reproved %> | |
| 146 | + | | |
| 147 | + <%= link_to_approve_choice(@pairwise_content, choice, params)%> | |
| 148 | + | <%= link_to_reprove_idea @pairwise_content, choice, 'reprove', params %> | |
| 149 | + <% end %> | |
| 150 | + </td> | |
| 151 | + </tr> | |
| 152 | + <% end %> | |
| 153 | +</table> | |
| 154 | +<%= pagination_for_choices(@choices) %> | ... | ... |