jabe 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -19,6 +19,8 @@ group :development, :test do
19
19
  gem 'cucumber'
20
20
  gem 'cucumber-rails'
21
21
  gem 'database_cleaner', '>= 0.6.0'
22
+ gem 'email_spec'
23
+ gem 'gravtastic'
22
24
  gem 'jeweler'
23
25
  gem 'launchy'
24
26
  gem 'machinist', '>= 2.0.0.beta2'
@@ -67,6 +67,8 @@ GEM
67
67
  bcrypt-ruby (~> 2.1.2)
68
68
  warden (~> 1.0.2)
69
69
  diff-lcs (1.1.2)
70
+ email_spec (1.1.1)
71
+ rspec (~> 2.0)
70
72
  erubis (2.6.6)
71
73
  abstract (>= 1.0.0)
72
74
  ffi (0.6.3)
@@ -80,6 +82,7 @@ GEM
80
82
  gherkin (2.3.3)
81
83
  json (~> 1.4.6)
82
84
  git (1.2.5)
85
+ gravtastic (3.1.0)
83
86
  haml (3.0.25)
84
87
  haml-rails (0.3.4)
85
88
  actionpack (~> 3.0)
@@ -188,8 +191,10 @@ DEPENDENCIES
188
191
  cucumber-rails
189
192
  database_cleaner (>= 0.6.0)
190
193
  devise
194
+ email_spec
191
195
  formtastic (>= 1.2.3.beta)
192
196
  friendly_id (= 3.1.8)
197
+ gravtastic
193
198
  haml (>= 3.0.23)
194
199
  haml-rails
195
200
  jeweler
@@ -15,6 +15,7 @@ Edit your Gemfile and add the required gems
15
15
  <pre><code>gem 'devise'
16
16
  gem 'friendly_id', '3.1.8'
17
17
  gem 'formtastic', '>= 1.2.3.beta'
18
+ gem 'gravtastic'
18
19
  gem 'haml', '>= 3.0.23'
19
20
  gem 'haml-rails'
20
21
  gem 'jabe'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.8
1
+ 0.5.9
@@ -6,4 +6,8 @@ module JabeHelper
6
6
  def public_entry_url(entry)
7
7
  "#{SETTINGS.site_url}#{public_entry_path(entry)}"
8
8
  end
9
+
10
+ def default_gravatar_url
11
+ "#{request.protocol}#{request.host_with_port}/images/gravatar.gif"
12
+ end
9
13
  end
@@ -1,4 +1,9 @@
1
1
  class Comment < ActiveRecord::Base
2
+ if defined?(Gravtastic)
3
+ include Gravtastic
4
+ gravtastic :size => 64
5
+ end
6
+
2
7
  belongs_to :entry
3
8
  default_scope :order => 'created_at ASC'
4
9
  before_validation :bot_check
@@ -2,6 +2,6 @@ class Settings < ActiveRecord::Base
2
2
 
3
3
  def do_updates
4
4
  Time.zone = self.time_zone
5
- ActionMailer::Base.default_url_options[:host] = self.site_url
5
+ ActionMailer::Base.default_url_options[:host] = self.host_name
6
6
  end
7
7
  end
@@ -84,7 +84,7 @@ h1#site-tagline {
84
84
  }
85
85
 
86
86
  .date {
87
- font-size:.9em;
87
+ font-size:.8em;
88
88
  padding:5px 0;
89
89
  }
90
90
 
@@ -92,7 +92,7 @@ h1#site-tagline {
92
92
  color:#eee;
93
93
  background-color:#AAA;
94
94
  font-size:.9em;
95
- margin-top:10px;
95
+ margin-top:30px;
96
96
  padding:10px;
97
97
  -webkit-border-radius: 5px;
98
98
  -moz-border-radius: 5px;
@@ -105,6 +105,7 @@ h1#site-tagline {
105
105
 
106
106
  .last {
107
107
  border-bottom:none;
108
+ margin-bottom:0;
108
109
  }
