Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix display of unpublished related links

  • Loading branch information...
commit 9a973b60890c4a34cc06c88e8790469ec0f16a79 1 parent b0d861a
@jamiecobbett jamiecobbett authored
View
4 Gemfile
@@ -35,13 +35,13 @@ gem "bson", "1.5.2"
if ENV['CONTENT_MODELS_DEV']
gem "govuk_content_models", :path => '../govuk_content_models'
else
- gem "govuk_content_models", "~> 0.0.14"
+ gem "govuk_content_models", "~> 0.0.18"
end
if ENV['BUNDLE_DEV']
gem 'gds-sso', :path => '../gds-sso'
else
- gem 'gds-sso', '~> 0.6'
+ gem 'gds-sso', '0.5'
end
group :assets do
View
45 Gemfile.lock
@@ -100,36 +100,38 @@ GEM
factory_girl (~> 2.4.0)
railties (>= 3.0.0)
fakeweb (1.3.0)
- faraday (0.8.1)
+ faraday (0.7.6)
+ addressable (~> 2.2)
multipart-post (~> 1.1)
+ rack (~> 1.1)
ffi (1.0.11)
gds-api-adapters (0.0.47)
lrucache (~> 0.1.1)
null_logger
plek
- gds-sso (0.6.0)
- omniauth-gds (= 0.0.2)
+ gds-sso (0.5.0)
+ oa-core (~> 0.3.2)
+ oa-oauth (~> 0.3.2)
+ oauth2 (= 0.5.2)
rack (= 1.3.5)
rack-accept (~> 0.4.4)
rails (>= 3.0.0)
- warden (~> 1.2)
+ warden (= 1.0.6)
gds-warmup-controller (0.0.2)
rails (>= 3.0.0)
gelf (1.3.2)
json
gherkin (2.7.3)
json (>= 1.4.6)
- govuk_content_models (0.0.14)
+ govuk_content_models (0.0.18)
bson_ext
differ
gds-api-adapters
- gds-sso
+ gds-sso (~> 0.5.0)
mongoid (~> 2.4.10)
plek (~> 0.1.22)
state_machine
- hashie (1.2.0)
hike (1.2.1)
- httpauth (0.1)
i18n (0.6.0)
json (1.7.3)
launchy (2.0.5)
@@ -162,23 +164,24 @@ GEM
mongo (~> 1.3)
tzinfo (~> 0.3.22)
multi_json (1.0.4)
+ multi_xml (0.4.4)
multipart-post (1.1.5)
net-http-digest_auth (1.2)
net-http-persistent (1.9)
nokogiri (1.5.0)
null_logger (0.0.1)
- oauth2 (0.6.0)
+ oa-core (0.3.2)
+ oa-oauth (0.3.2)
+ faraday (~> 0.7.3)
+ multi_json (~> 1.0.0)
+ multi_xml (~> 0.4.0)
+ oa-core (= 0.3.2)
+ oauth (~> 0.4.0)
+ oauth2 (~> 0.5.0)
+ oauth (0.4.6)
+ oauth2 (0.5.2)
faraday (~> 0.7)
- httpauth (~> 0.1)
multi_json (~> 1.0)
- omniauth (1.1.0)
- hashie (~> 1.2)
- rack
- omniauth-gds (0.0.2)
- omniauth-oauth2 (~> 1.0)
- omniauth-oauth2 (1.0.2)
- oauth2 (~> 0.6.0)
- omniauth (~> 1.0)
plek (0.1.22)
builder
polyglot (0.3.3)
@@ -247,7 +250,7 @@ GEM
uglifier (1.2.2)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
- warden (1.2.0)
+ warden (1.0.6)
rack (>= 1.0)
webrobots (0.0.12)
nokogiri (>= 1.4.4)
@@ -278,10 +281,10 @@ DEPENDENCIES
formtastic!
formtastic-bootstrap!
gds-api-adapters
- gds-sso (~> 0.6)
+ gds-sso (= 0.5)
gds-warmup-controller
gelf
- govuk_content_models (~> 0.0.14)
+ govuk_content_models (~> 0.0.18)
launchy
marples (~> 1.0)
minitest
View
2  app/views/artefacts/_form.html.erb
@@ -16,7 +16,7 @@
<%= semantic_form_for(artefact, :html => { :class => '', :id => 'edit_artefact'}) do |f| %>
<%= f.inputs do %>
<%= f.input :name, :input_html => { :class => "span6" } %>
- <%= f.input :slug, :input_html => { :class => "span6", :disabled => f.object.any_editions_published? }, :hint => "A valid slug might look like this: i-am-a-good-slug-with-no-spaces" %>
+ <%= f.input :slug, :input_html => { :class => "span6", :disabled => f.object.any_editions_ever_published? }, :hint => "A valid slug might look like this: i-am-a-good-slug-with-no-spaces" %>
<%= f.input :need_id, :input_html => { :class => "span6", :disabled => f.object.persisted? } %>
<% if ! artefact.new_record? && ! artefact.business_proposition %>
<%= link_to "View in Need-O-Tron", need_url(f.object), :rel => 'external', :class => "btn btn-primary" %>
View
12 features/editing.feature
@@ -26,10 +26,10 @@ Feature: Editing artefacts
Then I should be redirected to Publisher
Scenario: Assign a related item
- Given two artefacts exist
+ Given two non-publisher artefacts exist
When I create a relationship between them
- Then I should be redirected to Publisher
- And the API should say that the artefacts are related
+ And I save
+ Then the API should say that the artefacts are related
Scenario: Unassign a related item
Given two artefacts exist
@@ -39,11 +39,11 @@ Feature: Editing artefacts
And the API should say that the artefacts are not related
Scenario: Assign additional related items
- Given several artefacts exist
+ Given several non-publisher artefacts exist
And some of the artefacts are related
When I create more relationships between them
- Then I should be redirected to Publisher
- And the API should say that more of the artefacts are related
+ And I save
+ Then the API should say that more of the artefacts are related
# Scenario: Assign a contact
# Given an artefact exists
View
10 features/step_definitions/artefact_steps.rb
@@ -2,6 +2,10 @@
@artefact, @related_artefact = create_two_artefacts
end
+Given /^two non-publisher artefacts exist$/ do
+ @artefact, @related_artefact = create_two_artefacts("smart-answers")
+end
+
When /^I mark relatedness as done$/ do
check :relatedness_done
end
@@ -48,7 +52,6 @@
When /^I create a relationship between them$/ do
visit edit_artefact_path(@artefact)
select_related_artefact @related_artefact
- submit_artefact_form
end
Then /^I should be redirected to (.*)$/ do |app|
@@ -65,8 +68,8 @@
submit_artefact_form
end
-Given /^several artefacts exist$/ do
- @artefact, *@related_artefacts, @unrelated_artefact = create_six_artefacts
+Given /^several non-publisher artefacts exist$/ do
+ @artefact, *@related_artefacts, @unrelated_artefact = create_six_artefacts("smart-answers")
end
Given /^some of the artefacts are related$/ do
@@ -76,7 +79,6 @@
When /^I create more relationships between them$/ do
visit edit_artefact_path(@artefact)
select_related_artefacts @related_artefacts[(@related_artefacts.length / 2)..-1]
- submit_artefact_form
end
Given /^an artefact exists$/ do
View
8 features/support/artefacts.rb
@@ -2,14 +2,14 @@ def create_artefact
Factory.create :artefact, :name => 'Child Benefit rates', :need_id => 1
end
-def create_two_artefacts
+def create_two_artefacts(owning_app="publisher")
[
'Probation',
'Leaving prison'
- ].map { |name| Factory.create :artefact, :name => name, :need_id => 1 }
+ ].map { |name| Factory.create :artefact, :name => name, :need_id => 1, owning_app: owning_app }
end
-def create_six_artefacts
+def create_six_artefacts(owning_app="publisher")
[
'Driving disqualifications',
'Book the practical driving test',
@@ -17,7 +17,7 @@ def create_six_artefacts
'National Driver Offender Retraining Scheme',
'Apply for a new driving licence',
'Get a divorce'
- ].map { |name| Factory.create :artefact, :name => name, :need_id => 1 }
+ ].map { |name| Factory.create :artefact, :name => name, :need_id => 1, owning_app: owning_app }
end
def add_related_artefact(artefact, related_artefact)
Please sign in to comment.
Something went wrong with that request. Please try again.