Skip to content

Commit

Permalink
Change default info request prominence. Closes #9
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Gatev committed Jul 31, 2014
1 parent 4467c2f commit 8eb1644
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ChangeDefaultValueOfInfoRequestProminence < ActiveRecord::Migration
def change
change_default_column :info_requests, :prominence, "requester_only"
end
end
1 change: 1 addition & 0 deletions spec/factories/info_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
factory :info_request do
title "Example Title"
public_body
prominence 'normal'
user

after_create do |info_request, evaluator|
Expand Down
10 changes: 10 additions & 0 deletions spec/fixtures/info_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ fancy_dog_request:
comments_allowed: true
idhash: 50929748
address: Some address
prominence: normal
naughty_chicken_request:
id: 103
title: How much public money is wasted on breeding naughty chickens?
Expand All @@ -49,6 +50,7 @@ naughty_chicken_request:
comments_allowed: true
idhash: e8d18c84
address: Some address
prominence: normal
badger_request:
id: 104
title: Are you really a badger?
Expand All @@ -62,6 +64,7 @@ badger_request:
comments_allowed: true
idhash: e8d18c84
address: Some address
prominence: normal
boring_request:
id: 105
title: The cost of boring
Expand All @@ -75,6 +78,7 @@ boring_request:
comments_allowed: true
idhash: 173fd003
address: Some address
prominence: normal
another_boring_request:
id: 106
title: The cost of boring
Expand All @@ -88,6 +92,7 @@ another_boring_request:
comments_allowed: true
idhash: 173fd004
address: Some address
prominence: normal

# A pair of identical requests (with url_title differing only in the numeric suffix)
# used to test the request de-duplication features.
Expand All @@ -104,6 +109,7 @@ spam_1_request:
comments_allowed: false
idhash: 173fd005
address: Some address
prominence: normal
spam_2_request:
id: 108
title: Cheap v1agra
Expand All @@ -117,6 +123,7 @@ spam_2_request:
comments_allowed: true
idhash: 173fd005
address: Some address
prominence: normal
external_request:
id: 109
title: Balalas
Expand All @@ -129,6 +136,7 @@ external_request:
comments_allowed: true
idhash: a1234567
address: Some address
prominence: normal
anonymous_external_request:
id: 110
title: Anonymous request
Expand All @@ -141,6 +149,7 @@ anonymous_external_request:
comments_allowed: true
idhash: 7654321a
address: Some address
prominence: normal
other_request:
id: 111
title: Another request
Expand All @@ -154,3 +163,4 @@ other_request:
comments_allowed: true
idhash: b234567
address: Some address
prominence: normal
11 changes: 10 additions & 1 deletion spec/models/info_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@

describe InfoRequest do

it 'has "requester_only" default prominence' do
request = InfoRequest.new(:title => 'abcde',
:public_body => public_bodies(:geraldine_public_body),
:user_id => 1)
request.save!
request.prominence.should eq 'requester_only'
end

describe 'when validating' do

it 'should accept a summary with ascii characters' do
Expand Down Expand Up @@ -1120,7 +1128,8 @@
:external_user_name => 'Example User',
:title => 'Some request or other',
:described_state => 'partially_successful',
:public_body => pb)
:public_body => pb,
:prominence => 'normal')
ir.save!
pb.info_requests_successful_count.should == (old_successful_count + 1)
ir.described_state = 'not_held'
Expand Down

0 comments on commit 8eb1644

Please sign in to comment.