You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by al...@apache.org on 2015/08/24 13:42:04 UTC
[38/50] [abbrv] incubator-taverna-databundle-viewer git commit:
Updated tests, add hello_anyone as a fixture for testing
Updated tests, add hello_anyone as a fixture for testing
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/commit/a13a6c87
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/tree/a13a6c87
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/diff/a13a6c87
Branch: refs/heads/master
Commit: a13a6c87d306e90ccbc2ad27e68ff81b450b3fe6
Parents: f07d3c6
Author: Denis Karyakin <sa...@gmail.com>
Authored: Wed Aug 19 02:45:38 2015 +0300
Committer: Denis Karyakin <sa...@gmail.com>
Committed: Wed Aug 19 02:45:38 2015 +0300
----------------------------------------------------------------------
spec/decorators/data_bundle_decorator_spec.rb | 19 +++++++++++++++++
spec/factories/data_bundles.rb | 1 +
spec/feature/data_bundles_spec.rb | 23 +++++++++++++++++++--
spec/fixtures/hello_anyone.zip | Bin 0 -> 13002 bytes
spec/models/data_bundle_spec.rb | 4 ++++
5 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/blob/a13a6c87/spec/decorators/data_bundle_decorator_spec.rb
----------------------------------------------------------------------
diff --git a/spec/decorators/data_bundle_decorator_spec.rb b/spec/decorators/data_bundle_decorator_spec.rb
index 7430da3..3bd1e88 100644
--- a/spec/decorators/data_bundle_decorator_spec.rb
+++ b/spec/decorators/data_bundle_decorator_spec.rb
@@ -1,3 +1,22 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
require 'spec_helper'
describe DataBundleDecorator do
http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/blob/a13a6c87/spec/factories/data_bundles.rb
----------------------------------------------------------------------
diff --git a/spec/factories/data_bundles.rb b/spec/factories/data_bundles.rb
index d27e2fd..74d5f1e 100644
--- a/spec/factories/data_bundles.rb
+++ b/spec/factories/data_bundles.rb
@@ -21,5 +21,6 @@ FactoryGirl.define do
factory :data_bundle do
association :user
name { Faker::Lorem.sentence }
+ file { Rack::Test::UploadedFile.new("#{Rails.root}/spec/fixtures/hello_anyone.zip") }
end
end
http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/blob/a13a6c87/spec/feature/data_bundles_spec.rb
----------------------------------------------------------------------
diff --git a/spec/feature/data_bundles_spec.rb b/spec/feature/data_bundles_spec.rb
index 7f687b3..52d6ac2 100644
--- a/spec/feature/data_bundles_spec.rb
+++ b/spec/feature/data_bundles_spec.rb
@@ -34,6 +34,7 @@ RSpec.describe 'DataBundles', type: :feature do
name = Faker::Lorem.sentence
expect {
fill_in 'data_bundle_name', with: name
+ attach_file 'data_bundle_file', "#{Rails.root}/spec/fixtures/hello_anyone.zip"
click_button 'save_data_bundle'
}.to change(DataBundle, :count).by(1)
visit data_bundles_path
@@ -48,10 +49,28 @@ RSpec.describe 'DataBundles', type: :feature do
expect(page).not_to have_content data_bundle_foreign.name
end
- xit 'show databundle' do
- visit data_bundle_path(data_bundle)
+ it 'show databundle' do
+ click_link "to_show_#{data_bundle.id}"
expect(page).to have_content data_bundle.name
end
+
+ it 'edit databundle' do
+ click_link "to_edit_#{data_bundle.id}"
+ new_name = Faker::Lorem.sentence
+ expect {
+ fill_in 'data_bundle_name', with: new_name
+ click_button 'save_data_bundle'
+ }.not_to change(DataBundle, :count)
+ expect(page).to have_content new_name
+ end
+
+ it 'delete databundle', js: true do
+ expect {
+ page.accept_confirm do
+ click_link "to_delete_#{data_bundle.id}"
+ end
+ }.to change(DataBundle, :count).by(-1)
+ end
end
context 'anonymous user' do
http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/blob/a13a6c87/spec/fixtures/hello_anyone.zip
----------------------------------------------------------------------
diff --git a/spec/fixtures/hello_anyone.zip b/spec/fixtures/hello_anyone.zip
new file mode 100644
index 0000000..8a99a1e
Binary files /dev/null and b/spec/fixtures/hello_anyone.zip differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-databundle-viewer/blob/a13a6c87/spec/models/data_bundle_spec.rb
----------------------------------------------------------------------
diff --git a/spec/models/data_bundle_spec.rb b/spec/models/data_bundle_spec.rb
index 245ad4d..56706df 100644
--- a/spec/models/data_bundle_spec.rb
+++ b/spec/models/data_bundle_spec.rb
@@ -27,4 +27,8 @@ RSpec.describe DataBundle, type: :model do
it 'without user - invalid' do
expect(build(:data_bundle, user: nil)).not_to be_valid
end
+
+ it 'without file - invalid' do
+ expect(build(:data_bundle, file: nil)).not_to be_valid
+ end
end