letter_bomb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +62 -0
  4. data/Rakefile +9 -0
  5. data/app/controllers/letter_bomb/application_controller.rb +4 -0
  6. data/app/controllers/letter_bomb/mailers_controller.rb +13 -0
  7. data/app/views/layouts/letter_bomb/application.html.erb +12 -0
  8. data/app/views/letter_bomb/mailers/index.html.erb +12 -0
  9. data/app/views/letter_bomb/mailers/show.html.erb +88 -0
  10. data/config/routes.rb +4 -0
  11. data/lib/letter_bomb.rb +2 -0
  12. data/lib/letter_bomb/engine.rb +17 -0
  13. data/lib/letter_bomb/preview.rb +33 -0
  14. data/lib/letter_bomb/version.rb +3 -0
  15. data/spec/dummy/README.rdoc +261 -0
  16. data/spec/dummy/Rakefile +7 -0
  17. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  18. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  19. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  20. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  21. data/spec/dummy/app/mailers/user_mailer.rb +21 -0
  22. data/spec/dummy/app/models/user.rb +3 -0
  23. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  24. data/spec/dummy/app/views/user_mailer/welcome.html.erb +3 -0
  25. data/spec/dummy/config.ru +4 -0
  26. data/spec/dummy/config/application.rb +65 -0
  27. data/spec/dummy/config/boot.rb +10 -0
  28. data/spec/dummy/config/database.yml +25 -0
  29. data/spec/dummy/config/environment.rb +5 -0
  30. data/spec/dummy/config/environments/development.rb +37 -0
  31. data/spec/dummy/config/environments/production.rb +67 -0
  32. data/spec/dummy/config/environments/test.rb +37 -0
  33. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  34. data/spec/dummy/config/initializers/inflections.rb +15 -0
  35. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  36. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  37. data/spec/dummy/config/initializers/session_store.rb +8 -0
  38. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  39. data/spec/dummy/config/locales/en.yml +5 -0
  40. data/spec/dummy/config/routes.rb +3 -0
  41. data/spec/dummy/db/migrate/20130430115218_create_users.rb +9 -0
  42. data/spec/dummy/db/schema.rb +22 -0
  43. data/spec/dummy/public/404.html +26 -0
  44. data/spec/dummy/public/422.html +26 -0
  45. data/spec/dummy/public/500.html +25 -0
  46. data/spec/dummy/public/favicon.ico +0 -0
  47. data/spec/dummy/script/rails +6 -0
  48. data/spec/dummy/tmp/pids/server.pid +1 -0
  49. data/spec/lib/letter_bomb/preview_spec.rb +52 -0
  50. data/spec/requests/mailer_preview_listing_spec.rb +9 -0
  51. data/spec/requests/mailer_preview_showing_spec.rb +23 -0
  52. data/spec/spec_helper.rb +16 -0
  53. metadata +189 -0