109
110
 
110
111
  #site-title a, #site-title a:visited {
@@ -115,24 +116,44 @@ h1#site-tagline {
115
116
  #comments {
116
117
  padding-top:20px;
117
118
 
118
- .author {
119
- font-weight:bold;
120
- padding:10px 0 5px 10px;
119
+ .comment {
120
+ clear:both;
121
+
122
+ .gravatar {
123
+ margin:10px 10px 10px 0;
124
+ float:left;
125
+ width:64px;
126
+ height:64px;
127
+ border:solid 5px #588EDE;
128
+ -webkit-border-radius: 5px;
129
+ -moz-border-radius: 5px;
130
+ border-radius: 5px;
131
+
132
+ img {
133
+ width:64px;
134
+ height:64px;
135
+ }
136
+ }
137
+
138
+ .author {
139
+ font-weight:bold;
140
+ padding:10px 0 5px 10px;
121
141
 
122
- .when {
123
- padding-left:10px;
124
- font-size:.8em;
142
+ .when {
143
+ padding-left:10px;
144
+ font-size:.8em;
145
+ }
125
146
  }
126
- }
127
147
 
128
- .body {
129
- padding:5px 20px;
130
- border-bottom:solid 1px #333;
148
+ .body {
149
+ min-height:55px;
150
+ padding:5px 20px;
151
+ border-bottom:solid 1px #333;
152
+ }
131
153
  }
132
154
 
133
155
  #new_comment {
134
156
  padding-top:20px;
135
-
136
157
  }
137
158
  }
138
159
 
@@ -146,9 +167,13 @@ pre {
146
167
  overflow-x:auto;
147
168
  }
148
169
 
