lalala 4.0.0.dev.181 → 4.0.0.dev.183

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: 07fdbeeb9ea7cb7707da67dd9091edad5a86e80c
4
- data.tar.gz: a05503c62520cf6b3c921436ea0e51cd2e57dace
3
+ metadata.gz: c674a8927d33f9750464b66cf35c8a53ffbbc9c0
4
+ data.tar.gz: 742ef49cbdd176b5c5e8cd5ed4a864aeb0b9caea
5
5
  SHA512:
6
- metadata.gz: baba469ab05f2ac563b99e132fd3ef45d7c8951345ab229114455e2397a3d2673f1a93903cf34c0f339f959f1403921a807f5670ecdb26772f919f2d3190a7f3
7
- data.tar.gz: 44745e35a0121a0209c4c7ed515e11d60961e29c52e62bb54a26ad2ad5a9db234dc070d654f5e2bd3cc63e2bc091b7916e04fa5fb46e97db47ce284e3fbc30dc
6
+ metadata.gz: 7ba71aa21ede75e186237c3bbd6de012afec3a9dfc95b53337f4be5850da98186968c142d3462fae6781767449ad7bc9b957556571c8d2a0cbb248e7163742c2
7
+ data.tar.gz: 6752a23b90ec9f1cbba1734930153c32e85ba73040cd388fd503853cac4a384bb2bc5d98834c4d4af8007e0607a23ba04d680d5b6de4e232c6d4dadafdfa8f8c
data/.gitignore CHANGED
@@ -18,6 +18,7 @@ test/dummy/.sass-cache
18
18
  test/dummy/db/*.sqlite3
19
19
  test/dummy/log/*.log
20
20
  test/dummy/tmp/
21
+ test/dummy/public/uploads
21
22
  test/tmp
22
23
  test/version_tmp
23
24
  tmp
data/Rakefile CHANGED
@@ -24,6 +24,7 @@ end
24
24
 
25
25
 
26
26
 
27
+ CALLED_FROM_ENGINE = true
27
28
  APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
28
29
  load 'rails/tasks/engine.rake'
29
30
 
@@ -7,9 +7,9 @@ class Formtastic::Inputs::SingleFileInput
7
7
  model_class = object.class.reflect_on_association(method).klass
8
8
 
9
9
  html = template.raw("")
10
- html << template.content_tag(:label, method.to_s.humanize, class: "label")
10
+ html << label_html
11
11
  html << builder.fields_for(method, model_class.new) do |f|
12
- f.file_field :asset, accept: model_class.extension_white_list
12
+ f.file_field :asset, accept: model_class.extension_white_list, id: input_html_options[:id]
13
13
  end
14
14
 
15
15
  if model_instance
data/lib/lalala/engine.rb CHANGED
@@ -13,8 +13,7 @@ module Lalala
13
13
 
14
14
  initializer "lalala.migrations" do |app|
15
15
  app.class.configure do
16
- if app.class.to_s == "Dummy::Application"
17
- else
16
+ unless defined?(CALLED_FROM_ENGINE) and CALLED_FROM_ENGINE
18
17
  config.paths['db/migrate'] += Lalala::Engine.paths['db/migrate'].existent
19
18
  end
20
19
  end
@@ -0,0 +1,16 @@
1
+ module Lalala::Test::LoginHelper
2
+
3
+ private
4
+
5
+ def login_as_admin!
6
+ AdminUser.create! name: 'Admin', email: 'admin@example.com', password: 'password', password_confirmation: 'password'
7
+
8
+ visit('/lalala')
9
+ assert_equal(new_admin_user_session_path, current_path)
10
+ fill_in('Email', with: 'admin@example.com')
11
+ fill_in('Password', with: 'password')
12
+ click_on('Login')
13
+ assert_equal('/lalala', current_path)
14
+ end
15
+
16
+ end
data/lib/lalala/test.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  module Lalala
2
2
  module Test
3
+ extend ActiveSupport::Autoload
4
+
5
+ autoload :LoginHelper
3
6
 
4
7
  def self.setup!
5
8
  require 'capybara/rails'
@@ -7,6 +10,7 @@ module Lalala
7
10
 
8
11
  Rails.backtrace_cleaner.remove_silencers!
9
12
 
13
+ ActionDispatch::IntegrationTest.send :include, Lalala::Test::LoginHelper
10
14
  ActionDispatch::IntegrationTest.send :include, Capybara::DSL
11
15
 
12
16
  Capybara.javascript_driver = :poltergeist
@@ -1,6 +1,6 @@
1
1
  module Lalala
2
2
  VERSION = "4.0.0"
3
- BUILD = "181"
3
+ BUILD = "183"
4
4
 
5
5
  if BUILD != ("{{BUILD_NUMBER" + "}}") # prevent sed replacement (see script/ci)
6
6
  BUILD_VERSION = "#{VERSION}.dev.#{BUILD}"
@@ -0,0 +1,12 @@
1
+ ActiveAdmin.register Article do
2
+
3
+ form do |f|
4
+ f.inputs do
5
+ f.input :title
6
+ f.input :body
7
+ f.input :image, as: :single_file
8
+ end
9
+ f.actions
10
+ end
11
+
12
+ end
@@ -0,0 +1,9 @@
1
+ class Article < ActiveRecord::Base
2
+ attr_accessible :body, :title
3
+
4
+ has_one_asset :image
5
+
6
+ validates :title,
7
+ presence: true
8
+
9
+ end
@@ -0,0 +1,2 @@
1
+ class FileAsset < Lalala::FileAsset
2
+ end
@@ -0,0 +1,2 @@
1
+ class ImageAsset < Lalala::ImageAsset
2
+ end
@@ -1,2 +1,11 @@
1
1
  class ImageUploader < Lalala::Uploaders::Image
2
+
3
+ #
4
+ # Versions
5
+ # -- https://github.com/jnicklas/carrierwave#adding-versions
6
+ #
7
+ # version :example do
8
+ # process :resize_to_fill => [420, 700]
9
+ # end
10
+
2
11
  end
@@ -0,0 +1,10 @@
1
+ class CreateArticles < ActiveRecord::Migration
2
+ def change
3
+ create_table :articles do |t|
4
+ t.string :title
5
+ t.text :body
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20130524155010) do
14
+ ActiveRecord::Schema.define(:version => 20130528092721) do
15
15
 
16
16
  create_table "active_admin_comments", :force => true do |t|
17
17
  t.string "resource_id", :null => false
@@ -29,6 +29,7 @@ ActiveRecord::Schema.define(:version => 20130524155010) do
29
29
  add_index "active_admin_comments", ["resource_type", "resource_id"], :name => "index_admin_notes_on_resource_type_and_resource_id"
30
30
 
31
31
  create_table "admin_users", :force => true do |t|
32
+ t.string "name", :null => false
32
33
  t.string "email", :default => "", :null => false
33
34
  t.string "encrypted_password", :default => "", :null => false
34
35
  t.string "reset_password_token"
@@ -41,12 +42,18 @@ ActiveRecord::Schema.define(:version => 20130524155010) do
41
42
  t.string "last_sign_in_ip"
42
43
  t.datetime "created_at", :null => false
43
44
  t.datetime "updated_at", :null => false
44
- t.string "name"
45
45
  end
46
46
 
47
47
  add_index "admin_users", ["email"], :name => "index_admin_users_on_email", :unique => true
48
48
  add_index "admin_users", ["reset_password_token"], :name => "index_admin_users_on_reset_password_token", :unique => true
49
49
 
50
+ create_table "articles", :force => true do |t|
51
+ t.string "title"
52
+ t.text "body"
53
+ t.datetime "created_at", :null => false
54
+ t.datetime "updated_at", :null => false
55
+ end
56
+
50
57
  create_table "asset_translations", :force => true do |t|
51
58
  t.string "locale"
52
59
  t.integer "asset_id"
Binary file
@@ -27,17 +27,4 @@ class AdminUsersTest < ActionDispatch::IntegrationTest
27
27
  assert page.has_text?('Mr. Manager')
28
28
  end
29
29
 
30
- private
31
-
32
- def login_as_admin!
33
- AdminUser.create! name: 'Admin', email: 'admin@example.com', password: 'password', password_confirmation: 'password'
34
-
35
- visit('/lalala')
36
- assert_equal(new_admin_user_session_path, current_path)
37
- fill_in('Email', with: 'admin@example.com')
38
- fill_in('Password', with: 'password')
39
- click_on('Login')
40
- assert_equal('/lalala', current_path)
41
- end
42
-
43
30
  end
@@ -0,0 +1,32 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class ArticlesTest < ActionDispatch::IntegrationTest
4
+
5
+ def setup
6
+ login_as_admin!
7
+ end
8
+
9
+ test 'list articles' do
10
+ Article.create!(title: "Hello World")
11
+
12
+ click_on('Articles')
13
+ assert_equal 200, page.status_code
14
+ assert page.has_text?('Hello World')
15
+ end
16
+
17
+ test 'create article' do
18
+ click_on('Articles')
19
+ click_on('New Article')
20
+ assert_equal('/lalala/articles/new', current_path)
21
+
22
+ fill_in('Title', with: 'My Article')
23
+ attach_file('Image', File.expand_path('../../fixtures/files/image.png', __FILE__))
24
+ click_on('Create Article')
25
+ page.save_page
26
+ assert_equal 200, page.status_code
27
+ assert_equal('/lalala/articles/1', current_path)
28
+
29
+ assert page.has_text?('My Article')
30
+ end
31
+
32
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lalala
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.dev.181
4
+ version: 4.0.0.dev.183
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Menke
@@ -1425,6 +1425,7 @@ files:
1425
1425
  - lib/lalala/pages/path_handler.rb
1426
1426
  - lib/lalala/pages/route_mapper.rb
1427
1427
  - lib/lalala/test.rb
1428
+ - lib/lalala/test/login_helper.rb
1428
1429
  - lib/lalala/uploaders.rb
1429
1430
  - lib/lalala/uploaders/file.rb
1430
1431
  - lib/lalala/uploaders/image.rb
@@ -1441,6 +1442,7 @@ files:
1441
1442
  - test/dummy/Rakefile
1442
1443
  - test/dummy/app/admin/admin_pages.rb
1443
1444
  - test/dummy/app/admin/admin_users.rb
1445
+ - test/dummy/app/admin/articles.rb
1444
1446
  - test/dummy/app/admin/dashboard.rb
1445
1447
  - test/dummy/app/assets/javascripts/active_admin.js
1446
1448
  - test/dummy/app/assets/javascripts/application.js
@@ -1453,6 +1455,9 @@ files:
1453
1455
  - test/dummy/app/mailers/.gitkeep
1454
1456
  - test/dummy/app/models/.gitkeep
1455
1457
  - test/dummy/app/models/admin_user.rb
1458
+ - test/dummy/app/models/article.rb
1459
+ - test/dummy/app/models/file_asset.rb
1460
+ - test/dummy/app/models/image_asset.rb
1456
1461
  - test/dummy/app/pages/application_page.rb
1457
1462
  - test/dummy/app/uploaders/file_uploader.rb
1458
1463
  - test/dummy/app/uploaders/image_uploader.rb
@@ -1476,6 +1481,7 @@ files:
1476
1481
  - test/dummy/config/locales/en.yml
1477
1482
  - test/dummy/config/routes.rb
1478
1483
  - test/dummy/db/.gitkeep
1484
+ - test/dummy/db/migrate/20130528092721_create_articles.rb
1479
1485
  - test/dummy/db/schema.rb
1480
1486
  - test/dummy/lib/assets/.gitkeep
1481
1487
  - test/dummy/log/.gitkeep
@@ -1487,8 +1493,10 @@ files:
1487
1493
  - test/dummy/test/fixtures/admin_users.yml
1488
1494
  - test/dummy/test/unit/admin_user_test.rb
1489
1495
  - test/dummy/tmp/cache/.gitkeep
1496
+ - test/fixtures/files/image.png
1490
1497
  - test/i18n/router_test.rb
1491
1498
  - test/integration/admin_users_test.rb
1499
+ - test/integration/aricles_test.rb
1492
1500
  - test/integration/login_test.rb
1493
1501
  - test/lalala_test.rb
1494
1502
  - test/test_helper.rb
@@ -1520,6 +1528,7 @@ test_files:
1520
1528
  - test/dummy/Rakefile
1521
1529
  - test/dummy/app/admin/admin_pages.rb
1522
1530
  - test/dummy/app/admin/admin_users.rb
1531
+ - test/dummy/app/admin/articles.rb
1523
1532
  - test/dummy/app/admin/dashboard.rb
1524
1533
  - test/dummy/app/assets/javascripts/active_admin.js
1525
1534
  - test/dummy/app/assets/javascripts/application.js
@@ -1532,6 +1541,9 @@ test_files:
1532
1541
  - test/dummy/app/mailers/.gitkeep
1533
1542
  - test/dummy/app/models/.gitkeep
1534
1543
  - test/dummy/app/models/admin_user.rb
1544
+ - test/dummy/app/models/article.rb
1545
+ - test/dummy/app/models/file_asset.rb
1546
+ - test/dummy/app/models/image_asset.rb
1535
1547
  - test/dummy/app/pages/application_page.rb
1536
1548
  - test/dummy/app/uploaders/file_uploader.rb
1537
1549
  - test/dummy/app/uploaders/image_uploader.rb
@@ -1555,6 +1567,7 @@ test_files:
1555
1567
  - test/dummy/config/locales/en.yml
1556
1568
  - test/dummy/config/routes.rb
1557
1569
  - test/dummy/db/.gitkeep
1570
+ - test/dummy/db/migrate/20130528092721_create_articles.rb
1558
1571
  - test/dummy/db/schema.rb
1559
1572
  - test/dummy/lib/assets/.gitkeep
1560
1573
  - test/dummy/log/.gitkeep
@@ -1566,8 +1579,10 @@ test_files:
1566
1579
  - test/dummy/test/fixtures/admin_users.yml
1567
1580
  - test/dummy/test/unit/admin_user_test.rb
1568
1581
  - test/dummy/tmp/cache/.gitkeep
1582
+ - test/fixtures/files/image.png
1569
1583
  - test/i18n/router_test.rb
1570
1584
  - test/integration/admin_users_test.rb
1585
+ - test/integration/aricles_test.rb
1571
1586
  - test/integration/login_test.rb
1572
1587
  - test/lalala_test.rb
1573
1588
  - test/test_helper.rb