Commit df1970e524190dcf19f8599b1b2745507050ea35

Authored by Leandro Santos
1 parent 998a5390

removing pairwise plugin from stable core

Showing 75 changed files with 0 additions and 7365 deletions   Show diff stats
plugins/pairwise/Gemfile
... ... @@ -1,5 +0,0 @@
1   -gem 'vcr'
2   -
3   -group :test do
4   - gem 'webmock'
5   -end
plugins/pairwise/README
plugins/pairwise/controllers/pairwise_plugin_admin_controller.rb
... ... @@ -1,14 +0,0 @@
1   -class PairwisePluginAdminController < PluginAdminController
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
... ... @@ -1,151 +0,0 @@
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', :layout => "embeded", :locals => locals
12   - else
13   - render 'content_viewer/prompt', :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/load_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/load_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/load_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/load_result.rjs'
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
... ... @@ -1,80 +0,0 @@
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
... ... @@ -1,24 +0,0 @@
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
... ... @@ -1,15 +0,0 @@
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
16 0 \ No newline at end of file
plugins/pairwise/dependencies.rb
plugins/pairwise/install.rb
... ... @@ -1,2 +0,0 @@
1   -system "gem install --user-install webmock -v 1.17"
2   -system "gem install --user-install vcr -v 2.8.0"
3 0 \ No newline at end of file
plugins/pairwise/lib/ext/profile.rb
... ... @@ -1,5 +0,0 @@
1   -require_dependency 'profile'
2   -
3   -Profile.class_eval do
4   - has_many :questions, :source => 'articles', :class_name => 'PairwisePlugin::PairwiseContent', :order => 'start_date'
5   -end
6 0 \ No newline at end of file
plugins/pairwise/lib/pairwise/choice.rb
... ... @@ -1,7 +0,0 @@
1   -class Pairwise::Choice < ActiveResource::Base
2   - extend Pairwise::Resource
3   -
4   - self.element_name = "choice"
5   - self.format = :xml
6   -
7   -end
plugins/pairwise/lib/pairwise/client.rb
... ... @@ -1,197 +0,0 @@
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   -
plugins/pairwise/lib/pairwise/error.rb
... ... @@ -1,2 +0,0 @@
1   -class Pairwise::Error < StandardError
2   -end
plugins/pairwise/lib/pairwise/prompt.rb
... ... @@ -1,10 +0,0 @@
1   -class Pairwise::Prompt < ActiveResource::Base
2   - extend Pairwise::Resource
3   -
4   - self.element_name = "prompt"
5   - self.format = :xml
6   -
7   - # extend Resource
8   - # self.site = self.site + "questions/:question_id/"
9   - #attr_accessor :name, :question_text, :question_ideas
10   -end
plugins/pairwise/lib/pairwise/question.rb
... ... @@ -1,109 +0,0 @@
1   -class Pairwise::Question < ActiveResource::Base
2   - extend Pairwise::Resource
3   -
4   - self.element_name = "question"
5   - self.format = :xml
6   -
7   - def get_choices(filter=nil, order=nil)
8   - Pairwise::Choice.find(
9   - :all,
10   - :params => {
11   - :question_id => self.id,
12   - :filter => filter,
13   - :order => order
14   - })
15   - end
16   -
17   - def choices_include_inactive
18   - Pairwise::Choice.find(:all, :params => {:question_id => self.id , :include_inactive => true})
19   - end
20   -
21   - def pending_choices(filter=nil, order=nil)
22   - find_options = {
23   - :question_id => self.id,
24   - :include_inactive => true,
25   - :inactive_ignore_flagged => 1,
26   - :filter => filter,
27   - :order => order
28   - }
29   -
30   - Pairwise::Choice.find(:all, :params => find_options)
31   - end
32   -
33   - def reproved_choices(filter=nil, order=nil)
34   - find_options = {
35   - :question_id => self.id,
36   - :include_inactive => true,
37   - :reproved => 1,
38   - :filter => filter,
39   - :order => order
40   - }
41   -
42   - Pairwise::Choice.find(:all, :params => find_options)
43   - end
44   -
45   - def find_choice(id)
46   - Pairwise::Choice.find(id, :params => {:question_id => self.id, :include_inactive => true })
47   - end
48   -
49   - alias_method :choices, :get_choices
50   -
51   - def has_choice_with_text?(text)
52   - return filter_choices_with_text(text).size > 0
53   - end
54   -
55   - def get_choice_with_text(text)
56   - choices_selected = filter_choices_with_text(text)
57   - nil if choices_selected.size == 0
58   - choices_selected.first
59   - end
60   -
61   - def filter_choices_with_text(text)
62   - get_choices.select { |c| c if c.data.eql?(text) }
63   - end
64   -
65   - # return visitors whom suggested ideas
66   - def get_ideas_contributors(options=nil)
67   - options = {:page => 1}
68   - options.merge!(options) if options.is_a? Hash
69   - Pairwise::Visitor.find(:all, :params => {:question_id => id, :ideas_count => 1, :page => options[:page]})
70   - end
71   -
72   - def add_choice(text, visitor=nil)
73   - if(visitor.nil?)
74   - Pairwise::Choice.create(:data => text, :question_id => self.id, :active => "true")
75   - else
76   - Pairwise::Choice.create(:data => text, :question_id => self.id, :active => "true", :visitor_identifier => visitor)
77   - end
78   - end
79   -
80   - def self.find_with_prompt(id, creator_id, visitor_id)#, prompt_id=nil)
81   - question = Pairwise::Question.find(id,
82   - :params => {
83   - :creator_id => creator_id,
84   - :with_prompt => true,
85   - :with_appearance => true,
86   - :visitor_identifier => visitor_id
87   - })
88   - question.set_prompt(Pairwise::Prompt.find(question.picked_prompt_id, :params => {:question_id => id}))
89   - question
90   - end
91   -
92   - def set_prompt(prompt_object)
93   - @prompt = prompt_object
94   - end
95   -
96   - def prompt
97   - @prompt
98   - end
99   -
100   - def appearance_id
101   - if attributes["appearance_id"]
102   - attributes["appearance_id"]
103   - elsif prompt and prompt.respond_to? :appearance_id
104   - prompt.appearance_id
105   - else
106   - nil
107   - end
108   - end
109   -end
plugins/pairwise/lib/pairwise/resource.rb
... ... @@ -1,22 +0,0 @@
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
23 0 \ No newline at end of file
plugins/pairwise/lib/pairwise/visitor.rb
... ... @@ -1,7 +0,0 @@
1   -class Pairwise::Visitor < ActiveResource::Base
2   - extend Pairwise::Resource
3   -
4   - self.element_name = "visitor"
5   - self.format = :xml
6   -
7   -end
plugins/pairwise/lib/pairwise_plugin.rb
... ... @@ -1,37 +0,0 @@
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
plugins/pairwise/lib/pairwise_plugin/choices_related.rb
... ... @@ -1,14 +0,0 @@
1   -class PairwisePlugin::ChoicesRelated < ActiveRecord::Base
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   - attr_accessible :question, :choice_id, :parent_choice_id
9   -
10   - def self.related_choices_for choice_id
11   - PairwisePlugin::ChoicesRelated.find_all_by_choice_id(choice_id) + PairwisePlugin::ChoicesRelated.find_all_by_parent_choice_id(choice_id)
12   - end
13   -
14   -end
plugins/pairwise/lib/pairwise_plugin/helpers/suggestions_helper.rb
... ... @@ -1,73 +0,0 @@
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
74 0 \ No newline at end of file
plugins/pairwise/lib/pairwise_plugin/helpers/viewer_helper.rb
... ... @@ -1,169 +0,0 @@
1   -module PairwisePlugin::Helpers::ViewerHelper
2   -
3   - def choose_link(direction, pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil)
4   - link_target = { :controller => 'pairwise_plugin_profile',
5   - :profile => pairwise_content.profile.identifier,
6   - :action => 'choose', :id => pairwise_content.id, :question_id => question.id , :prompt_id => prompt.id,
7   - :choice_id => prompt.send("#{direction}_choice_id"), :direction => direction, :appearance_id => appearance_id}
8   - link_target.merge!(:embeded => 1) if embeded
9   - link_target.merge!(:source => source) if source
10   - loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content)
11   -
12   - content_tag(:div, prompt.send("#{direction}_choice_text"), :class => 'choice-text') +
13   - link_to_remote(_('Vote'), :loading => loading_javascript, :url => link_target, :html => {:class => 'vote-link'})
14   - end
15   -
16   - def choose_right_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil)
17   - choose_link('right', pairwise_content, question, prompt, embeded, source, appearance_id)
18   - end
19   -
20   - def choose_left_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil)
21   - choose_link('left', pairwise_content, question, prompt, embeded, source, appearance_id)
22   - end
23   -
24   - def skip_vote_open_function(pairwise_content)
25   - link_to_function _('Skip vote'), "jQuery('#skip_vote_reasons_#{pairwise_content.id}').slideToggle()"
26   - end
27   -
28   - def skip_vote_link(pairwise_content, question, prompt, embeded = false, source = nil, appearance_id = nil, reason = nil)
29   - link_target = {:controller => 'pairwise_plugin_profile',
30   - :profile => pairwise_content.profile.identifier,
31   - :action => 'skip_prompt', :id => pairwise_content.id,:question_id => question.id , :prompt_id => prompt.id,
32   - :appearance_id => appearance_id}
33   - link_target.merge!(:embeded => 1) if embeded
34   - link_target.merge!(:source => source) if source
35   - link_target.merge!(:appearance_id => appearance_id) if appearance_id
36   - link_target.merge!(:reason => reason) if reason
37   - link_text = reason ? reason : _('Skip vote')
38   - if reason
39   - loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content)
40   - "<li class='skip_vote_item'>" + link_to_remote(link_text, :loading => loading_javascript, :url => link_target) + "</li>"
41   - else
42   - link_to_remote(link_text, link_target)
43   - end
44   - end
45   -
46   - def pairwise_spinner_id(pairwise_content)
47   - return "pairwise_spinner#{pairwise_content.id}"
48   - end
49   - def pairwise_spinner(pairwise_content)
50   - text = content_tag :h5, _('Processing... please wait.')
51   - content_tag :div, text, :class => "spinner", :id => pairwise_spinner_id(pairwise_content)
52   - end
53   -
54   - def pairwise_spinner_show_function_call(pairwise_content)
55   - pairwise_spinner_show_function_name(pairwise_content) + "();"
56   - end
57   -
58   - def pairwise_hide_skip_call(pairwise_content)
59   - "jQuery('#skip_vote_reasons_#{pairwise_content.id}').hide();"
60   - end
61   -
62   - def pairwise_spinner_show_function_name(pairwise_content)
63   - "jQuery('##{pairwise_spinner_id(pairwise_content)}').fadeIn"
64   - end
65   -
66   -
67   - def pairwise_spinner_hide_function_call(pairwise_content)
68   - pairwise_spinner_hide_function_name(pairwise_content) + "();"
69   - end
70   -
71   - def pairwise_spinner_hide_function_name(pairwise_content)
72   - "jQuery('##{pairwise_spinner_id(pairwise_content)}').fadeOut"
73   - end
74   -
75   - def pairwise_user_identifier(user)
76   - if user.nil?
77   - is_external_vote ? "#{params[:source]}-#{request.session_options[:id]}" : "participa-#{request.session_options[:id]}"
78   - else
79   - user.identifier
80   - end
81   - end
82   -
83   - def pairwise_embeded_code(pairwise_content)
84   - embeded_url = url_for({:controller => "pairwise_plugin_profile",
85   - :profile => pairwise_content.profile.identifier,
86   - :action => "prompt",
87   - :id => pairwise_content.id,
88   - :question_id => pairwise_content.question.id,
89   - :embeded => 1,
90   - :source => "SOURCE_NAME",
91   - :only_path => false})
92   - embeded_code = "<iframe src='#{embeded_url}' style='width:100%;height:400px' frameborder='0' allowfullscreen ></iframe>"
93   -
94   - label = "<hr/>"
95   - label += content_tag :h5, _('Pairwise Embeded')
96   - textarea = text_area_tag 'embeded_code', embeded_code, {:style => "width: 100%; background-color: #ccc; font-weight:bold", :rows => 7}
97   - 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.")
98   - label + textarea + hint + "<hr/>"
99   - end
100   -
101   - def pairwise_edit_link(label, pairwise_content)
102   - link_target = myprofile_path(:controller => :cms, :profile => pairwise_content.profile.identifier, :action => :edit, :id => pairwise_content.id)
103   - link_to label, link_target
104   - end
105   -
106   - def pairwise_result_link(label, pairwise_content, embeded = false, options = {})
107   - link_target = pairwise_content.result_url
108   - link_target.merge!(:embeded => 1) if embeded
109   - link_to label, link_target, options
110   - end
111   -
112   - def pairwise_tab_remote_link(label, link_target, pairwise_content, embeded = false, options = {})
113   - link_target.merge!(:embeded => 1) if embeded
114   - loading_javascript = pairwise_spinner_show_function_call(pairwise_content) + pairwise_hide_skip_call(pairwise_content)
115   - link_to_remote label, :loading => loading_javascript, :url => link_target, :html => options
116   - end
117   -
118   - def pairwise_suggestion_url(question, embeded = false, source = nil)
119   - target = { :controller => :pairwise_plugin_profile, :profile => question.profile.identifier,:action => 'suggest_idea', :id => question.id }
120   - target.merge!({ :embeded => 1 }) if embeded
121   - target.merge!({ :source => source }) if source
122   - target
123   - end
124   -
125   - def is_external_vote
126   - params.has_key?("source") && !params[:source].empty?
127   - end
128   -
129   - def ideas_management_link(label, pairwise_content, user)
130   - return "" unless user
131   - return "" unless pairwise_content.allow_edit?(user)
132   - link_to label, :controller => :pairwise_plugin_suggestions, :profile => pairwise_content.profile.identifier, :action => :index, :id => pairwise_content.id
133   - end
134   -
135   - def has_param_pending_choices?
136   - params.has_key?("pending") && "1".eql?(params[:pending])
137   - end
138   -
139   - def has_param_reproved_choices?
140   - params.has_key?("reproved") && "1".eql?(params[:reproved])
141   - end
142   -
143   - def choices_showing_text
144   - ideas_or_suggestions_text = has_param_pending_choices? ? "Suggestions" : "Ideas"
145   - _("Showing") + " " + ideas_or_suggestions_text
146   - end
147   -
148   - def pairwise_span_arrow(index)
149   - content_tag :span, '', :class => (index == 0 ? 'active' : '')
150   - end
151   -
152   - def pairwise_group_row_classes(index)
153   - index == 0 ? 'row' : 'row secondary'
154   - end
155   -
156   - def pairwise_group_content_body(index, pairwise_content, prompt_id = nil)
157   - style = (index > 0) ? 'display:none' : ''
158   - content_tag :div, :class => "pairwise_inner_body", :id => "pairwise_inner_body_#{pairwise_content.id}", :style => style do
159   - render :partial => 'content_viewer/prompt_body',
160   - :locals => {
161   - :embeded => params[:embeded],
162   - :source => params[:source],
163   - :pairwise_content => pairwise_content,
164   - :question => nil
165   - }
166   - end
167   - end
168   -end
169   -
plugins/pairwise/lib/pairwise_plugin/pairwise_content.rb
... ... @@ -1,332 +0,0 @@
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 :validate_choices, :on => :create
9   -
10   - attr_accessible :pairwise_question_id, :allow_new_ideas, :choices, :choices_saved
11   -
12   - REASONS_ARRAY = [
13   - {:text => _("I like both ideas"), :compare => false},
14   - {:text => _("I think both ideas are the same"), :compare => false},
15   - {:text => _("I don't know enough about either idea"),:compare => false},
16   - {:text => _("I don't like either idea"), :compare => false},
17   - {:text => _("I don't know enough about: "),:compare => true},
18   - {:text => _("I just can't decide"),:compare => false}
19   - ]
20   -
21   - def initialize(*args)
22   - super(*args)
23   - self.published = false
24   - self.accept_comments = false
25   - self.notify_comments = false
26   - @next_prompt = nil
27   - end
28   -
29   - def has_next_prompt?
30   - @next_prompt.present?
31   - end
32   -
33   - alias_method :original_view_url, :view_url
34   -
35   - def result_url
36   - profile.url.merge(
37   - :controller => :pairwise_plugin_profile,
38   - :action => :result,
39   - :id => id)
40   - end
41   -
42   - def prompt_url
43   - profile.url.merge(
44   - :controller => :pairwise_plugin_profile,
45   - :action => :prompt_tab,
46   - :id => id)
47   - end
48   -
49   - def self.short_description
50   - 'Pairwise question'
51   - end
52   -
53   - def self.description
54   - 'Question managed by pairwise'
55   - end
56   -
57   - def to_html(options = {})
58   - source = options["source"]
59   - embeded = options.has_key? "embeded"
60   - prompt_id = options["prompt_id"]
61   - pairwise_content = self
62   - proc do
63   - locals = {:pairwise_content => pairwise_content, :source => source, :embeded => embeded, :prompt_id => prompt_id }
64   - render :file => 'content_viewer/prompt', :locals => locals
65   - end
66   - end
67   -
68   - def pairwise_client
69   - @pairwise_client ||= Pairwise::Client.build(profile.id, environment.settings[:pairwise_plugin])
70   - @pairwise_client
71   - end
72   -
73   -
74   - def prepare_prompt(user_identifier, prompt_id=nil)
75   - prepared_question = question
76   - if has_next_prompt?
77   - prepared_question.set_prompt @next_prompt
78   - else
79   - prepared_question = self.question_with_prompt_for_visitor(user_identifier, prompt_id)
80   - end
81   - prepared_question
82   - end
83   -
84   - def question
85   - begin
86   - @question ||= pairwise_client.find_question_by_id(pairwise_question_id)
87   - rescue Exception => error
88   - errors.add(:base, error.message)
89   - end
90   - @question
91   - end
92   -
93   - def question_with_prompt_for_visitor(visitor='guest', prompt_id=nil)
94   - pairwise_client.question_with_prompt(pairwise_question_id, visitor, prompt_id)
95   - end
96   -
97   - def description=(value)
98   - @description=value
99   - end
100   -
101   - def description
102   - begin
103   - @description ||= question.name
104   - rescue
105   - @description = ""
106   - end
107   - @description
108   - end
109   -
110   - def pending_choices(filter, order)
111   - if(question)
112   - @inactive_choices ||= question.pending_choices(filter, order)
113   - else
114   - []
115   - end
116   - end
117   -
118   - def reproved_choices(filter, order)
119   - @reproved_choices ||= question ? question.reproved_choices(filter, order) : []
120   - end
121   -
122   - def inactive_choices(options={})
123   - if(question)
124   - @inactive_choices ||= (question.choices_include_inactive - question.get_choices)
125   - else
126   - []
127   - end
128   - end
129   -
130   - def raw_choices(filter=nil, order=nil)
131   - return [] if pairwise_question_id.nil?
132   - @raw_choices ||= question ? question.get_choices(filter, order) : []
133   - end
134   -
135   - def choices
136   - if raw_choices.nil?
137   - @choices = []
138   - else
139   - begin
140   - @choices ||= question.get_choices.map {|q| { q.id.to_s => q.data } }
141   - rescue
142   - @choices = []
143   - end
144   - end
145   - @choices
146   - end
147   -
148   - def choices=(value)
149   - @choices = value
150   - end
151   -
152   - def choices_saved
153   - @choices_saved
154   - end
155   -
156   - def choices_saved=value
157   - @choices_saved = value
158   - end
159   -
160   - def vote_to(prompt_id, direction, visitor, appearance_id)
161   - raise _("Excepted question not found") if question.nil?
162   - next_prompt = pairwise_client.vote(question.id, prompt_id, direction, visitor, appearance_id)
163   - touch #invalidates cache
164   - set_next_prompt(next_prompt)
165   - next_prompt
166   - end
167   -
168   - def skip_prompt(prompt_id, visitor, appearance_id, reason=nil)
169   - next_prompt = pairwise_client.skip_prompt(question.id, prompt_id, visitor, appearance_id, reason)
170   - touch #invalidates cache
171   - set_next_prompt(next_prompt)
172   - next_prompt
173   - end
174   -
175   - def ask_skip_reasons(prompt)
176   - reasons = REASONS_ARRAY.map do |item|
177   - if item[:compare]
178   - [ item[:text] + prompt.left_choice_text, item[:text] + prompt.right_choice_text]
179   - else
180   - item[:text]
181   - end
182   - end
183   - reasons.flatten
184   - end
185   -
186   - def validate_choices
187   - errors.add(:base, _("Choices empty")) if choices.nil?
188   - errors.add(:base, _("Choices invalid format")) unless choices.is_a?(Array)
189   - errors.add(:base, _("Choices invalid")) if choices.size == 0
190   - choices.each do | choice |
191   - if choice.empty?
192   - errors.add(:base, _("Choice empty"))
193   - break
194   - end
195   - end
196   - end
197   -
198   - def update_choice(choice_id, choice_text, active)
199   - begin
200   - return pairwise_client.update_choice(question, choice_id, choice_text, active)
201   - rescue Exception => e
202   - errors.add(:base, N_("Choices:") + " " + N_(e.message))
203   - return false
204   - end
205   - end
206   -
207   - def approve_choice(choice_id)
208   - begin
209   - return pairwise_client.approve_choice(question, choice_id)
210   - rescue Exception => e
211   - errors.add(:base, N_("Choices:") + " " + N_(e.message))
212   - return false
213   - end
214   - end
215   -
216   - def flag_choice(choice_id, explanation=nil)
217   - pairwise_client.flag_choice(question, choice_id, explanation || 'reproved')
218   - end
219   -
220   - def find_choice id
221   - return nil if question.nil?
222   - question.find_choice id
223   - end
224   -
225   - def toggle_autoactivate_ideas(active_flag)
226   - pairwise_client.toggle_autoactivate_ideas(question, active_flag)
227   - end
228   -
229   - def send_question_to_service
230   - if new_record?
231   - @question = create_pairwise_question
232   - self.pairwise_question_id = @question.id
233   - toggle_autoactivate_ideas(false)
234   - else
235   - #add new choices
236   - unless @choices.nil?
237   - @choices.each do |choice_text|
238   - begin
239   - unless choice_text.empty?
240   - choice = pairwise_client.add_choice(pairwise_question_id, choice_text)
241   - pairwise_client.approve_choice(question, choice.id)
242   - end
243   - rescue Exception => e
244   - errors.add(:base, N_("Choices: Error adding new choice to question") + N_(e.message))
245   - return false
246   - end
247   - end
248   - end
249   - #change old choices
250   - unless @choices_saved.nil?
251   - @choices_saved.each do |id,data|
252   - begin
253   - pairwise_client.update_choice(question, id, data, true)
254   - rescue Exception => e
255   - errors.add(:base, (N_("Choices:") + " " + N_(e.message)))
256   - return false
257   - end
258   - end
259   - end
260   - begin
261   - pairwise_client.update_question(pairwise_question_id, name)
262   - rescue Exception => e
263   - errors.add(:base, (N_("Question not saved: ") + N_(e.message)))
264   - return false
265   - end
266   - end
267   - end
268   -
269   - def create_pairwise_question
270   - question = pairwise_client.create_question(name, choices)
271   - question
272   - end
273   -
274   - def ideas_contributors(options=nil)
275   - question.get_ideas_contributors(options)
276   - end
277   -
278   - def allow_new_ideas?
279   - allow_new_ideas
280   - end
281   -
282   - def add_new_idea(text, visitor=nil)
283   - return false unless allow_new_ideas?
284   - pairwise_client.add_new_idea(pairwise_question_id, text, visitor)
285   - end
286   -
287   - def join_choices(ids_choices_to_join, id_choice_elected, user)
288   - ids_choices_to_join.each do |id_choice|
289   - unless id_choice.eql?(id_choice_elected)
290   - choice = question.find_choice(id_choice)
291   - choice_related = PairwisePlugin::ChoicesRelated.new do |cr|
292   - cr.question = self
293   - cr.choice_id = choice.id
294   - cr.parent_choice_id = id_choice_elected
295   - cr.user = user
296   - cr.save!
297   - end
298   - end
299   - end
300   - end
301   -
302   - def copy(options = {})
303   - attrs = attributes.reject! { |key, value| ATTRIBUTES_NOT_COPIED.include?(key.to_sym) }
304   - attrs.merge!(options)
305   - obj = self.class.new(attrs)
306   - obj.pairwise_question_id = self.pairwise_question_id
307   - obj.allow_new_ideas = self.allow_new_ideas
308   - id = obj.send(:create_without_callbacks)
309   - raise "object not saved" unless id
310   - end
311   -
312   - def copy!(options = {})
313   - attrs = attributes.reject! { |key, value| ATTRIBUTES_NOT_COPIED.include?(key.to_sym) }
314   - attrs.merge!(options)
315   - #self.class.create!(attrs)
316   - obj = self.class.new(attrs)
317   - obj.pairwise_question_id = self.pairwise_question_id
318   - obj.allow_new_ideas = self.allow_new_ideas
319   - id = obj.send(:create_without_callbacks)
320   - raise "object not saved" unless id
321   - end
322   -
323   - def page_size
324   - 20
325   - end
326   -
327   -private
328   -
329   - def set_next_prompt(prompt)
330   - @next_prompt = Pairwise::Prompt.new(prompt["prompt"])
331   - end
332   -end
plugins/pairwise/lib/pairwise_plugin/pairwise_question_block.rb
... ... @@ -1,32 +0,0 @@
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   - proc 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
plugins/pairwise/lib/pairwise_plugin/questions_group_block.rb
... ... @@ -1,70 +0,0 @@
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   - proc 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
... ... @@ -1,126 +0,0 @@
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   - attr_accessible :group_description, :questions_ids, :random_sort
14   -
15   - def content(args={})
16   - block = self
17   - questions = questions.shuffle if(questions)
18   - #proc do
19   - # content = block_title(block.title)
20   - # content += ( question ? article_to_html(question,:gallery_view => false, :format => 'full').html_safe : _('No Question selected yet.') )
21   - #end
22   - proc do
23   - render :file => 'blocks/questions_group_list', :locals => {:block => block}
24   - end
25   - end
26   -
27   - def random_sort= value
28   - self.settings[:random_sort] = value
29   - end
30   -
31   - def random_sort
32   - self.settings[:random_sort]
33   - end
34   -
35   - def is_random?
36   - random_sort && !'0'.eql?(random_sort)
37   - end
38   -
39   - def contains_question?(id)
40   - if self.settings[:questions_ids]
41   - self.settings[:questions_ids].include?(id.to_s)
42   - else
43   - return false
44   - end
45   - end
46   -
47   - def questions_ids
48   - self.settings[:questions_ids]
49   - end
50   -
51   - def questions_ids= value
52   - if value.is_a?(Array)
53   - self.settings[:questions_ids] = value
54   - else
55   - self.settings[:questions_ids] = value.nil? ? [] : value.split(",")
56   - end
57   - self.settings[:questions_ids].delete('')
58   - end
59   -
60   - def questions_for_view
61   - result = nil
62   - if questions && questions.length > 0
63   - result = is_random? ? questions.shuffle : questions
64   - end
65   - result
66   - end
67   -
68   - def questions(reload = false)
69   - @questions = nil if reload
70   - if @questions || questions_ids
71   - begin
72   - @questions = []
73   - questions_ids.each do |id|
74   - @questions << Article.find(id)
75   - end
76   - rescue ActiveRecord::RecordNotFound
77   - # dangling reference, clear it
78   - @questions = []
79   - self.questions_ids = nil
80   - self.save!
81   - end
82   - end
83   - @questions
84   - end
85   -
86   - def questions=(arr)
87   - self.questions_ids = arr.select {|x| x.attribute[:id] }
88   - @questions = arr
89   - end
90   -
91   - def available_questions
92   - return [] if self.owner.nil?
93   - result = []
94   - conditions = {}
95   - if questions_ids && !questions_ids.empty?
96   - questions_ids.each do |id|
97   - if self.owner.kind_of?(Environment)
98   - question = self.owner.portal_community.questions.find(id)
99   - else
100   - question = self.owner.questions.find(id)
101   - end
102   - result << question
103   - end
104   - conditions = { :conditions => ['id not in (?)', questions_ids] }
105   - end
106   -
107   - if self.owner.kind_of?(Environment)
108   - result += self.owner.portal_community.questions.find(:all, conditions)
109   - else
110   - result += self.owner.questions.find(:all, conditions)
111   - end
112   - result
113   - end
114   -
115   - def self.expire_on
116   - { :profile => [:article], :environment => [:article] }
117   - end
118   -
119   - def timeout
120   - 1.hours
121   - end
122   -
123   - def embedable?
124   - true
125   - end
126   -end
plugins/pairwise/public/ajax-loader.gif

