Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a setting to control whether proposals are allowed for different …

…formats. Fixes #60
  • Loading branch information...
commit 882f8b06f2724ede3eba6f1e56daeb758daf0d9a 1 parent b1290dc
@marioaquino marioaquino authored
View
41 features/step_definitions/talk_submission_steps.rb
@@ -15,6 +15,27 @@
+Given /^a refinery user exists$/ do
+ Factory(:refinery_user)
+end
+
+Given /^the (\w+) cfp is open$/ do |talk_format|
+ RefinerySetting::set("#{talk_format}_proposals_accepted".to_sym, 'true')
+end
+
+
+Given /^the period for submitting (\w+) proposals has expired$/ do |talk_format|
+ RefinerySetting::set("#{talk_format}_proposals_accepted".to_sym, 'false')
+end
+
+Given /^I change the (\w+\s?\w*) field to "([^"]*)"$/ do |field_name, content|
+ page.fill_in field_name, :with => content
+end
+
+Given /^I change the (\w+\s?\w*) select to "([^"]*)"$/ do |field_name, content|
+ page.select content, :from => field_name
+end
+
When /I enter a talk/ do
visit path_to("the new talks page")
@@ -23,9 +44,6 @@
click_button "Create Talk"
end
-Given /^a refinery user exists$/ do
- Factory(:refinery_user)
-end
When /^(?:|I )select "([^"]*)"(?: in "([^"]*)")?$/ do |item, box|
select(item, :from => box)
@@ -35,18 +53,14 @@
ActionMailer::Base.deliveries.size.should == 1
end
-Given /^I change the (\w+\s?\w*) field to "([^"]*)"$/ do |field_name, content|
- page.fill_in field_name, :with => content
-end
-
-Given /^I change the (\w+\s?\w*) select to "([^"]*)"$/ do |field_name, content|
- page.select content, :from => field_name
-end
-
When /^I push the (\w*) button$/ do |button_text|
page.click_button button_text
end
+When /^I try to create a new (\w+) proposal$/ do |talk_format|
+ visit new_proposal_of_path(talk_format)
+end
+
Then /^I should see the (\w+\s?\w*) field with "([^"]*)"$/ do |field_name, content|
page.has_field?(field_name, :with => content).should be_true
end
@@ -55,3 +69,8 @@
visit path_to(path)
end
+Then /^I see a message that the (\w+) proposal period has expired$/ do |talk_format|
+ page.should have_content "The call for #{talk_format} proposals has expired."
+end
+
+
View
15 features/talk_submission.feature
@@ -2,9 +2,11 @@ Feature: As an anonymous user I can enter a talk along with
speaker information so that it can be reviewed and determined
if it is appropriate for the conference
+ Background:
+ Given an admin exists
+
Scenario: Users can enter a talk
- Given an admin exists
- And I go to the talk submission page
+ Given I go to the talk submission page
And I fill in the following:
| Title | Squashing NP Hard Problems with Clojure |
| Abstract | Using only functions, sequences and three toothpicks I will make 3 SAT solvable in O(n) time |
@@ -50,8 +52,7 @@ Feature: As an anonymous user I can enter a talk along with
And an email should be sent
Scenario: Users can enter a short talk
- Given an admin exists
- And I go to the talk submission page
+ Given I go to the talk submission page
And I fill in the following:
| Title | Squashing NP Hard Problems with Clojure |
| Abstract | Using only functions, sequences and three toothpicks I will make 3 SAT solvable in O(n) time |
@@ -95,8 +96,12 @@ Feature: As an anonymous user I can enter a talk along with
And I should see "theory"
And I should see "clojure"
And an email should be sent
-
+ @60
+ Scenario: Proposal submission period expired
+ Given the period for submitting workshop proposals has expired
+ When I try to create a new workshop proposal
+ Then I see a message that the workshop proposal period has expired
View
1  features/workshop_submission.feature
@@ -4,6 +4,7 @@ Feature: As an anonymous user I can enter a workshop along with
Scenario: Users can enter a workshop
Given an admin exists
+ And the workshop cfp is open
And I go to the new workshops page
And I fill in the following:
| Title | Squashing NP Hard Problems with Clojure |
View
6 vendor/engines/proposals/app/controllers/proposals_controller.rb
@@ -5,7 +5,11 @@ class ProposalsController < ApplicationController
expose(:proposal) { Proposal.new :format => format, :talk => talk }
def new
- render "new_#{format}"
+ if RefinerySetting.find_or_set("#{format}_proposals_accepted".to_sym, 'true') == true
+ render "new_#{format}"
+ else
+ render "cfp_expired"
+ end
end
def create
View
15 vendor/engines/proposals/app/views/proposals/cfp_expired.html.erb
@@ -0,0 +1,15 @@
+<div class="row_top_tile_sub">
+ <div class="container_12">
+ <div class="grid_8">
+ <div class="page_title">
+ Call for Proposals Closed
+ </div>
+ </div>
+ </div>
+</div>
+
+<div class="container_12 pad3">
+ <div class="grid_12">
+ <h4><%= t('.expiration_message', :proposal_format => format)%></h4>
+ </div>
+</div>
View
2  vendor/engines/proposals/config/locales/en.yml
@@ -51,6 +51,8 @@ en:
comment_button: Add Comment
proposals:
+ cfp_expired:
+ expiration_message: "The call for %{proposal_format} proposals has expired."
new_workshop:
title: Title
title_hint: "Max length: 55 characters."
View
38 vendor/engines/proposals/spec/controllers/proposals_controller_spec.rb
@@ -4,13 +4,32 @@
#necessary because refinery serves admin creation page unless an admin acct exists
login_admin
- context 'format is workshop' do
- describe '#new' do
- it 'renders the new_workshop template' do
- get :new, :format => 'workshop'
- response.should render_template('proposals/new_workshop')
+ shared_examples_for "proposal format" do |proposal_format|
+ context 'CFP expired' do
+ describe '#new' do
+ before { RefinerySetting.set("#{proposal_format}_proposals_accepted".to_sym, 'false') }
+
+ it 'renders the cfp_expired template' do
+ get :new, :format => proposal_format
+ response.should render_template("proposals/cfp_expired")
+ end
+ end
+ end
+
+ context 'CFP open' do
+ describe '#new' do
+ before { RefinerySetting.set("#{proposal_format}_proposals_accepted".to_sym, 'true') }
+ it 'renders the new template' do
+ get :new, :format => proposal_format
+ response.should render_template("proposals/new_#{proposal_format}")
+ end
end
end
+ end
+
+ context 'format is workshop' do
+
+ it_should_behave_like "proposal format", "workshop"
describe '#create' do
context 'valid workshop and speaker data is submitted' do
@@ -66,9 +85,10 @@
end
context 'format is talk' do
- it 'renders the new_talk template' do
- get :new, :format => 'talk'
- response.should render_template('proposals/new_talk')
- end
+ it_should_behave_like "proposal format", "talk"
+ end
+
+ context 'format is elc' do
+ it_should_behave_like "proposal format", "elc"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.