diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb new file mode 100644 index 000000000..0c802e17f --- /dev/null +++ b/app/controllers/polls_controller.rb @@ -0,0 +1,13 @@ +class PollsController < ApplicationController + + load_and_authorize_resource + + def index + + end + + def show + + end + +end diff --git a/app/models/abilities/everyone.rb b/app/models/abilities/everyone.rb index 39a7f69f5..8424500a3 100644 --- a/app/models/abilities/everyone.rb +++ b/app/models/abilities/everyone.rb @@ -6,6 +6,7 @@ module Abilities can [:read, :map], Debate can [:read, :map, :summary], Proposal can :read, Comment + can :read, Poll can :read, SpendingProposal can :read, Legislation can :read, User diff --git a/app/views/polls/index.html.erb b/app/views/polls/index.html.erb new file mode 100644 index 000000000..3a1d7f3b5 --- /dev/null +++ b/app/views/polls/index.html.erb @@ -0,0 +1,3 @@ +<% @polls.each do |poll| %> + <%= link_to poll.name, poll %> +<% end %> diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb new file mode 100644 index 000000000..01749b19a --- /dev/null +++ b/app/views/polls/show.html.erb @@ -0,0 +1 @@ +<%= @poll.name %> diff --git a/config/routes.rb b/config/routes.rb index 16625aa7c..793a97f42 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -85,6 +85,10 @@ Rails.application.routes.draw do get :search, on: :collection end + resources :polls, only: [:show, :index] do + resources :questions, only: [:show, :index] + end + resources :users, only: [:show] do resources :direct_messages, only: [:new, :create, :show] end diff --git a/spec/features/polls_spec.rb b/spec/features/polls_spec.rb new file mode 100644 index 000000000..d3c101ed8 --- /dev/null +++ b/spec/features/polls_spec.rb @@ -0,0 +1,22 @@ +# coding: utf-8 +require 'rails_helper' + +feature 'Polls' do + + scenario 'Polls can be listed' do + polls = create_list(:poll, 3) + + visit polls_path + + polls.each do |poll| + expect(page).to have_link(poll.name) + end + end + + scenario 'Polls can be seen' do + poll = create(:poll) + visit poll_path(poll) + expect(page).to have_content(poll.name) + end +end +