1.05 KB

plugins/pairwise/public/javascripts/pairwise.js
... ... @@ -1,117 +0,0 @@
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\">&nbsp;</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   - });
plugins/pairwise/public/style.css
... ... @@ -1,516 +0,0 @@
1   -.action-home-index div.pairwise_main .spinner {
2   - width: 94%;
3   -}
4   -
5   -.pairwise-plugin_pairwise-content #article-header .title {
6   - display: none;
7   -}
8   -
9   -#pairwise_main {
10   - text-align: center;
11   - width: auto;
12   -}
13   -
14   -#pairwise_main ul.pairwise_menu {
15   - background-color: white;
16   - color: #ECF2E7;
17   - text-align: right;
18   -}
19   -
20   -#pairwise_main ul.pairwise_menu li {
21   - display: inline;
22   -}
23   -
24   -#pairwise_main ul.pairwise_menu li a {
25   - color: #b3c4a6;
26   - font-size: 14px;
27   - padding: 1em;
28   - text-decoration: none;
29   -}
30   -
31   -#pairwise_main ul.pairwise_menu li a:hover{
32   - color: #497B16;
33   - background-color: #ECF2E7;
34   - border-radius: 10px 10px 0 0;
35   - border: 1px solid #b3c4a6;
36   - border-bottom: 0px;
37   - margin: -1px;
38   -}
39   -
40   -#pairwise_main ul.pairwise_menu li a.active{
41   - color: #497B16;
42   - background-color: #ECF2E7;
43   - border-radius: 10px 10px 0 0;
44   - border: 1px solid #b3c4a6;
45   - border-bottom: 0px;
46   -}
47   -
48   -#pairwise_main .pairwise_content {
49   - background-color: #ECF2E7;
50   - padding: 1em;
51   - overflow: hidden;
52   -}
53   -
54   -#pairwise_main .pairwise_body {
55   - background-color: white;
56   - border-radius: 7px 7px 7px 7px;
57   - display: block;
58   - font-size: 22px;
59   - margin: 0 0 0.5em;
60   - padding: 1em;
61   -}
62   -
63   -#pairwise_main .pairwise_call_for_action {
64   - color: #4B7421;
65   - font-size: 14px;
66   - line-height: 1.5em;
67   -}
68   -
69   -#pairwise_main .prompt {
70   - background: url("images/prompt_bg_normal.png") no-repeat center top #cfe1bf;
71   - border-width: 0px;
72   - max-width: 369px;
73   - height: 170px !important;
74   - padding: 10px 0;
75   - border-width: 0 !important;
76   - border-radius: 10px;
77   - position: relative;
78   -}
79   -
80   -#pairwise_main .prompt a.vote-link:hover {
81   - background-color: #2D4D0D;
82   -}
83   -
84   -#pairwise_main .prompt.left{
85   - background-position: 51% top;
86   - float: left;
87   -}
88   -
89   -#pairwise_main .prompt.right{
90   - background-position: 50% top;
91   - float: right;
92   -}
93   -
94   -#pairwise_main .prompt a.vote-link {
95   - text-decoration: none;
96   - color: rgb(243, 243, 243) !important;
97   - font-weight: bold;
98   - font-size: 18px;
99   - display: block;
100   - padding: 10px;
101   - width: 80%;
102   - height: 21px;
103   - background-color: #548A1C;
104   - position: absolute;
105   - bottom: 10px;
106   - left: 5%;
107   - border-radius: 10px;
108   - margin-left: auto;
109   - margin-right: auto;
110   -}
111   -#pairwise_main .prompt .choice-text {
112   - color: #2a2d28;
113   - font-size: 14px;
114   - padding: 1px;
115   -}
116   -
117   -#pairwise_main .separator {
118   - background-color: #CCCCCC;
119   - display: inline-block;
120   - float: none;
121   - height: 170px;
122   - margin-top: 8px;
123   - width: 1px;
124   -}
125   -
126   -
127   -#pairwise_main .skip_vote {
128   - width: 200px !important;
129   - text-align: center;
130   - padding: 0;
131   - border-width: 0px;
132   - background-color: transparent !important;
133   -}
134   -
135   -#pairwise_main .skip_vote a {
136   - display: inline-block;
137   - height: 1px;
138   - line-height: 0;
139   - padding: 1em 0;
140   - text-decoration: none;
141   - width: 200px;
142   -}
143   -
144   -#pairwise_main .skip_vote_reasons {background-color: #7D8874;padding-top: 0 !important;}
145   -
146   -#pairwise_main .skip_vote_reasons ul {margin: 0; padding: 1em;}
147   -
148   -#pairwise_main .skip_vote_reasons ul li {color: white; padding: 0.5em 0.5em 0.5em 2em; text-align: left;}
149   -
150   -#pairwise_main .skip_vote_reasons ul li:hover{background-color:#666;}
151   -
152   -#pairwise_main .skip_vote_reasons ul li a {color: white;text-decoration: none;font-size: 14px;}
153   -
154   -#pairwise_main #suggestions_box {
155   - display: block !important;
156   - margin-top: 15px;
157   - padding: 10px;
158   - text-align: left;
159   -}
160   -
161   -#pairwise_main #suggestions_box span {
162   - color: #4B7421;
163   - font-size: 15px;
164   - font-weight: bold;
165   - text-align: left;
166   - text-transform: uppercase;
167   -}
168   -
169   -#pairwise_main .suggestion_form {}
170   -
171   -#pairwise_main #suggestion_box_fields {}
172   -
173   -#pairwise_main .div_text_input_container {width: 100%;}
174   -
175   -#pairwise_main .div_text_input_container .div_text_input {
176   - display: inline-block;
177   - width: 80%;
178   -}
179   -
180   -#pairwise_main .div_text_input_container .div_text_input textarea {
181   - border: 1px solid #CCCCCC;
182   - border-radius: 0 0 0 0 !important;
183   -}
184   -
185   -#pairwise_main .div_text_input_container .div_text_input .jqEasyCounterMsg {color: #7D8874 !important;font-size: 13px;}
186   -
187   -#pairwise_main .div_text_input_container .suggest_idea_btn {
188   - display: inline-block;
189   - margin-left: 5%;
190   - vertical-align: top;
191   - width: 14%;
192   -}
193   -
194   -#pairwise_main .div_text_input_container .suggest_idea_btn input#new_idea_button{
195   - background: url("images/botao-enviar-pairwise.png") no-repeat top center transparent;
196   - border-radius: 0px;
197   - cursor: pointer;
198   - display: block;
199   - min-height: 71px;
200   - padding: 5px 10px;
201   - width: 93px;
202   - border-width: 0;
203   -}
204   -
205   -div.pairwise_group_list_container .arrow span.active {
206   - background-position: center top;
207   -}
208   -/* */
209   -
210   -
211   -div#pairwise_form_fields textarea {
212   - width: 100%;
213   - margin-top: 5px;
214   - height:30px;
215   -
216   -}
217   -
218   -#pairwise_main {
219   - width: 100%;
220   - padding: 10px;
221   -}
222   -
223   -.vote_question {
224   -
225   -}
226   -
227   -#pairwise_main div.footer {
228   - text-align:right;
229   - padding: 20px;
230   -}
231   -
232   -#pairwise_main div.prompt {
233   - width: 45%;
234   - float:none;
235   - color:white;
236   - min-height: 30px;
237   - height:auto;
238   - word-wrap: break-word;
239   - font-size: 12pt;
240   - text-align: center;
241   - display: inline-block;
242   - vertical-align: top;
243   -
244   -}
245   -
246   -#pairwise_main div#suggestions_box {
247   - padding: 10px;
248   - margin-top: 15px;
249   -}
250   -
251   -#pairwise_main div#suggestion_box_loading {
252   - color: black;
253   - border: 1px solid;
254   - border-radius: 7px;
255   - -webkit-border-radius: 7px;
256   - -moz-border-radius: 7px;
257   - border-color: #ccc;
258   - border-width: 1px;
259   - border-style: solid;
260   - padding: 10px;
261   - margin-top: 15px;
262   - text-align: center;
263   -}
264   -
265   -
266   -#pairwise_main div#suggestions_box textarea{
267   - width: 100%;
268   - border: 1px solid #99999;
269   - border-radius: 5px;
270   - -webkit-border-radius: 5px;
271   - -moz-border-radius: 5px;
272   -}
273   -
274   -#pairwise_main div#suggestions_box #new_idea_button{
275   - background-color: #DDD;
276   - padding: 5px 10px 5px 10px;
277   - cursor: pointer;
278   - border-radius: 5px;
279   - -webkit-border-radius: 5px;
280   - -moz-border-radius: 5px;
281   - font-size: 16pt;
282   - color: rgb(133, 133, 151);
283   -}
284   -
285   -#pairwise_main div#suggestions_box div.suggestion_header {
286   - text-align: right;
287   - color: blue;
288   -}
289   -
290   -#pairwise_main div#suggestions_box #new_idea_button:hover{
291   - boder-color: gray;
292   -}
293   -
294   -#pairwise_main #suggestions_box span.close_button {
295   - cursor: pointer;
296   -}
297   -
298   -#pairwise_main #suggestions_box span.close_button:hover {
299   - cursor: pointer;
300   - text-decoration: underline;
301   -}
302   -
303   -
304   -#pairwise_main div.show_new_idea_box {
305   - width: 150px;
306   - float:none;
307   - color:white;
308   - min-height: 18px;
309   - height:auto;
310   - padding: 0.5em;
311   - word-wrap: break-word;
312   - font-size: 12pt;
313   - background-color: #01bb00;
314   - text-align: center;
315   - border-radius: 7px;
316   - -webkit-border-radius: 7px;
317   - -moz-border-radius: 7px;
318   - border-color:#CCCCCC;
319   - border-width: 1px;
320   - border-style: solid;
321   - vertical-align: top;
322   - margin-top: 12px;
323   - margin-left: auto;
324   - margin-right: auto;
325   - text-align: center;
326   - clear: both;
327   -}
328   -
329   -#pairwise_main div.show_new_idea_box a{
330   - color: white;
331   - text-decoration: none;
332   -}
333   -
334   -#pairwise_main div.show_new_idea_box a:hover{
335   - text-decoration: underline;
336   -}
337   -
338   -#pairwise_main div.skip_vote {
339   - width: 150px;
340   - float:none;
341   - min-height: 18px;
342   - height:auto;
343   - padding: 0.5em;
344   - word-wrap: break-word;
345   - font-size: 12pt;
346   - text-align: center;
347   - vertical-align: top;
348   - margin-top: 12px;
349   - margin-left: auto;
350   - margin-right: auto;
351   - text-align: center;
352   -}
353   -
354   -
355   -#pairwise_main div.skip_vote_reasons.show {
356   - display:block;
357   -}
358   -
359   -#pairwise_main div.skip_vote_reasons {
360   - display:none;
361   - padding:20px;
362   - margin-bottom: 10px;
363   -}
364   -
365   -#pairwise_main div.skip_vote_item {
366   - width:100%;
367   - margin-bottom: 15px;
368   - padding-left: 5px;
369   - padding-right: 5px;
370   - float:left;
371   - background-color:#ccc;
372   - height: 3em;
373   - text-align: center;
374   - vertical-align: center;
375   - min-height: 2em;
376   - padding-top: 10px;
377   - border-width: 1px;
378   - border-style: solid;
379   - border-radius: 7px;
380   - -webkit-border-radius: 7px;
381   - -moz-border-radius: 7px;
382   - border-color:#CCCCCC;
383   -}
384   -
385   -#pairwise_main div.skip_vote a{
386   - color: rgb(219, 162, 42);
387   - text-decoration: none;
388   - width: 100%;
389   -}
390   -
391   -#pairwise_main div.skip_vote a:hover{
392   - text-decoration: underline;
393   - width: 100%;
394   -}
395   -
396   -.result_label {
397   - padding: 15px 0px;
398   -}
399   -
400   -div.choices_filter {
401   - width: 100%;
402   - text-align: right;
403   -}
404   -
405   -table.pairwise_choices_table {
406   - border: 1px #fcfcfc solid;
407   - border-radius: 7px;
408   - -webkit-border-radius: 7px;
409   - -moz-border-radius: 7px;
410   -}
411   -
412   -table.pairwise_choices_table th{
413   - font-weight: bolder;
414   - text-align: left;
415   -}
416   -
417   -
418   -
419   -div.pairwise_group_list_container {
420   - font-family: 'Open Sans';
421   -}
422   -
423   -div.pairwise_group_list_container .row {
424   - font-size: 14px;
425   - height: 40px;
426   - width:100%;
427   - background-color: #F8C300;
428   - vertical-align: middle;
429   - margin-top:10px;
430   - margin-bottom:auto;
431   - padding:0px;
432   - cursor: auto;
433   -}
434   -
435   -div.pairwise_group_list_container .row p {
436   - line-height: 30px;
437   - margin: auto;
438   - padding-bottom: 5px;
439   - padding-top: 5px;
440   -}
441   -
442   -
443   -div.pairwise_group_list_container .title{
444   - display: inline-block;
445   - color: #2F5707;
446   - Height: 40px;
447   - padding-left: 20px;
448   -}
449   -
450   -div.pairwise_group_list_container .number{
451   - display: inline-block;
452   - left: 0px;
453   - background-color: #2F5707;
454   - width: 40px;
455   - text-align: center;
456   - color: #F8C300;
457   - }
458   -
459   -div.pairwise_group_list_container .row.secondary {
460   - cursor: pointer;
461   - background-color: #497B16;
462   -}
463   -
464   -div.pairwise_group_list_container .row.secondary .title {
465   - color: white;
466   -}
467   -
468   -
469   -div.pairwise_group_list_container .row.secondary .number {
470   - color: white;
471   -}
472   -
473   -div.pairwise_group_list_container .arrow{
474   - display: inline-block;
475   - position: absolute;
476   - right: 20px;
477   - margin-top: 10px;
478   -}
479   -
480   -div.pairwise_group_list_container .row.secondary .arrow span {
481   - background: url('/designs/themes/participa-theme/images/arrow_right.jpg') no-repeat center;
482   - border: 0px;
483   - width: 25px;
484   - height: 25px;
485   - display: inline-block;
486   - cursor: pointer;
487   -}
488   -
489   -div.pairwise_group_list_container .row .arrow span {
490   - cursor: auto;
491   - border: 0px;
492   - width: 25px;
493   - height: 25px;
494   - display: inline-block;
495   - background: url('/designs/themes/participa-theme/images/arrow_down.jpg') no-repeat center;
496   -
497   -}
498   -
499   -div.pairwise_main .spinner {
500   - position: absolute;
501   - text-align: center;
502   - width: 95%;
503   - height: 190px;
504   - display: none;
505   - z-index: 999;
506   - background-color: #ECF2E7;
507   -}
508   -
509   -div.pairwise_main .spinner h5{
510   - padding-top: 30px;
511   -}
512   -
513   -#pairwise_main .pairwise_content .total_votes {
514   - float: right;
515   - color: #999;
516   -}
plugins/pairwise/test/fixtures/http_stub_fixtures.rb
... ... @@ -1,22 +0,0 @@
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
plugins/pairwise/test/fixtures/pairwise_content_fixtures.rb
... ... @@ -1,80 +0,0 @@
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
plugins/pairwise/test/fixtures/vcr_cassettes/flag_choice_as_reproved.yml
... ... @@ -1,269 +0,0 @@
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
... ... @@ -1,62 +0,0 @@
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
... ... @@ -1,644 +0,0 @@
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
... ... @@ -1,132 +0,0 @@
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
... ... @@ -1,131 +0,0 @@
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
... ... @@ -1,129 +0,0 @@
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
... ... @@ -1,221 +0,0 @@
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
... ... @@ -1,228 +0,0 @@
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
... ... @@ -1,61 +0,0 @@
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
... ... @@ -1,61 +0,0 @@
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
... ... @@ -1,199 +0,0 @@
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
... ... @@ -1,121 +0,0 @@
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
... ... @@ -1,309 +0,0 @@
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
... ... @@ -1,387 +0,0 @@
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
... ... @@ -1,305 +0,0 @@
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
... ... @@ -1,180 +0,0 @@
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
... ... @@ -1,357 +0,0 @@
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
... ... @@ -1,238 +0,0 @@
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
plugins/pairwise/test/unit/pairwise/client_test.rb
... ... @@ -1,176 +0,0 @@
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
177 0 \ No newline at end of file
plugins/pairwise/test/unit/pairwise_plugin/choices_related_test.rb
... ... @@ -1,53 +0,0 @@
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.include?(:choice_id)
14   -
15   - choices_related.choice_id = 1
16   - choices_related.valid?
17   - assert !choices_related.errors.include?(: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.include?(:parent_choice_id)
24   -
25   - choices_related.parent_choice_id = 1
26   - choices_related.valid?
27   - assert !choices_related.errors.include?(: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.include?(:question)
34   -
35   - choices_related.question = @pairwise_content
36   - choices_related.valid?
37   - assert !choices_related.errors.include?(: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
plugins/pairwise/test/unit/pairwise_plugin/pairwise_content_test.rb
... ... @@ -1,199 +0,0 @@
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).at_least_once
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 @pairwise_content.errors[:base].blank?
88   - @pairwise_content.question
89   -
90   - assert !@pairwise_content.errors[:base].blank?
91   - assert_match /Any error/, @pairwise_content.errors[:base].first
92   - assert_match /422/, @pairwise_content.errors[:base].first
93   - end
94   -
95   - should 'send question to pairwise service' do
96   - question = Pairwise::Question.new(:id => 3, :name => 'Question 1')
97   - #expectations
98   - pairwise_content = PairwiseContentFixtures.new_pairwise_content
99   - pairwise_content.profile = @profile
100   - pairwise_content.expects(:valid?).returns(true)
101   - pairwise_content.expects(:create_pairwise_question).returns(question)
102   - pairwise_content.expects(:toggle_autoactivate_ideas).at_least_once
103   - #save should call before_save which sends the question to pairwise
104   - pairwise_content.save!
105   -
106   - #after save pairwise_question_id should store question id generated by pairwise
107   - assert_equal question.id, pairwise_content.pairwise_question_id
108   - end
109   -
110   - should 'send changes in choices to pairwise service' do
111   - @question = Pairwise::Question.new(:id => @pairwise_content.pairwise_question_id, :name => 'Question 1', :active => false)
112   - @pairwise_content.expects(:question).returns(@question).at_least_once
113   - @pairwise_content.expects(:pairwise_client).returns(@pairwise_client).at_least_once
114   - @pairwise_content.expects('new_record?').returns(false).at_least_once
115   - @pairwise_content.expects('valid?').returns(true).at_least_once
116   - @pairwise_content.choices = []
117   - @pairwise_content.choices_saved = {'1' => 'Choice 1', '2' => 'Choice 2'}
118   - #save should call update_choice in pairwise_client for each choice already saved
119   - @pairwise_client.expects(:update_choice).returns(true).times(2)
120   - @pairwise_content.save
121   - end
122   -
123   - should 'send new choices to pairwise_service' do
124   - @question = Pairwise::Question.new(:id => @pairwise_content.pairwise_question_id, :name => 'Question 1', :active => false)
125   - @pairwise_content.expects('new_record?').returns(false).at_least_once
126   - @pairwise_content.expects('valid?').returns(true).at_least_once
127   -
128   - @pairwise_content.expects(:pairwise_client).returns(@pairwise_client).at_least_once
129   - @pairwise_content.expects(:question).returns(@question).at_least_once
130   - @pairwise_content.choices = ['New Choice 1', 'New Choice 2']
131   - @pairwise_content.choices_saved = []
132   -
133   - @pairwise_client.expects(:approve_choice).returns(true).at_least_once
134   - choice_stub = Pairwise::Choice.new(:id=> 1, :data => 'txt')
135   - @pairwise_client.expects(:add_choice).with(@pairwise_content.pairwise_question_id, "New Choice 1").returns(choice_stub)
136   - @pairwise_client.expects(:add_choice).with(@pairwise_content.pairwise_question_id, "New Choice 2").returns(choice_stub)
137   - @pairwise_client.expects(:update_question).with(@question.id, @question.name).returns(true)
138   - @pairwise_content.save
139   - puts @pairwise_content.errors.full_messages
140   - end
141   -
142   - should 'allow new ideas by default when created' do
143   - assert_equal true, @pairwise_content.allow_new_ideas?
144   - end
145   -
146   - should 'add new ideas suggestions when new ideas are allowed' do
147   - assert_equal true, @pairwise_content.allow_new_ideas?
148   - @question = Pairwise::Question.new(:id => @pairwise_content.pairwise_question_id, :name => 'Question 1', :active => false)
149   - @pairwise_content.expects(:pairwise_client).returns(@pairwise_client).at_least_once
150   - @pairwise_client.expects(:add_new_idea).with(@question.id, "New idea", nil).returns(true)
151   - assert_equal true, @pairwise_content.add_new_idea("New idea")
152   - end
153   -
154   - should 'not add new ideas suggestions when new ideas are not allowed' do
155   - assert_equal true, @pairwise_content.allow_new_ideas?
156   - @question = Pairwise::Question.new(:id => @pairwise_content.pairwise_question_id, :name => 'Question 1', :active => false)
157   - @pairwise_content.allow_new_ideas = false
158   - assert_equal false, @pairwise_content.add_new_idea("New idea")
159   - end
160   -
161   - should 'join similar choices' do
162   - pairwise_content = PairwiseContentFixtures.content_stub_with_3_choices
163   -
164   - assert_equal 3, pairwise_content.question.choices.size
165   -
166   - choices_to_join = pairwise_content.question.choices[1..2].map { |choice| choice.id }
167   - parent_choice = pairwise_content.question.choices[0].id
168   -
169   - pairwise_content.profile = @profile
170   - pairwise_content.stubs(:valid? => true)
171   - pairwise_content.stubs(:send_question_to_service => true)
172   - pairwise_content.join_choices(choices_to_join, parent_choice, user=nil)
173   -
174   - choices_related = PairwisePlugin::ChoicesRelated.related_choices_for(parent_choice)
175   - assert_equal 2, choices_related.size
176   - assert_equal 1, choices_related.select { |c| c.choice_id == 2}.size
177   - assert_equal 1, choices_related.select { |c| c.choice_id == 3 }.size
178   - end
179   -
180   - # should 'skip prompt' do
181   -
182   - # end
183   -
184   - should 'ask skip prompt reasons' do
185   - 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})
186   - reasons = @pairwise_content.ask_skip_reasons(prompt)
187   -
188   - assert_not_nil reasons
189   - assert_equal 7, reasons.size
190   -
191   - assert reasons[0].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[0][:text]
192   - assert reasons[1].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[1][:text]
193   - assert reasons[2].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[2][:text]
194   - assert reasons[3].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[3][:text]
195   - assert reasons[4].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[4][:text]
196   - assert reasons[5].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[4][:text]
197   - assert reasons[6].include? PairwisePlugin::PairwiseContent::REASONS_ARRAY[5][:text]
198   - end
199   -end
plugins/pairwise/test/unit/pairwise_plugin/questions_group_block_test.rb
... ... @@ -1,46 +0,0 @@
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_equivalent [@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.html.erb
... ... @@ -1,46 +0,0 @@
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.html.erb
... ... @@ -1,19 +0,0 @@
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 %>
20 0 \ No newline at end of file
plugins/pairwise/views/box_organizer/pairwise_plugin/_questions_group_list_block.html.erb
... ... @@ -1,34 +0,0 @@
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
... ... @@ -1,19 +0,0 @@
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
... ... @@ -1,47 +0,0 @@
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>
48 0 \ No newline at end of file
plugins/pairwise/views/content_viewer/_menu.html.erb
... ... @@ -1,12 +0,0 @@
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.html.erb
... ... @@ -1,21 +0,0 @@
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">
14   - <%= choose_left_link(pairwise_content, question, question.prompt, embeded, source, question.appearance_id) %>
15   - </div>
16   - <div class="separator"></div>
17   - <div class="prompt right">
18   - <%= choose_right_link(pairwise_content, question, question.prompt, embeded, source, question.appearance_id ) %>
19   - </div>
20   - <% end %>
21   -</div>
plugins/pairwise/views/content_viewer/_pairwise_skips.html.erb
... ... @@ -1,5 +0,0 @@
1   -<ul>
2   - <% pairwise_content.ask_skip_reasons(question.prompt).each do |reason| %>
3   - <%= skip_vote_link(pairwise_content, question, question.prompt, embeded, source, question.appearance_id, reason ) %>
4   - <% end %>
5   -</ul>
6 0 \ No newline at end of file
plugins/pairwise/views/content_viewer/_prompt_body.html.erb
... ... @@ -1,37 +0,0 @@
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><%= _('Would you like to suggest an idea?') %> </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>
plugins/pairwise/views/content_viewer/_result.html.erb
... ... @@ -1,63 +0,0 @@
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].blank? %>
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   - <% end %>
50   -
51   - <% if @page.allow_edit?(user) %>
52   - <div class="embeded_code">
53   - <span class="embeded_code_link"><a href="javascript:;"><%= _("Show/Hide Embeded Code") %></a></span>
54   - <div id="pairwise_embeded_box" style="display:none">
55   - <%= pairwise_embeded_code(@page) %>
56   - </div>
57   - </div>
58   - <% end %>
59   -<% end %>
60   -
61   -</div>
62   -</div>
63   -
plugins/pairwise/views/content_viewer/load_prompt.rjs
... ... @@ -1,25 +0,0 @@
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)
plugins/pairwise/views/content_viewer/load_result.rjs
... ... @@ -1,10 +0,0 @@
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/content_viewer/prompt.html.erb
... ... @@ -1,5 +0,0 @@
1   -<% extend PairwisePlugin::Helpers::ViewerHelper %>
2   -
3   -<%= render :file => 'layouts/_javascript' if embeded %>
4   -
5   -<%= render :partial => 'content_viewer/prompt_body', :locals => {:embeded => embeded, :pairwise_content => pairwise_content, :question => nil, :source => (defined?(source) ? source : '') }%>
plugins/pairwise/views/content_viewer/prompt_tab.rjs
... ... @@ -1,14 +0,0 @@
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)
plugins/pairwise/views/environment_design/pairwise_plugin
... ... @@ -1 +0,0 @@
1   -../box_organizer/pairwise_plugin
2 0 \ No newline at end of file
plugins/pairwise/views/layouts/embeded.erb
... ... @@ -1,34 +0,0 @@
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.html.erb
... ... @@ -1,17 +0,0 @@
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.html.erb
... ... @@ -1,28 +0,0 @@
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   - <%= text_area :idea, :text, :maxlenght => 160, :rows => 4, :placeholder => _('Type your idea here') %>
13   - </div>
14   - <div class="suggest_idea_btn">
15   - <%= submit_button('', _("Send"), :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.html.erb
... ... @@ -1,8 +0,0 @@
1   -<% extend PairwisePlugin::Helpers::ViewerHelper %>
2   -
3   -<h1 class="title"><%= @page.name %></h1>
4   -
5   -<%= render :partial => "content_viewer/result", :locals => {
6   - :embeded => @embeded,
7   - :pairwise_content => @pairwise_content,
8   - } %>
plugins/pairwise/views/pairwise_plugin_profile/suggestion_form.rjs
... ... @@ -1,5 +0,0 @@
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"
6 0 \ No newline at end of file
plugins/pairwise/views/pairwise_plugin_suggestions/edit.html.erb
... ... @@ -1,16 +0,0 @@
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.html.erb
... ... @@ -1,152 +0,0 @@
1   -<% extend PairwisePlugin::Helpers::ViewerHelper %>
2   -<% extend PairwisePlugin::Helpers::SuggestionsHelper %>
3   -
4   -<h1><%= _("Pairwise Question") %></h1>
5   -<h4><%= _("Question text" ) %>: </h4><span><%= @pairwise_content.name %></span>
6   -<div class="result_label">
7   - <%= pairwise_result_link _("Results"), @pairwise_content %>
8   -</div>
9   -<% if flash[:error] %>
10   - <div class="error">
11   - <%= flash[:error] %>
12   - </div>
13   -<% end %>
14   -<% if flash[:notice] %>
15   - <div class="notice">
16   - <%= flash[:notice] %>
17   - </div>
18   -<% end %>
19   -
20   -<br />
21   -
22   -<style type="text/css" media="all">
23   -
24   - #tab_ideas_suggestions td.selected_tab {
25   - background-color: #f0f0f0;
26   - }
27   -
28   - #tab_ideas_suggestions td.not_selected_tab {
29   - background-color: white;
30   - }
31   -
32   - #tab_ideas_suggestions td.not_used_tab {
33   - background-color: white;
34   - border-bottom: 0px;
35   - }
36   -
37   - #tab_ideas_suggestions {
38   - background-color: #f0f0f0;
39   - }
40   -
41   - #tab_ideas_suggestions tr {
42   - border-bottom: 1px solid #c0c0c0;
43   - }
44   -
45   - #pairwise_search tr {
46   - background-color: white;
47   - }
48   -
49   - .pairwise_search_field {
50   - border: 1px solid #c0c0c0;
51   - background-color:white;
52   - width: 100%;
53   - height: 25px;
54   - }
55   -
56   - .selected_column {
57   - background-color: #f0f0f0;
58   - }
59   -
60   - .not_selected_column {
61   - background-color: #ffffff;
62   - }
63   -
64   - .soAscending {
65   - background:url(/designs/icons/default/outras/16x16/actions/go-up.gif) no-repeat 99% 60% #f0f0f0;
66   - }
67   - .soDescending {
68   - background:url(/designs/icons/default/outras/16x16/actions/go-down.gif) no-repeat 99% 60% #f0f0f0;
69   - }
70   -
71   -</style>
72   -
73   -<table border="0" id="tab_ideas_suggestions">
74   - <tr>
75   - <td align="center" width="50%" class="<%= ! has_param_pending_choices? ? "selected_tab" : "not_selected_tab" %>">
76   - <h5><%= link_to_if has_param_pending_choices?, _('Ideas'), :pending => '' %></h5>
77   - </td>
78   - <td align="center" width="50%" colspan="2" class="<%= has_param_pending_choices? ? "selected_tab" : "not_selected_tab" %>">
79   - <h5><%= link_to_if ! has_param_pending_choices?, _('Suggestions'), :pending => '1', :reproved => '' %></h5>
80   - </td>
81   - </tr>
82   - <% if params[:pending] == '1' %>
83   - <tr>
84   - <td align="center" class="not_used_tab">&nbsp;</td>
85   - <td align="center" width="25%" class="<%= ! has_param_reproved_choices? ? "selected_tab" : "not_selected_tab" %>">
86   - <%= link_to_if has_param_reproved_choices?, _('Pending'), :pending => '1', :reproved => '' %>
87   - </td>
88   - <td align="center" width="25%" class="<%= has_param_reproved_choices? ? "selected_tab" : "not_selected_tab" %>">
89   - <%= link_to_if ! has_param_reproved_choices?, _('Reproved'), :pending => '1', :reproved => '1' %>
90   - </td>
91   - </tr>
92   - <% end %>
93   -</table>
94   -
95   -<br />
96   -
97   -<%= form_for(
98   - :filter, {
99   - :action => :index,
100   - :controller => 'pairwise_plugin_suggestions',
101   - :profile => profile.identifier
102   - }) do %>
103   -<table border="0" id="pairwise_search">
104   - <tr>
105   - <td>
106   - <%= hidden_field_tag 'pending', params[:pending] %>
107   - <%= hidden_field_tag 'reproved', params[:reproved] %>
108   - <%= text_field_tag(
109   - 'filter[data]',
110   - params[:filter] ? params[:filter][:data]:'',
111   - :placeholder => _('Type words about ideas/suggestions you\'re looking for'),
112   - :class => "pairwise_search_field"
113   - ) %>
114   - </td>
115   - <td width="40px"><%= submit_button :search, _('Search') %></td>
116   - </tr>
117   -</table>
118   -<% end %>
119   -
120   -<br />
121   -
122   -<table class="pairwise_choices_table">
123   - <tr>
124   - <th class="<%= class_to_order_column("data", params[:order]) %>">
125   - <%= link_to_sort_choices(@pairwise_content, _("Text"), "data") %>
126   - </th>
127   - <th class="<%= class_to_order_column("created_date", params[:order]) %>">
128   - <%= link_to_sort_choices(@pairwise_content, _("Date"), "created_date") %>
129   - </th>
130   - <th class="<%= class_to_order_column("visitor_identifier", params[:order]) %>">
131   - <%= link_to_sort_choices(@pairwise_content, _("Author"), "visitor_identifier") %>
132   - </th>
133   - <th></th>
134   - </tr>
135   -
136   - <% @choices.each do |choice| %>
137   - <tr>
138   - <td width="270px"><%= choice.data %></td>
139   - <td><%= show_date choice.created_at %></td>
140   - <td width="105px" ><%= choice.user_created ? choice.creator_identifier : profile.identifier %></td>
141   - <td width="50px">
142   - <%= link_to_edit_choice(@pairwise_content, choice) unless choice.reproved %>
143   - <% unless choice.active || choice.reproved %>
144   - |
145   - <%= link_to_approve_choice(@pairwise_content, choice, params)%>
146   - | <%= link_to_reprove_idea @pairwise_content, choice, 'reprove', params %>
147   - <% end %>
148   - </td>
149   - </tr>
150   - <% end %>
151   -</table>
152   -<%= pagination_for_choices(@choices) %>
plugins/pairwise/views/profile_design/pairwise_plugin
... ... @@ -1 +0,0 @@
1   -../box_organizer/pairwise_plugin
2 0 \ No newline at end of file