refinerycms-resources 0.9.9.18 → 0.9.9.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,9 +33,11 @@ module Admin
33
33
  if @resources.all?(&:valid?)
34
34
  @resource_id = @resources.detect(&:persisted?).id
35
35
  @resource = nil
36
- end
37
36
 
38
- insert
37
+ redirect_to :action => 'insert', :modal => from_dialog?, :wymeditor => from_dialog?, :dialog => from_dialog?
38
+ else
39
+ self.insert
40
+ end
39
41
  end
40
42
  end
41
43
 
@@ -75,10 +77,10 @@ module Admin
75
77
  end
76
78
 
77
79
  def paginate_resources(conditions={})
78
- @resources = Resource.paginate :page => (@paginate_page_number ||= params[:page]),
79
- :conditions => conditions,
80
- :order => 'created_at DESC',
81
- :per_page => Resource.per_page(from_dialog?)
80
+ @resources = Resource.paginate :page => (@paginate_page_number ||= params[:page]),
81
+ :conditions => conditions,
82
+ :order => 'created_at DESC',
83
+ :per_page => Resource.per_page(from_dialog?)
82
84
  end
83
85
 
84
86
  end
@@ -2,10 +2,10 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{refinerycms-resources}
5
- s.version = %q{0.9.9.18}
5
+ s.version = %q{0.9.9.19}
6
6
  s.summary = %q{Resources engine for Refinery CMS}
7
7
  s.description = %q{Handles all file upload and processing functionality in Refinery CMS.}
8
- s.date = %q{2011-04-16}
8
+ s.date = %q{2011-04-22}
9
9
  s.email = %q{info@refinerycms.com}
10
10
  s.homepage = %q{http://refinerycms.com}
11
11
  s.rubyforge_project = %q{refinerycms}
@@ -87,7 +87,7 @@ Gem::Specification.new do |s|
87
87
  'spec/uploads/refinery_is_awesome.txt'
88
88
  ]
89
89
 
90
- s.add_dependency 'refinerycms-core', '= 0.9.9.18'
90
+ s.add_dependency 'refinerycms-core', '= 0.9.9.19'
91
91
  s.add_dependency 'dragonfly', '~> 0.8.2'
92
92
  s.add_dependency 'rack-cache', '>= 0.5.3'
93
93
  end
@@ -2,58 +2,40 @@ require 'spec_helper'
2
2
 
3
3
  describe Resource do
4
4
 
5
- def reset_resource(options = {})
6
- @valid_attributes = {
7
- :id => 1,
8
- :file => File.new(File.expand_path('../../uploads/refinery_is_awesome.txt', __FILE__))
9
- }.merge(options)
10
-
11
- @resource.destroy if @resource
12
- @resource = Resource.create!(@valid_attributes)
13
- end
14
-
15
- def resource_can_be_destroyed
16
- @resource.destroy.should == true
17
- end
18
-
19
- before(:each) do
20
- reset_resource
21
- end
22
-
23
- # clean up after ourselves.
24
- after(:each) do
25
- Resource.destroy_all
5
+ let(:resource) do
6
+ Resource.create!(:id => 1,
7
+ :file => File.new(File.expand_path('../../uploads/refinery_is_awesome.txt', __FILE__)))
26
8
  end
27
9
 
28
10
  context "with valid attributes" do
29
11
  it "should create successfully" do
30
- @resource.errors.empty?
12
+ resource.errors.should be_empty
31
13
  end
32
14
  end
33
15
 
34
16
  context "resource url" do
35
17
  it "should respond to .url" do
36
- @resource.respond_to?(:url).should == true
18
+ resource.should respond_to(:url)
37
19
  end
38
20
 
39
21
  it "should not support thumbnailing like images do" do
40
- @resource.respond_to?(:thumbnail).should == false
22
+ resource.should_not respond_to(:thumbnail)
41
23
  end
42
24
 
43
25
  it "should contain its filename at the end" do
44
- @resource.url.split('/').last.should == @resource.file_name
26
+ resource.url.split('/').last.should == resource.file_name
45
27
  end
46
28
  end
47
29
 
48
30
  describe "#type_of_content" do
49
31
  it "returns formated mime type" do
50
- @resource.type_of_content.should == "text plain"
32
+ resource.type_of_content.should == "text plain"
51
33
  end
52
34
  end
53
35
 
54
36
  describe "#title" do
55
37
  it "returns a titleized version of the filename" do
56
- @resource.title.should == "Refinery Is Awesome"
38
+ resource.title.should == "Refinery Is Awesome"
57
39
  end
58
40
  end
59
41
 
@@ -87,8 +69,8 @@ describe Resource do
87
69
  end
88
70
 
89
71
  specify "each returned array item should be an instance of resource" do
90
- Resource.create_resources(:file => [file, file, file]).each do |resource|
91
- resource.should be_an_instance_of(Resource)
72
+ Resource.create_resources(:file => [file, file, file]).each do |r|
73
+ r.should be_an_instance_of(Resource)
92
74
  end
93
75
  end
94
76
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: refinerycms-resources
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.9.18
5
+ version: 0.9.9.19
6
6
  platform: ruby
7
7
  authors:
8
8
  - Resolve Digital
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2011-04-16 00:00:00 Z
16
+ date: 2011-04-22 00:00:00 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: refinerycms-core
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirements:
24
24
  - - "="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.9.9.18
26
+ version: 0.9.9.19
27
27
  type: :runtime
28
28
  version_requirements: *id001
29
29
  - !ruby/object:Gem::Dependency