149
- label abbr {
150
- color:red;
151
- padding:0 3px;
170
+ label {
171
+ padding: 10px 0 5px;
172
+
173
+ abbr {
174
+ color:red;
175
+ padding:0 3px;
176
+ }
152
177
  }
153
178
 
154
179
  .inline-errors {
@@ -10,5 +10,4 @@
10
10
  = form.input :show_github_badge
11
11
  = form.input :twitter_username
12
12
  = form.input :facebook_url
13
-
14
- = form.submit 'Save'
13
+ = form.submit 'Save'
@@ -13,6 +13,8 @@
13
13
  - if entry.comments.any?
14
14
  - entry.comments.each do |comment|
15
15
  .comment
16
+ .gravatar
17
+ = image_tag comment.gravatar_url(:default => default_gravatar_url)
16
18
  .author
17
19
  = comment.name
18
20
  %span.when
@@ -0,0 +1,3 @@
1
+ begin
2
+ require 'gravtastic'
3
+ rescue LoadError; end
@@ -0,0 +1,194 @@
1
+ # Commonly used email steps
2
+ #
3
+ # To add your own steps make a custom_email_steps.rb
4
+ # The provided methods are:
5
+ #
6
+ # last_email_address
7
+ # reset_mailer
8
+ # open_last_email
9
+ # visit_in_email
10
+ # unread_emails_for
11
+ # mailbox_for
12
+ # current_email
13
+ # open_email
14
+ # read_emails_for
15
+ # find_email
16
+ #
17
+ # General form for email scenarios are:
18
+ # - clear the email queue (done automatically by email_spec)
19
+ # - execute steps that sends an email
20
+ # - check the user received an/no/[0-9] emails
21
+ # - open the email
22
+ # - inspect the email contents
23
+ # - interact with the email (e.g. click links)
24
+ #
25
+ # The Cucumber steps below are setup in this order.
26
+
27
+ module EmailHelpers
28
+ def current_email_address
29
+ # Replace with your a way to find your current email. e.g @current_user.email
30
+ # last_email_address will return the last email address used by email spec to find an email.
31
+ # Note that last_email_address will be reset after each Scenario.
32
+ last_email_address || "example@example.com"
33
+ end
34
+ end
35
+
36
+ World(EmailHelpers)
37
+
38
+ #
39
+ # Reset the e-mail queue within a scenario.
40
+ # This is done automatically before each scenario.
41
+ #
42
+
43
+ Given /^(?:a clear email queue|no emails have been sent)$/ do
44
+ reset_mailer
45
+ end
46
+
47
+ #
48
+ # Check how many emails have been sent/received
49
+ #
50
+
51
+ Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails?$/ do |address, amount|
52
+ unread_emails_for(address).size.should == parse_email_count(amount)
53
+ end
54
+
55
+ Then /^(?:I|they|"([^"]*?)") should have (an|no|\d+) emails?$/ do |address, amount|
56
+ mailbox_for(address).size.should == parse_email_count(amount)
57
+ end
58
+
59
+ Then /^(?:I|they|"([^"]*?)") should receive (an|no|\d+) emails? with subject "([^"]*?)"$/ do |address, amount, subject|
60
+ unread_emails_for(address).select { |m| m.subject =~ Regexp.new(subject) }.size.should == parse_email_count(amount)
61
+ end
62
+
63
+ Then /^(?:I|they|"([^"]*?)") should receive an email with the following body:$/ do |address, expected_body|
64
+ open_email(address, :with_text => expected_body)
65
+ end
66
+
67
+ #
68
+ # Accessing emails
69
+ #
70
+
71
+ # Opens the most recently received email
72
+ When /^(?:I|they|"([^"]*?)") opens? the email$/ do |address|
73
+ open_email(address)
74
+ end
75
+
76
+ When /^(?:I|they|"([^"]*?)") opens? the email with subject "([^"]*?)"$/ do |address, subject|
77
+ open_email(address, :with_subject => subject)
78
+ end
79
+
80
+ When /^(?:I|they|"([^"]*?)") opens? the email with text "([^"]*?)"$/ do |address, text|
81
+ open_email(address, :with_text => text)
82
+ end
83
+
84
+ #
85
+ # Inspect the Email Contents
86
+ #
87
+
88
+ Then /^(?:I|they) should see "([^"]*?)" in the email subject$/ do |text|
89
+ current_email.should have_subject(text)
90
+ end
91
+
92
+ Then /^(?:I|they) should see \/([^"]*?)\/ in the email subject$/ do |text|
93
+ current_email.should have_subject(Regexp.new(text))
94
+ end
95
+
96
+ Then /^(?:I|they) should see "([^"]*?)" in the email body$/ do |text|
97
+ current_email.default_part_body.to_s.should include(text)
98
+ end
99
+
100
+ Then /^(?:I|they) should see \/([^"]*?)\/ in the email body$/ do |text|
101
+ current_email.default_part_body.to_s.should =~ Regexp.new(text)
102
+ end
103
+
104
+ Then /^(?:I|they) should see the email delivered from "([^"]*?)"$/ do |text|
105
+ current_email.should be_delivered_from(text)
106
+ end
107
+
108
+ Then /^(?:I|they) should see "([^\"]*)" in the email "([^"]*?)" header$/ do |text, name|
109
+ current_email.should have_header(name, text)
110
+ end
111
+
112
+ Then /^(?:I|they) should see \/([^\"]*)\/ in the email "([^"]*?)" header$/ do |text, name|
113
+ current_email.should have_header(name, Regexp.new(text))
114
+ end
115
+
116
+ Then /^I should see it is a multi\-part email$/ do
117
+ current_email.should be_multipart
118
+ end
119
+
120
+ Then /^(?:I|they) should see "([^"]*?)" in the email html part body$/ do |text|
121
+ current_email.html_part.body.to_s.should include(text)
122
+ end
123
+
124
+ Then /^(?:I|they) should see "([^"]*?)" in the email text part body$/ do |text|
125
+ current_email.text_part.body.to_s.should include(text)
126
+ end
127
+
128
+ #
129
+ # Inspect the Email Attachments
130
+ #
131
+
132
+ Then /^(?:I|they) should see (an|no|\d+) attachments? with the email$/ do |amount|
133
+ current_email_attachments.size.should == parse_email_count(amount)
134
+ end
135
+
136
+ Then /^there should be (an|no|\d+) attachments? named "([^"]*?)"$/ do |amount, filename|
137
+ current_email_attachments.select { |a| a.filename == filename }.size.should == parse_email_count(amount)
138
+ end
139
+
140
+ Then /^attachment (\d+) should be named "([^"]*?)"$/ do |index, filename|
141
+ current_email_attachments[(index.to_i - 1)].filename.should == filename
142
+ end
143
+
144
+ Then /^there should be (an|no|\d+) attachments? of type "([^"]*?)"$/ do |amount, content_type|
145
+ current_email_attachments.select { |a| a.content_type.include?(content_type) }.size.should == parse_email_count(amount)
146
+ end
147
+
148
+ Then /^attachment (\d+) should be of type "([^"]*?)"$/ do |index, content_type|
149
+ current_email_attachments[(index.to_i - 1)].content_type.should include(content_type)
150
+ end
151
+
152
+ Then /^all attachments should not be blank$/ do
153
+ current_email_attachments.each do |attachment|
154
+ attachment.read.size.should_not == 0
155
+ end
156
+ end
157
+
158
+ Then /^show me a list of email attachments$/ do
159
+ EmailSpec::EmailViewer::save_and_open_email_attachments_list(current_email)
160
+ end
161
+
162
+ #
163
+ # Interact with Email Contents
164
+ #
165
+
166
+ When /^(?:I|they) follow "([^"]*?)" in the email$/ do |link|
167
+ visit_in_email(link)
168
+ end
169
+
170
+ When /^(?:I|they) click the first link in the email$/ do
171
+ click_first_link_in_email
172
+ end
173
+
174
+ #
175
+ # Debugging
176
+ # These only work with Rails and OSx ATM since EmailViewer uses RAILS_ROOT and OSx's 'open' command.
177
+ # Patches accepted. ;)
178
+ #
179
+
180
+ Then /^save and open current email$/ do
181
+ EmailSpec::EmailViewer::save_and_open_email(current_email)
182
+ end
183
+
184
+ Then /^save and open all text emails$/ do
185
+ EmailSpec::EmailViewer::save_and_open_all_text_emails
186
+ end
187
+
188
+ Then /^save and open all html emails$/ do
189
+ EmailSpec::EmailViewer::save_and_open_all_html_emails
190
+ end
191
+
192
+ Then /^save and open all raw emails$/ do
193
+ EmailSpec::EmailViewer::save_and_open_all_raw_emails
194
+ end
@@ -1,3 +1,5 @@
1
+ require 'email_spec'
2
+ require 'email_spec/cucumber'
1
3
  require 'machinist/active_record'
