ds_media_library 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b6e8af1bf91a7838f73eed01b5fc3e4a0d8bd47
4
- data.tar.gz: 0632748ecc6db6115ab9e302617aa574a56520d4
3
+ metadata.gz: 264dfaa7118effde6bf1cd9743b1487b44df1f54
4
+ data.tar.gz: 409ff27940c44dab5e57f4a388883fbe33440eee
5
5
  SHA512:
6
- metadata.gz: a79bf020761b8f8bf20ef7801557c4fbd31caba1c4485b714cff61f390542dd4d5e43e32e77f959acc5dcea202ef344f730aab4ee0e6a0bb3a60d42a8dd9e8c2
7
- data.tar.gz: a0211d9041b9c99083c0160f050bc41019a519d29b3c90d71aeb8053e1857af5a4f969900e24d32d6d791adf4b8fd6600e6a3d229a4c826e8ed2e40b1f677f80
6
+ metadata.gz: f31b73fe7d7a928e7eb6a11764ee2f607f2ecddf264bc6c22b35c95de7c7502db8eb5782a68f48c00fdb51d6db6b70a04b6320969da1d07633bf78d7e17dac5d
7
+ data.tar.gz: ab4532654ccc05b9c51c4e9dc566654b7c1bfbb44e644f28bef4d63155f3672db370084632de6bddbaf24cdc2ff1013d55ff5bc7e6861a8d715f21217daf6a6e
@@ -0,0 +1,66 @@
1
+ Given "the following media folders exist:" do |table|
2
+ table.create! DSMediaLibrary::Folder do
3
+ belongs_to({ :parent_folder => :parent }, DSMediaLibrary::Folder)
4
+ end
5
+ end
6
+
7
+ Given "the following media files exist:" do |table|
8
+ table.create! DSNode::Resource do
9
+ belongs_to({ :parent_folder => :folder }, DSMediaLibrary::Folder)
10
+ file :file
11
+ end
12
+ end
13
+
14
+ When /^I open the media library for the "(.+?)"$/ do |field|
15
+ field = find_field(field)
16
+ field.find(:xpath, "..").find("label", text: "MEDIA LIBRARY").click
17
+ sleep 0.3 # wait for css animation
18
+ end
19
+
20
+ When "I close the media library" do
21
+ find(".dsml-modal-close").click
22
+ sleep 0.3 # wait for css animation
23
+ end
24
+
25
+ When /^I mark the "(.+?)" "(.+?)" media item for removal$/ do |label, value|
26
+ field = find_field(label)
27
+ within field.find(:xpath, "..").first("dl dfn", text: value) do
28
+ uncheck "Remove #{label.singularize.downcase}"
29
+ end
30
+ end
31
+
32
+ Then /^I should see "(.+?)" as the "(.+?)" media$/ do |value, label|
33
+ field = find_field(label)
34
+ actual = field.find(:xpath, "..").all("dl dt").map(&:text).join(", ")
35
+ expect(actual).to eq(value)
36
+ end
37
+
38
+ Then /^I should see the following "(.+?)" media library items:$/ do |label, table|
39
+ field = find_field(label)
40
+ actual = field.find(:xpath, "..").all("dl dt").map { |dt| [dt.text] }
41
+ table.diff! actual
42
+ end
43
+
44
+ Then /^I should see no "(.+?)" media$/ do |label|
45
+ field = find_field(label)
46
+ actual = field.find(:xpath, "..").all("dl dt").map(&:text)
47
+ expect(actual).to eq([])
48
+ end
49
+
50
+ Then "I should see the following media tree:" do |table|
51
+ def recurse_tree root, structure = [], prefix = ""
52
+ root.all(:xpath, "./li").each do |li|
53
+ if label = li.first("label")
54
+ structure << [prefix + label.text]
55
+ end
56
+ if root = li.first("ul")
57
+ new_prefix = prefix.empty? ? "- #{prefix}" : prefix + " "
58
+ structure = recurse_tree(root, structure, new_prefix)
59
+ end
60
+ end
61
+ structure
62
+ end
63
+
64
+ table.diff! recurse_tree(find("#dsml-media-tree"))
65
+ end
66
+
@@ -1,3 +1,3 @@
1
1
  module DSMediaLibrary
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ds_media_library
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
@@ -343,6 +343,7 @@ files:
343
343
  - dummy/database.rb
344
344
  - dummy/views.rb
345
345
  - lib/ds_media_library.rb
346
+ - lib/ds_media_library/cucumber.rb
346
347
  - lib/ds_media_library/engine.rb
347
348
  - lib/ds_media_library/version.rb
348
349
  - tmp/.keep