maktoub 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +5 -0
- data/Rakefile +13 -9
- data/app/controllers/maktoub/subscribers_controller.rb +14 -0
- data/app/views/layouts/maktoub/application.html.erb +11 -2
- data/app/views/layouts/maktoub/newsletter_mailer.erb +4 -4
- data/app/views/maktoub/subscribers/edit.html.erb +13 -0
- data/app/views/maktoub/subscribers/update.html.erb +1 -0
- data/config/routes.rb +2 -0
- data/lib/maktoub.rb +10 -1
- data/lib/maktoub/version.rb +1 -1
- metadata +27 -121
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/images/logo.jpg +0 -0
- data/test/dummy/app/assets/javascripts/application.js +0 -9
- data/test/dummy/app/assets/stylesheets/application.css +0 -7
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/app/views/maktoub/newsletters/test_template.erb +0 -0
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -45
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -30
- data/test/dummy/config/environments/production.rb +0 -60
- data/test/dummy/config/environments/test.rb +0 -39
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -10
- data/test/dummy/config/initializers/maktoub.rb +0 -19
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -5
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +0 -16
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -6442
- data/test/dummy/log/test.log +0 -545
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -26
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/dummy/tmp/cache/assets/CA2/C20/sprockets%2F5603f1da541a5e3c72d26611478813da +0 -0
- data/test/dummy/tmp/cache/assets/CB4/BE0/sprockets%2F57f7e5c53278ac52062992433f317acc +0 -0
- data/test/dummy/tmp/cache/assets/CBC/F80/sprockets%2F95bdffc2824328543384db8ea7890153 +0 -0
- data/test/dummy/tmp/cache/assets/CCF/9C0/sprockets%2Fae24de6a552b3d6057517681a1a363e0 +0 -0
- data/test/dummy/tmp/cache/assets/CDD/630/sprockets%2F75757e115102f4fcc9ed52a2249bf082 +0 -0
- data/test/dummy/tmp/cache/assets/D34/130/sprockets%2F9a5c11d810e2e1f87ea6452113cc7e4c +0 -0
- data/test/dummy/tmp/cache/assets/D68/E80/sprockets%2F2c93d36471b04c04bb72a9aeeaf496a8 +0 -0
- data/test/dummy/tmp/cache/assets/D6E/8A0/sprockets%2Fa833bda5303fa2c89da36ec6b469618d +0 -0
- data/test/dummy/tmp/cache/assets/D70/6F0/sprockets%2Ff37da951add08a3d2866a4767b5afc43 +0 -0
- data/test/dummy/tmp/cache/assets/D74/710/sprockets%2F4865a147f154cadc0b49ebe873be7a85 +0 -0
- data/test/dummy/tmp/cache/assets/D76/B40/sprockets%2F8aea19137c7b683ef195fa3bf2a9704f +0 -0
- data/test/dummy/tmp/cache/assets/D7D/170/sprockets%2F15742d263cfefba79b76652f6e94ac6d +0 -0
- data/test/dummy/tmp/cache/assets/DC6/1E0/sprockets%2F5fad4aa8ef2c006cc0dd5233e98dd922 +0 -0
- data/test/functional/maktoub/archives_controller_test.rb +0 -25
- data/test/functional/maktoub/newsletter_mailer_test.rb +0 -31
- data/test/integration/navigation_test.rb +0 -10
- data/test/maktoub_test.rb +0 -45
- data/test/test_helper.rb +0 -11
- data/test/unit/helpers/maktoub/archives_helper_test.rb +0 -6
data/test/dummy/public/404.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/404.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test/dummy/public/422.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/422.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test/dummy/public/500.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/500.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>We're sorry, but something went wrong.</h1>
|
23
|
-
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
File without changes
|
data/test/dummy/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Maktoub
|
4
|
-
class ArchivesControllerTest < ActionController::TestCase
|
5
|
-
test "should get show" do
|
6
|
-
get :show, :use_route => 'maktoub'
|
7
|
-
assert_response :success
|
8
|
-
assert_template 'newsletters/readme'
|
9
|
-
assert_not_nil assigns(:subject)
|
10
|
-
assert_not_nil assigns(:archive)
|
11
|
-
end
|
12
|
-
|
13
|
-
test "should render the passed template" do
|
14
|
-
get :show, :newsletter => 'test_template', :use_route => 'maktoub'
|
15
|
-
assert_template 'newsletters/test_template'
|
16
|
-
assert_equal 'Test Template', assigns(:subject)
|
17
|
-
end
|
18
|
-
|
19
|
-
test "should use the newsletter_mailer layout" do
|
20
|
-
get :show, :use_route => 'maktoub'
|
21
|
-
assert_template "newsletter_mailer"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Maktoub
|
4
|
-
class NewsletterMailerTest < ActionMailer::TestCase
|
5
|
-
setup do
|
6
|
-
@mailer = NewsletterMailer.publish('test_template', email: 'zaid@example.com', name: 'zaid')
|
7
|
-
|
8
|
-
end
|
9
|
-
test "should have the right subject recipient and sender" do
|
10
|
-
assert_equal "Test Template", @mailer.subject
|
11
|
-
assert_equal ['maktoub@example.com'], @mailer.from # defined in dummy/config/initializers/maktoub.rb
|
12
|
-
assert_equal ['zaid@example.com'], @mailer.to
|
13
|
-
end
|
14
|
-
|
15
|
-
test "should be multipart" do
|
16
|
-
assert_equal true, @mailer.multipart?
|
17
|
-
assert_equal false, @mailer.html_part.blank?
|
18
|
-
assert_equal false, @mailer.text_part.blank?
|
19
|
-
end
|
20
|
-
|
21
|
-
test "html_part" do
|
22
|
-
body = @mailer.html_part.body.to_s
|
23
|
-
|
24
|
-
assert_match /View it in your browser/, body # change to link assertion
|
25
|
-
assert_match /Copyright/, body
|
26
|
-
assert_match /All rights reserved/, body
|
27
|
-
assert_match /update subscription preferences/, body # change to link assertion
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
data/test/maktoub_test.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'ostruct'
|
3
|
-
|
4
|
-
class MaktoubTest < ActiveSupport::TestCase
|
5
|
-
test "subscribers" do
|
6
|
-
users = [OpenStruct.new({:name => 'hello', :email => 'hello@example.com'})]
|
7
|
-
Maktoub.subscribers_extractor do
|
8
|
-
users
|
9
|
-
end
|
10
|
-
assert_equal 1, Maktoub.subscribers.length
|
11
|
-
users << OpenStruct.new({name: "bitch", email: "bitch@example.com"})
|
12
|
-
assert_equal 2, Maktoub.subscribers.length
|
13
|
-
end
|
14
|
-
|
15
|
-
test "email_field default value" do
|
16
|
-
Maktoub.email_field = nil
|
17
|
-
assert_equal :email, Maktoub.email_field
|
18
|
-
end
|
19
|
-
|
20
|
-
test "name_field default value" do
|
21
|
-
Maktoub.name_field = nil
|
22
|
-
assert_equal :name, Maktoub.name_field
|
23
|
-
end
|
24
|
-
|
25
|
-
test "custom email_field" do
|
26
|
-
Maktoub.email_field = :address
|
27
|
-
assert_equal :address, Maktoub.email_field
|
28
|
-
end
|
29
|
-
|
30
|
-
test "custom name_field" do
|
31
|
-
Maktoub.name_field = :first_name
|
32
|
-
assert_equal :first_name, Maktoub.name_field
|
33
|
-
end
|
34
|
-
|
35
|
-
test "configuration fields" do
|
36
|
-
assert_respond_to Maktoub, :from
|
37
|
-
assert_respond_to Maktoub, :twitter_url
|
38
|
-
assert_respond_to Maktoub, :facebook_url
|
39
|
-
assert_respond_to Maktoub, :subscription_preferences_url
|
40
|
-
assert_respond_to Maktoub, :logo
|
41
|
-
assert_respond_to Maktoub, :home_domain
|
42
|
-
assert_respond_to Maktoub, :app_name
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
data/test/test_helper.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# Configure Rails Environment
|
2
|
-
ENV["RAILS_ENV"] = "test"
|
3
|
-
|
4
|
-
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
-
require "rails/test_help"
|
6
|
-
|
7
|
-
Rails.backtrace_cleaner.remove_silencers!
|
8
|
-
|
9
|
-
# Load support files
|
10
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
11
|
-
|