2
4
 
3
5
  # takes care of
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jabe
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 8
10
- version: 0.5.8
9
+ - 9
10
+ version: 0.5.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Moen a.k.a. UnderpantsGnome
@@ -287,7 +287,7 @@ dependencies:
287
287
  version: "0"
288
288
  requirement: *id018
289
289
  prerelease: false
290
- name: jeweler
290
+ name: email_spec
291
291
  type: :development
292
292
  - !ruby/object:Gem::Dependency
293
293
  version_requirements: &id019 !ruby/object:Gem::Requirement
@@ -301,10 +301,38 @@ dependencies:
301
301
  version: "0"
302
302
  requirement: *id019
303
303
  prerelease: false
304
- name: launchy
304
+ name: gravtastic
305
305
  type: :development
306
306
  - !ruby/object:Gem::Dependency
307
307
  version_requirements: &id020 !ruby/object:Gem::Requirement
308
+ none: false
309
+ requirements:
310
+ - - ">="
311
+ - !ruby/object:Gem::Version
312
+ hash: 3
313
+ segments:
314
+ - 0
315
+ version: "0"
316
+ requirement: *id020
317
+ prerelease: false
318
+ name: jeweler
319
+ type: :development
320
+ - !ruby/object:Gem::Dependency
321
+ version_requirements: &id021 !ruby/object:Gem::Requirement
322
+ none: false
323
+ requirements:
324
+ - - ">="
325
+ - !ruby/object:Gem::Version
326
+ hash: 3
327
+ segments:
328
+ - 0
329
+ version: "0"
330
+ requirement: *id021
331
+ prerelease: false
332
+ name: launchy
333
+ type: :development
334
+ - !ruby/object:Gem::Dependency
335
+ version_requirements: &id022 !ruby/object:Gem::Requirement
308
336
  none: false
