adminpanel 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe "adminpanel:resource" do
4
- context "with no arguments or options" do
5
- it "should generate the migration" do
6
- subject.should generate("db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_create_resources_table.rb") { |content|
7
- content.should =~ /class CreateResourcesTable < ActiveRecord\:\:Migration/
8
- }
9
- end
10
- it {subject.should generate("app/models/adminpanel/resource.rb")}
11
- it {subject.should generate("app/controllers/adminpanel/resources_controller.rb")}
12
- end
13
-
4
+
14
5
  with_args :category do
15
6
  it "should generate categories migration" do
16
7
  subject.should generate("db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_create_categories_table.rb")
@@ -26,7 +17,7 @@ describe "adminpanel:resource" do
26
17
  with_args :"products,categorizations:has_many_through", :"product:belongs_to" do
27
18
  it "should generate categories migration" do
28
19
  subject.should generate("db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_create_categories_table.rb") { |content|
29
- content.should =~ /t.integer \:product_id/ &&
20
+ content.should =~ /t.integer \:product_id/ &&
30
21
  (
31
22
  content.should_not =~ /t.integer \:products_id/ ||
32
23
  content.should_not =~ /t.integer \:categorizations_id/
@@ -60,7 +51,7 @@ describe "adminpanel:resource" do
60
51
  with_args :"product:belongs_to", :"category:belongs_to" do
61
52
  it "should generate categorizations migration" do
62
53
  subject.should generate("db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_create_categorizations_table.rb") { |content|
63
- content.should =~ /t.integer \:product_id/ &&
54
+ content.should =~ /t.integer \:product_id/ &&
64
55
  content.should =~ /t.integer \:category_id/
65
56
  }
66
57
  end
@@ -71,7 +62,7 @@ describe "adminpanel:resource" do
71
62
 
72
63
  it "should generate categorization model" do
73
64
  subject.should generate("app/models/adminpanel/categorization.rb") { |content|
74
- content.should =~ /belongs_to :product/ &&
65
+ content.should =~ /belongs_to :product/ &&
75
66
  content.should =~ /belongs_to :category/
76
67
  }
77
68
  end
@@ -81,7 +72,7 @@ describe "adminpanel:resource" do
81
72
 
82
73
  with_args "Product" do
83
74
  with_args :"description:wysiwyg", :"long_text:text",
84
- :"price:float", :"date:datepicker",
75
+ :"price:float", :"date:datepicker",
85
76
  :"name:string", :"quantity:integer" do
86
77
  it "should generate migration with correct values" do
87
78
  subject.should generate("db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_create_products_table.rb") { |content|
@@ -92,7 +83,7 @@ describe "adminpanel:resource" do
92
83
  content.should =~ /t.string \:name/ &&
93
84
  content.should =~ /t.integer \:quantity/
94
85
  }
95
- end
86
+ end
96
87
  end
97
88
 
98
89
  with_args :"image:images" do
@@ -113,11 +104,9 @@ describe "adminpanel:resource" do
113
104
  with_args :"name:string", :"description:wysiwyg" do
114
105
  it "should generate namespaced products_controller.rb" do
115
106
  subject.should generate("app/controllers/adminpanel/products_controller.rb") { |content|
116
- content.should ==
117
- "module Adminpanel
118
- class ProductsController < Adminpanel::ApplicationController
119
- end
120
- end"
107
+ content.should =~ /module Adminpanel/ &&
108
+ content.should =~ /class ProductsController < Adminpanel\:\:ApplicationController/ &&
109
+ content.should =~ /end\nend/
121
110
  }
122
111
  end
123
112
 
@@ -126,24 +115,32 @@ end"
126
115
  content.should =~ /attr_accessible/
127
116
  }
128
117
  end
129
-
118
+
130
119
  it "should generate model with description hash" do
131
120
  subject.should generate("app/models/adminpanel/product.rb") { |content|
132
- content.should =~ /\{\"description\" => \{\"type\" => \"wysiwyg_field\", \"name\" => \"description\", \"label\" => \"description\", \"placeholder\" => \"description\"\}\}/
121
+ content.should =~ /\{\"description\" => \{/ &&
122
+ content.should =~ /\"type\" => \"wysiwyg_field\", /&&
123
+ content.should =~ /\"name\" => \"description\", / &&
124
+ content.should =~ /\"label\" => \"description\", / &&
125
+ content.should =~ /\"placeholder\" => \"description\"\}\}/
133
126
  }
134
127
  end
135
128
 
136
129
  it "should generate model with name hash" do
137
130
  subject.should generate("app/models/adminpanel/product.rb") { |content|
138
- content.should =~ /\{\"name\" => \{\"type\" => \"text_field\", \"name\" => \"name\", \"label\" => \"name\", \"placeholder\" => \"name\"\}\}/
131
+ content.should =~ /\{\"name\" => \{/
132
+ content.should =~ /\"type\" => \"text_field\", /
133
+ content.should =~ /\"name\" => \"name\", /
134
+ content.should =~ /\"label\" => \"name\", /
135
+ content.should =~ /\"placeholder\" => \"name\"\}\}/
139
136
  }
140
137
  end
141
138
 
142
139
  it "should generate model with overwritten sample_name" do
143
140
  subject.should generate("app/models/adminpanel/product.rb") { |content|
144
- content.should =~ /def self.display_name\n \"Product\"\n end/
141
+ content.should =~ /def self.display_name\n \"Product\"\n end/
145
142
  }
146
143
  end
147
144
  end
148
145
  end
149
- end
146
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adminpanel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 1.1.0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jose Ramon Camacho
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2014-02-28 00:00:00 -06:00
19
+ date: 2014-03-05 00:00:00 -06:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -486,6 +486,7 @@ files:
486
486
  - lib/generators/adminpanel/resource/templates/controller.rb
487
487
  - lib/generators/adminpanel/resource/templates/migration.rb
488
488
  - lib/generators/adminpanel/resource/templates/resource.rb
489
+ - lib/tasks/adminpanel/populate.rake
489
490
  - spec/dummy/README.rdoc
490
491
  - spec/dummy/Rakefile
491
492
  - spec/dummy/app/assets/images/hipster.jpg
@@ -530,8 +531,6 @@ files:
530
531
  - spec/dummy/public/422.html
531
532
  - spec/dummy/public/500.html
532
533
  - spec/dummy/public/favicon.ico
533
- - spec/dummy/public/uploads/gallery/file/1/hipster.jpg
534
- - spec/dummy/public/uploads/gallery/file/1/thumb_hipster.jpg
535
534
  - spec/dummy/script/rails
536
535
  - spec/features/authentication_pages_spec.rb
537
536
  - spec/features/galleries_pages_spec.rb
@@ -631,8 +630,6 @@ test_files:
631
630
  - spec/dummy/public/422.html
632
631
  - spec/dummy/public/500.html
633
632
  - spec/dummy/public/favicon.ico
634
- - spec/dummy/public/uploads/gallery/file/1/hipster.jpg
635
- - spec/dummy/public/uploads/gallery/file/1/thumb_hipster.jpg
636
633
  - spec/dummy/script/rails
637
634
  - spec/features/authentication_pages_spec.rb
638
635
  - spec/features/galleries_pages_spec.rb