Permalink
Browse files

Merge pull request #15 from alphagov/video_format

Test that an artefact of kind 'video' can be created

LGTM
  • Loading branch information...
jabley committed Aug 13, 2012
2 parents 47bb628 + 7c3e7a0 commit 098158c5e7606f5323f576960520e834518f7384
Showing with 22 additions and 5 deletions.
  1. +1 −1 Gemfile
  2. +2 −2 Gemfile.lock
  3. +1 −1 app/views/artefacts/_form.html.erb
  4. +18 −0 test/functional/artefacts_controller_test.rb
  5. +0 −1 test/unit/artefact_test.rb
View
@@ -33,7 +33,7 @@ gem 'lograge'
if ENV['CONTENT_MODELS_DEV']
gem "govuk_content_models", path: '../govuk_content_models'
else
- gem "govuk_content_models", "0.6.0"
+ gem "govuk_content_models", "0.7.0"
end
if ENV['BUNDLE_DEV']
View
@@ -118,7 +118,7 @@ GEM
json
gherkin (2.11.1)
json (>= 1.4.6)
- govuk_content_models (0.6.0)
+ govuk_content_models (0.7.0)
bson_ext
differ
gds-api-adapters
@@ -302,7 +302,7 @@ DEPENDENCIES
gds-sso (~> 1.2.0)
gds-warmup-controller (= 0.1.0)
gelf
- govuk_content_models (= 0.6.0)
+ govuk_content_models (= 0.7.0)
launchy
lograge
minitest
@@ -42,7 +42,7 @@
<% else %>
<%= render :partial => 'artefact_section', :locals => {:section_id => nil, :tag_collection => tag_collection} %>
<% end %>
-
+
<button id="add-section" class="btn btn-success">Add another section</button>
<% end %>
@@ -76,6 +76,24 @@ class ArtefactsControllerTest < ActionController::TestCase
assert_equal "create", artefact.actions.first.action_type
assert_equal stub_user, artefact.actions.first.user
end
+
+ should "create an artefact of kind 'video' for the current user" do
+ post :create, format: "json", slug: "welcome-to-the-world-of-tomorrow", kind: "video", owning_app: "publisher", rendering_app: "frontend", name: "Welcome to the world of Tomorrow!", need_id: 1352344
+
+ parsed = JSON.parse(response.body)
+ assert_equal "publisher", parsed["owning_app"]
+ assert_equal "frontend", parsed["rendering_app"]
+ assert_equal "video", parsed["kind"]
+ assert_equal "welcome-to-the-world-of-tomorrow", parsed["slug"]
+ assert_equal "Welcome to the world of Tomorrow!", parsed["name"]
+ assert_equal true, parsed["id"].present?
+
+ artefact_id = parsed["id"]
+ artefact = Artefact.find(artefact_id)
+ assert_equal 1, artefact.actions.size
+ assert_equal "create", artefact.actions.first.action_type
+ assert_equal stub_user, artefact.actions.first.user
+ end
end
context "GET /artefacts/:id" do
@@ -17,5 +17,4 @@ class ArtefactTest < ActiveSupport::TestCase
reloaded_artefact = Artefact.find(@artefact.id)
assert_nil reloaded_artefact.indexable_content
end
-
end

0 comments on commit 098158c

Please sign in to comment.