309
337
  requirements:
310
338
  - - ">="
@@ -317,12 +345,12 @@ dependencies:
317
345
  - beta
318
346
  - 2
319
347
  version: 2.0.0.beta2
320
- requirement: *id020
348
+ requirement: *id022
321
349
  prerelease: false
322
350
  name: machinist
323
351
  type: :development
324
352
  - !ruby/object:Gem::Dependency
325
- version_requirements: &id021 !ruby/object:Gem::Requirement
353
+ version_requirements: &id023 !ruby/object:Gem::Requirement
326
354
  none: false
327
355
  requirements:
328
356
  - - ">="
@@ -331,12 +359,12 @@ dependencies:
331
359
  segments:
332
360
  - 0
333
361
  version: "0"
334
- requirement: *id021
362
+ requirement: *id023
335
363
  prerelease: false
336
364
  name: pickle
337
365
  type: :development
338
366
  - !ruby/object:Gem::Dependency
339
- version_requirements: &id022 !ruby/object:Gem::Requirement
367
+ version_requirements: &id024 !ruby/object:Gem::Requirement
340
368
  none: false
341
369
  requirements:
342
370
  - - ">="
@@ -345,12 +373,12 @@ dependencies:
345
373
  segments:
346
374
  - 0
347
375
  version: "0"
348
- requirement: *id022
376
+ requirement: *id024
349
377
  prerelease: false
350
378
  name: rcov
351
379
  type: :development
352
380
  - !ruby/object:Gem::Dependency
353
- version_requirements: &id023 !ruby/object:Gem::Requirement
381
+ version_requirements: &id025 !ruby/object:Gem::Requirement
354
382
  none: false
355
383
  requirements:
356
384
  - - ">="
@@ -359,12 +387,12 @@ dependencies:
359
387
  segments:
360
388
  - 0
361
389
  version: "0"
362
- requirement: *id023
390
+ requirement: *id025
363
391
  prerelease: false
364
392
  name: redgreen
365
393
  type: :development
366
394
  - !ruby/object:Gem::Dependency
367
- version_requirements: &id024 !ruby/object:Gem::Requirement
395
+ version_requirements: &id026 !ruby/object:Gem::Requirement
368
396
  none: false
369
397
  requirements:
370
398
  - - "="
@@ -375,12 +403,12 @@ dependencies:
375
403
  - 0
376
404
  - 1
377
405
  version: 2.0.1
378
- requirement: *id024
406
+ requirement: *id026
379
407
  prerelease: false
380
408
  name: rspec-rails
381
409
  type: :development
382
410
  - !ruby/object:Gem::Dependency
383
- version_requirements: &id025 !ruby/object:Gem::Requirement
411
+ version_requirements: &id027 !ruby/object:Gem::Requirement
384
412
  none: false
385
413
  requirements:
386
414
  - - ">="
@@ -389,12 +417,12 @@ dependencies:
389
417
  segments:
390
418
  - 0
391
419
  version: "0"
392
- requirement: *id025
420
+ requirement: *id027
393
421
  prerelease: false
394
422
  name: ruby-debug
395
423
  type: :development
396
424
  - !ruby/object:Gem::Dependency
