lolita-file-upload 0.7.3 → 0.8.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.
data/README.rdoc DELETED
@@ -1,27 +0,0 @@
1
- = Lolita file upload
2
-
3
- File upload gem for Lolita.
4
-
5
- ==Instalation
6
- * gem install lolita-file-upload
7
- * include in gemfile like this:
8
- gem "lolita-file-upload", ">=0.1.0"
9
- * cd your_project_path
10
- * rails g lolita_file_upload:install
11
-
12
- Install will copy migration to your project.
13
- If you update to newest version of gem, than run <i>rails g lolita_file_upload:assets</i>
14
-
15
- ==Configuration
16
-
17
- Gem will not used until any of lolita configuration blocks define tab with type :files. Like this
18
- class Post
19
- include Lolita::Configuration
20
- has_many :files, :as=>:fileable, :class_name=>"Lolita::Upload::File"
21
-
22
- lolita do
23
- tab(:content)
24
- tab(:files)
25
- end
26
- end
27
-
@@ -1,26 +0,0 @@
1
- Feature: lolita have new configuration for tab
2
-
3
- Lolita file upload define new configuration for lolita tabs, that
4
- allow to specify file types, file list view and add atributes for file.
5
- Tab type for lolita-file-upload will be :file
6
-
7
- Scenario: i am able to define new tab with type :file and set allowed file types
8
- Given a lolita and lolita-file-upload
9
- When I define a file tab for post
10
- Then I can set included extension type pdf
11
-
12
- Scenario: set maximum file upload size
13
- Given a lolita
14
- And a rails
15
- And rails application
16
- And file tab for post
17
- When I set maximum file upload size to 100000
18
- Then I cannot upload file large_file.txt
19
-
20
- Scenario: set assciation with Lolita::Upload::File
21
- Given a lolita
22
- And lolita-file-upload
23
- When I define a file tab for post
24
- Then Post has association with Lolita::Upload::File
25
- And association name for Post is :files
26
-
@@ -1,14 +0,0 @@
1
- Feature: lolita-file-upload connects to Lolita
2
-
3
- To have all file upload features, file upload gem should connect itsefl to lolita base.
4
-
5
- Scenario: lolita-file-upload load in universe
6
- Given a lolita
7
- When I load lolita-file-upload
8
- Then lolita should have file-upload module
9
-
10
- Scenario: lolita-file-upload starts rails engine
11
- Given a rails
12
- When I load lolita-file-upload
13
- Then I have LolitaFileUpload engine
14
-
@@ -1,17 +0,0 @@
1
- Feature: all resoures have new routes for file upload
2
-
3
- File upload lives in lolita/upload and loads only once when any of lolita resources has defined files tab.
4
-
5
- Scenario: extend resources path
6
- Given a lolita
7
- And a rails
8
- And rails application
9
- And lolita-file-upload
10
- When I load routes
11
- Then I have get route /lolita/upload/files/new
12
- And I have get route /lolita/upload/files/1/edit
13
- And I have get route /lolita/upload/files/1
14
- And I have post route /lolita/upload/files
15
- And I have put route /lolita/upload/files/1
16
- And I have delete route /lolita/upload/files/1
17
- And I have get route /lolita/upload/files
@@ -1,112 +0,0 @@
1
- Given /^a lolita$/ do
2
-
3
- end
4
-
5
- When /^I load lolita\-file\-upload$/ do
6
- require "lolita-file-upload"
7
- end
8
-
9
- Then /^lolita should have file\-upload module$/ do
10
- Lolita.modules.include?(Lolita::FileUpload).should be_true
11
- end
12
-
13
- Given /^a rails$/ do
14
- require 'rails'
15
- require 'lolita/rails/all'
16
- require 'lolita-file-upload/rails'
17
- end
18
-
19
- Given /^rails application$/ do
20
- require File.expand_path("test_orm/rails/config/enviroment")
21
- end
22
-
23
- Then /^I have LolitaFileUpload engine$/ do
24
- defined?(LolitaFileUpload::Engine).should be_true
25
- end
26
-
27
- Given /^a lolita and lolita\-file\-upload$/ do
28
-
29
- end
30
-
31
- When /^I define a file tab for (\w+)$/ do |model_name|
32
- @file_tab=Support.file_tab(model_name)
33
- end
34
-
35
- Then /^I can set included extension type (\w+)$/ do |ext_name|
36
- @file_tab.extension(ext_name)
37
- @file_tab.extensions.size.should == 1
38
- end
39
-
40
- Given /^lolita\-file\-upload$/ do
41
-
42
- end
43
-
44
- Given /^file tab for (\w+)$/ do |model_name|
45
- @file_tab=Support.file_tab(model_name)
46
- end
47
-
48
- When /^I set maximum file upload size to (\d+)$/ do |size|
49
- @file_tab.maxfilesize(size)
50
- end
51
-
52
- Then /^I (c\w+)\supload file (\w+\.\w+)$/ do |predicate,file_name|
53
- file=Lolita::Upload::File.create(:asset=>Support.get_file(file_name))
54
- if predicate=="can"
55
- file.errors.should be_empty
56
- elsif predicate=="cannot"
57
- file.errors[:asset].should_not be_nil
58
- end
59
- end
60
-
61
- Then /^(\w+)\s+has association with ([\w:]+)$/ do |model_name,klass|
62
- model=Support.get_model(model_name)
63
- model.lolita.dbi.associations_klass_names.should include(klass)
64
- end
65
-
66
- Then /^association name for (\w+)\sis :(\w+)$/ do |model_name,assoc_name|
67
- model=Support.get_model(model_name)
68
- model.lolita.dbi.reflect_on_association(assoc_name.to_sym).should_not be_nil
69
- end
70
-
71
- When /^I upload file (.+)$/ do |file_name|
72
- pending # express the regexp above with the code you wish you had
73
- end
74
-
75
- Then /^I see (\w+)$/ do |file_name|
76
- pending # express the regexp above with the code you wish you had
77
- end
78
-
79
- Then /^I change file attribute ([^\s]) to (\w+)$/ do |attribute,value|
80
- pending # express the regexp above with the code you wish you had
81
- end
82
-
83
- Then /^save file$/ do
84
- pending # express the regexp above with the code you wish you had
85
- end
86
-
87
- Then /^I see (\w+)$/ do |file_name|
88
- pending # express the regexp above with the code you wish you had
89
- end
90
-
91
- When /^I load routes$/ do
92
- # routes is loaded when rails application loads, but i will load matcher for that
93
- self.extend(Lolita::Test::Matchers)
94
- # RSpec::Matchers.send(:include,Lolita::Test::Matchers)
95
- end
96
-
97
- Then /^I have (get|post|delete|put) route (.+)$/ do |method,url|
98
- {method=>url}.should be_routable
99
- end
100
-
101
- Given /^byte converter$/ do
102
- @converter=Lolita::Support::Bytes
103
- end
104
-
105
- When /^I humanize "([^"]*)"$/ do |size|
106
- @converter=@converter.new(eval(size))
107
- end
108
-
109
- Then /^I should get "([^"]*)" and "([^"]*)"$/ do |unit, limit|
110
- @converter.unit.should == unit
111
- @converter.value.should == limit.to_f
112
- end
@@ -1,15 +0,0 @@
1
- require File.expand_path('test_orm/coverage')
2
- require File.expand_path("lib/lolita-file-upload")
3
- require "carrierwave"
4
-
5
- require "ruby-debug"
6
- current_orm=:active_record
7
- require 'carrierwave/orm/'+current_orm.to_s.gsub("_","")
8
-
9
- require File.expand_path("test_orm/#{current_orm}")
10
-
11
- require File.expand_path("test_orm/support")
12
-
13
-
14
-
15
-
@@ -1,31 +0,0 @@
1
- Feature: convert bytes to biggest possible unit
2
-
3
- In order to show file upload errors in human understendable way
4
- There should be converter that converts bytes to kilobytes, megabytes, gigabytes.
5
- Lolita::Suport::Bytes do that think, it is create by passing bytes, and return unit and values with
6
- converted values
7
-
8
- Scenario Outline: convert bytes
9
- Given byte converter
10
- When I humanize "<size>"
11
- Then I should get "<unit>" and "<limit>"
12
-
13
- Scenarios: to bytes
14
- | size | unit | limit |
15
- | 0 | bytes | 0.0 |
16
- | 1023 | bytes | 1023.0 |
17
-
18
- Scenarios: to kilobytes
19
- | size | unit | limit |
20
- | 1024 | kilobyte | 1.0 |
21
- | 1024**2-1 | megabyte | 1.0 |
22
-
23
- Scenarios: to megabytes
24
- | size | unit | limit |
25
- | 1024**2 | megabyte | 1.0 |
26
- | 1024**3-1 | gigabyte | 1.0 |
27
-
28
- Scenarios: to gigabytes
29
- | size | unit | limit |
30
- | 1024**3 | gigabyte | 1.0 |
31
- | 1024**4-1 | gigabytes | 1024.0 |
@@ -1,16 +0,0 @@
1
- Feature: upload file from lolita and manage file attributes
2
-
3
- Files in lolita have name attribute. Any attributes can be changed after file is uploaded.
4
- File always is related with some ORM class object.
5
-
6
- Scenario: upload file
7
- Given a lolita
8
- And a rails
9
- And rails application
10
- And lolita-file-upload
11
- And I visit new post
12
- When I upload file normal_file.txt
13
- Then I see normal_file
14
- And I change file attribute name to my_file
15
- And save file
16
- Then I see my_file
data/test_orm/coverage.rb DELETED
@@ -1,19 +0,0 @@
1
- require 'cover_me'
2
-
3
- CoverMe.config do |c|
4
- # where is your project's root:
5
- "------"+c.project.root
6
-
7
- # what files are you interested in coverage for:
8
- c.file_pattern # => /(#{CoverMe.config.project.root}\/app\/.+\.rb|#{CoverMe.config.project.root}\/lib\/.+\.rb)/i (default)
9
-
10
- # where do you want the HTML generated:
11
- c.html_formatter.output_path # => File.join(CoverMe.config.project.root, 'coverage') (default)
12
-
13
- # what do you want to happen when it finishes:
14
-
15
- end
16
-
17
- at_exit do
18
- CoverMe.complete!
19
- end