@@ -0,0 +1,9 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20130430115218) do
15
+
16
+ create_table "users", :force => true do |t|
17
+ t.string "name"
18
+ t.datetime "created_at", :null => false
19
+ t.datetime "updated_at", :null => false
20
+ end
21
+
22
+ end
@@ -0,0 +1,26 @@
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>
@@ -0,0 +1,26 @@
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>
@@ -0,0 +1,25 @@
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
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
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'
@@ -0,0 +1 @@
1
+ 19607
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ describe LetterBomb::Preview do
4
+
5
+ class FooPreview < LetterBomb::Preview
6
+ def good
7
+ User.create!(name: 'bob')
8
+ 'result of good'
9
+ end
10
+
11
+ def bad; end
12
+
13
+ private
14
+
15
+ def ugly; end
16
+ end
17
+
18
+ describe ".previews" do
19
+ it "returns" do
20
+ LetterBomb::Preview.previews.should include FooPreview
21
+ end
22
+ end
23
+
24
+ describe ".mailer_actions" do
25
+ it "returns an alphabetized list of public instance methods" do
26
+ FooPreview.mailer_actions.should == ['bad', 'good']
27
+ end
28
+ end
29
+
30
+ describe ".preview_action" do
31
+ it "wraps a call to the given method in a transaction" do
32
+ expect do
33
+ FooPreview.preview_action(:good)
34
+ end.to_not change { User.count }
35
+ end
36
+
37
+ it "returns the result of the called method" do
38
+ FooPreview.preview_action(:good).should == 'result of good'
39
+ end
40
+ end
41
+
42
+ describe ".has_factory_girl" do
43
+ it "requires FactoryGirl on preview initialization" do
44
+ class FactoryPreview < LetterBomb::Preview; has_factory_girl; end
45
+
46
+ expect do
47
+ FactoryPreview.new
48
+ end.to change { !!defined?(FactoryGirl) }.to(true)
49
+ end
50
+ end
51
+
52
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Listing Previews' do
4
+ it "should list each preview and its actions" do
5
+ get '/'
6
+ expect(response.body).to include 'UserMailer'
7
+ expect(response.body).to include 'welcome'
8
+ end
9
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Showing a Preview' do
4
+ it "renders the 'from' address" do
5
+ get '/UserMailer::Preview/welcome'
6
+ expect(response.body).to include 'bar@example.com'
7
+ end
8
+
9
+ it "renders the 'to' address" do
10
+ get '/UserMailer::Preview/welcome'
11
+ expect(response.body).to include 'foo@example.com'
12
+ end
13
+
14
+ it "renders the subject" do
15
+ get '/UserMailer::Preview/welcome'
16
+ expect(response.body).to include 'welcome to the show!'
17
+ end
18
+
19
+ it "renders the mailer body" do
20
+ get '/UserMailer::Preview/welcome'
21
+ expect(response.body).to include 'a mailer var: john'
22
+ end
23
+ end
@@ -0,0 +1,16 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV['RAILS_ENV'] ||= 'test'
3
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
+ require 'rspec/rails'
5
+ require 'rspec/autorun'
6
+
7
+ ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')
8
+
9
+ Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
10
+
11
+ RSpec.configure do |config|
12
+ config.use_transactional_fixtures = true
13
+
14
+ config.order = 'random'
15
+ end
16
+
metadata ADDED
@@ -0,0 +1,189 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: letter_bomb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alex Smith
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-04-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: factory_girl_rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Preview mailer templates in the browser.
70
+ email:
71
+ - alex@thatalexguy.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - app/controllers/letter_bomb/application_controller.rb
77
+ - app/controllers/letter_bomb/mailers_controller.rb
78
+ - app/views/layouts/letter_bomb/application.html.erb
79
+ - app/views/letter_bomb/mailers/index.html.erb
80
+ - app/views/letter_bomb/mailers/show.html.erb
81
+ - config/routes.rb
82
+ - lib/letter_bomb/engine.rb
83
+ - lib/letter_bomb/preview.rb
84
+ - lib/letter_bomb/version.rb
85
+ - lib/letter_bomb.rb
86
+ - MIT-LICENSE
87
+ - Rakefile
88
+ - README.md
89
+ - spec/dummy/app/assets/javascripts/application.js
90
+ - spec/dummy/app/assets/stylesheets/application.css
91
+ - spec/dummy/app/controllers/application_controller.rb
92
+ - spec/dummy/app/helpers/application_helper.rb
93
+ - spec/dummy/app/mailers/user_mailer.rb
94
+ - spec/dummy/app/models/user.rb
95
+ - spec/dummy/app/views/layouts/application.html.erb
96
+ - spec/dummy/app/views/user_mailer/welcome.html.erb
97
+ - spec/dummy/config/application.rb
98
+ - spec/dummy/config/boot.rb
99
+ - spec/dummy/config/database.yml
100
+ - spec/dummy/config/environment.rb
101
+ - spec/dummy/config/environments/development.rb
102
+ - spec/dummy/config/environments/production.rb
103
+ - spec/dummy/config/environments/test.rb
104
+ - spec/dummy/config/initializers/backtrace_silencers.rb
105
+ - spec/dummy/config/initializers/inflections.rb
106
+ - spec/dummy/config/initializers/mime_types.rb
107
+ - spec/dummy/config/initializers/secret_token.rb
108
+ - spec/dummy/config/initializers/session_store.rb
109
+ - spec/dummy/config/initializers/wrap_parameters.rb
110
+ - spec/dummy/config/locales/en.yml
111
+ - spec/dummy/config/routes.rb
112
+ - spec/dummy/config.ru
113
+ - spec/dummy/db/migrate/20130430115218_create_users.rb
114
+ - spec/dummy/db/schema.rb
115
+ - spec/dummy/public/404.html
116
+ - spec/dummy/public/422.html
117
+ - spec/dummy/public/500.html
118
+ - spec/dummy/public/favicon.ico
119
+ - spec/dummy/Rakefile
120
+ - spec/dummy/README.rdoc
121
+ - spec/dummy/script/rails
122
+ - spec/dummy/tmp/pids/server.pid
123
+ - spec/lib/letter_bomb/preview_spec.rb
124
+ - spec/requests/mailer_preview_listing_spec.rb
125
+ - spec/requests/mailer_preview_showing_spec.rb
126
+ - spec/spec_helper.rb
127
+ homepage: https://github.com/ags/letter_bomb
128
+ licenses:
129
+ - MIT
130
+ metadata: {}
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - '>='
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements: []
146
+ rubyforge_project:
147
+ rubygems_version: 2.0.0
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: Preview mailer templates in the browser.
151
+ test_files:
152
+ - spec/dummy/app/assets/javascripts/application.js
153
+ - spec/dummy/app/assets/stylesheets/application.css
154
+ - spec/dummy/app/controllers/application_controller.rb
155
+ - spec/dummy/app/helpers/application_helper.rb
156
+ - spec/dummy/app/mailers/user_mailer.rb
157
+ - spec/dummy/app/models/user.rb
158
+ - spec/dummy/app/views/layouts/application.html.erb
159
+ - spec/dummy/app/views/user_mailer/welcome.html.erb
160
+ - spec/dummy/config/application.rb
161
+ - spec/dummy/config/boot.rb
162
+ - spec/dummy/config/database.yml
163
+ - spec/dummy/config/environment.rb
164
+ - spec/dummy/config/environments/development.rb
165
+ - spec/dummy/config/environments/production.rb
166
+ - spec/dummy/config/environments/test.rb
167
+ - spec/dummy/config/initializers/backtrace_silencers.rb
168
+ - spec/dummy/config/initializers/inflections.rb
169
+ - spec/dummy/config/initializers/mime_types.rb
170
+ - spec/dummy/config/initializers/secret_token.rb
171
+ - spec/dummy/config/initializers/session_store.rb
172
+ - spec/dummy/config/initializers/wrap_parameters.rb
173
+ - spec/dummy/config/locales/en.yml
174
+ - spec/dummy/config/routes.rb
175
+ - spec/dummy/config.ru
176
+ - spec/dummy/db/migrate/20130430115218_create_users.rb
177
+ - spec/dummy/db/schema.rb
178
+ - spec/dummy/public/404.html
179
+ - spec/dummy/public/422.html
180
+ - spec/dummy/public/500.html
181
+ - spec/dummy/public/favicon.ico
182
+ - spec/dummy/Rakefile
183
+ - spec/dummy/README.rdoc
184
+ - spec/dummy/script/rails
185
+ - spec/dummy/tmp/pids/server.pid
186
+ - spec/lib/letter_bomb/preview_spec.rb
187
+ - spec/requests/mailer_preview_listing_spec.rb
188
+ - spec/requests/mailer_preview_showing_spec.rb
189
+ - spec/spec_helper.rb