397
- version_requirements: &id026 !ruby/object:Gem::Requirement
425
+ version_requirements: &id028 !ruby/object:Gem::Requirement
398
426
  none: false
399
427
  requirements:
400
428
  - - ">="
@@ -403,12 +431,12 @@ dependencies:
403
431
  segments:
404
432
  - 0
405
433
  version: "0"
406
- requirement: *id026
434
+ requirement: *id028
407
435
  prerelease: false
408
436
  name: mysql
409
437
  type: :development
410
438
  - !ruby/object:Gem::Dependency
411
- version_requirements: &id027 !ruby/object:Gem::Requirement
439
+ version_requirements: &id029 !ruby/object:Gem::Requirement
412
440
  none: false
413
441
  requirements:
414
442
  - - ">="
@@ -417,12 +445,12 @@ dependencies:
417
445
  segments:
418
446
  - 0
419
447
  version: "0"
420
- requirement: *id027
448
+ requirement: *id029
421
449
  prerelease: false
422
450
  name: sqlite3-ruby
423
451
  type: :development
424
452
  - !ruby/object:Gem::Dependency
425
- version_requirements: &id028 !ruby/object:Gem::Requirement
453
+ version_requirements: &id030 !ruby/object:Gem::Requirement
426
454
  none: false
427
455
  requirements:
428
456
  - - ">="
@@ -431,7 +459,7 @@ dependencies:
431
459
  segments:
432
460
  - 0
433
461
  version: "0"
434
- requirement: *id028
462
+ requirement: *id030
435
463
  prerelease: false
436
464
  name: wirble
437
465
  type: :development
@@ -471,7 +499,6 @@ files:
471
499
  - app/views/admin/entries/index.html.haml
472
500
  - app/views/admin/entries/new.html.haml
473
501
  - app/views/admin/settings/edit.html.haml
474
- - app/views/entries/_comment.html.haml
475
502
  - app/views/entries/_comment_form.html.haml
476
503
  - app/views/entries/index.html.haml
477
504
  - app/views/entries/show.html.haml
@@ -480,6 +507,7 @@ files:
480
507
  - app/views/layouts/_header.html.haml
481
508
  - app/views/layouts/_sidebar.html.haml
482
509
  - app/views/layouts/application.html.haml
510
+ - config/initializers/gravtastic.rb
483
511
  - config/initializers/sass.rb
484
512
  - config/initializers/settings.rb
485
513
  - config/initializers/time_formats.rb
@@ -501,6 +529,7 @@ files:
501
529
  - public/crossdomain.xml
502
530
  - public/images/delete_page.png
503
531
  - public/images/full_page.png
532
+ - public/images/gravatar.gif
504
533
  - public/javascripts/application.js
505
534
  - public/javascripts/jquery-ui.js
506
535
  - public/javascripts/jquery-ui.min.js
@@ -539,6 +568,7 @@ files:
539
568
  - test/dummy/db/migrate/20110104004400_add_new_settings.rb
540
569
  - test/dummy/db/schema.rb
541
570
  - test/dummy/features/step_definitions/admin_steps.rb
571
+ - test/dummy/features/step_definitions/email_steps.rb
542
572
  - test/dummy/features/step_definitions/entry_steps.rb
543
573
  - test/dummy/features/step_definitions/support_steps.rb
544
574
  - test/dummy/features/step_definitions/web_steps.rb
@@ -611,6 +641,7 @@ test_files:
611
641
  - test/dummy/db/migrate/20110104004400_add_new_settings.rb
612
642
  - test/dummy/db/schema.rb
613
643
  - test/dummy/features/step_definitions/admin_steps.rb
644
+ - test/dummy/features/step_definitions/email_steps.rb
614
645
  - test/dummy/features/step_definitions/entry_steps.rb
615
646
  - test/dummy/features/step_definitions/support_steps.rb
616
647
  - test/dummy/features/step_definitions/web_steps.rb
File without changes