radiant-downloads-extension 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ Test text file.
@@ -0,0 +1,41 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Download do
4
+ dataset :download_groups
5
+
6
+ before do
7
+ @site = Page.current_site = sites(:test) if defined? Site
8
+ end
9
+
10
+ it "should have a groups association" do
11
+ Download.reflect_on_association(:groups).should_not be_nil
12
+ download = downloads(:grouped)
13
+ download.groups.any?.should be_true
14
+ download.groups.size.should == 2
15
+ end
16
+
17
+ it "should have a document attachment" do
18
+ ["document", "document=", "document?"].each do |meth|
19
+ Download.instance_methods.should include(meth)
20
+ end
21
+ end
22
+
23
+ it "should validate file presence" do
24
+ dl = downloads(:ungrouped)
25
+ dl.should be_valid
26
+ dl.document = nil
27
+ dl.should_not be_valid
28
+ dl.errors.on(:document).should_not be_nil
29
+ end
30
+
31
+ it "url should point to /secure_download " do
32
+ dl = downloads(:grouped)
33
+ dl.document.url.should =~ /^\/secure_download\/#{dl.id}/
34
+ end
35
+
36
+ it "path should be outside public site" do
37
+ dl = downloads(:grouped)
38
+ dl.document.path.should_not =~ /^#{RAILS_ROOT}\/public/
39
+ end
40
+
41
+ end
@@ -0,0 +1,20 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Group do
4
+ dataset :download_groups
5
+
6
+ before do
7
+ @site = Page.current_site = sites(:test) if defined? Site
8
+ end
9
+
10
+ it "should have a downloads association" do
11
+ Group.reflect_on_association(:downloads).should_not be_nil
12
+ end
13
+
14
+ it "should have a group of downloads" do
15
+ group = groups(:busy)
16
+ group.downloads.any?.should be_true
17
+ group.downloads.size.should == 2
18
+ end
19
+
20
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,6 @@
1
+ --colour
2
+ --format
3
+ progress
4
+ --loadby
5
+ mtime
6
+ --reverse
@@ -0,0 +1,36 @@
1
+ unless defined? RADIANT_ROOT
2
+ ENV["RAILS_ENV"] = "test"
3
+ case
4
+ when ENV["RADIANT_ENV_FILE"]
5
+ require ENV["RADIANT_ENV_FILE"]
6
+ when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
7
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../../")}/config/environment"
8
+ else
9
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../")}/config/environment"
10
+ end
11
+ end
12
+ require "#{RADIANT_ROOT}/spec/spec_helper"
13
+
14
+ Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
15
+
16
+ if File.directory?(File.dirname(__FILE__) + "/matchers")
17
+ Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file }
18
+ end
19
+
20
+ Spec::Runner.configure do |config|
21
+ # config.use_transactional_fixtures = true
22
+ # config.use_instantiated_fixtures = false
23
+ # config.fixture_path = RAILS_ROOT + '/spec/fixtures'
24
+
25
+ # You can declare fixtures for each behaviour like this:
26
+ # describe "...." do
27
+ # fixtures :table_a, :table_b
28
+ #
29
+ # Alternatively, if you prefer to declare them only once, you can
30
+ # do so here, like so ...
31
+ #
32
+ # config.global_fixtures = :table_a, :table_b
33
+ #
34
+ # If you declare global fixtures, be aware that they will be declared
35
+ # for all of your examples, even those that don't use them.
36
+ end
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: radiant-downloads-extension
3
+ version: !ruby/object:Gem::Version
4
+ hash: 11
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
+ platform: ruby
12
+ authors:
13
+ - spanner
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-09-15 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ prerelease: false
23
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 59
29
+ segments:
30
+ - 0
31
+ - 9
32
+ - 0
33
+ version: 0.9.0
34
+ name: radiant
35
+ requirement: *id001
36
+ type: :runtime
37
+ - !ruby/object:Gem::Dependency
38
+ prerelease: false
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ name: radiant-reader_group-extension
49
+ requirement: *id002
50
+ type: :runtime
51
+ description: Controlled, secure file access with group-based access control.
52
+ email: will@spanner.org
53
+ executables: []
54
+
55
+ extensions: []
56
+
57
+ extra_rdoc_files:
58
+ - README.markdown
59
+ files:
60
+ - .gitignore
61
+ - README.markdown
62
+ - Rakefile
63
+ - app/controllers/admin/downloads_controller.rb
64
+ - app/controllers/downloads_controller.rb
65
+ - app/models/download.rb
66
+ - app/views/admin/downloads/_form.html.haml
67
+ - app/views/admin/downloads/edit.html.haml
68
+ - app/views/admin/downloads/index.html.haml
69
+ - app/views/admin/downloads/new.html.haml
70
+ - db/migrate/001_create_downloads.rb
71
+ - downloads_extension.rb
72
+ - lib/download_group.rb
73
+ - lib/download_tags.rb
74
+ - lib/download_ui.rb
75
+ - lib/tasks/downloads_extension_tasks.rake
76
+ - public/stylesheets/admin/downloads.css
77
+ - spec/controllers/downloads_controller_spec.rb
78
+ - spec/datasets/download_groups_dataset.rb
79
+ - spec/datasets/download_readers_dataset.rb
80
+ - spec/datasets/download_sites_dataset.rb
81
+ - spec/datasets/downloads_dataset.rb
82
+ - spec/files/test.pdf
83
+ - spec/files/test.txt
84
+ - spec/models/download_spec.rb
85
+ - spec/models/group_spec.rb
86
+ - spec/spec.opts
87
+ - spec/spec_helper.rb
88
+ has_rdoc: true
89
+ homepage: http://github.com/spanner/radiant-downloads-extension
90
+ licenses: []
91
+
92
+ post_install_message:
93
+ rdoc_options:
94
+ - --charset=UTF-8
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ hash: 3
103
+ segments:
104
+ - 0
105
+ version: "0"
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ hash: 3
112
+ segments:
113
+ - 0
114
+ version: "0"
115
+ requirements: []
116
+
117
+ rubyforge_project:
118
+ rubygems_version: 1.3.7
119
+ signing_key:
120
+ specification_version: 3
121
+ summary: Controlled, secure file access for Radiant CMS with group-based access control.
122
+ test_files:
123
+ - spec/controllers/downloads_controller_spec.rb
124
+ - spec/datasets/download_groups_dataset.rb
125
+ - spec/datasets/download_readers_dataset.rb
126
+ - spec/datasets/download_sites_dataset.rb
127
+ - spec/datasets/downloads_dataset.rb
128
+ - spec/models/download_spec.rb
129
+ - spec/models/group_spec.rb
130
+ - spec/spec_helper.rb