letter_opener_web 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. data/.gitignore +17 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +12 -0
  4. data/Guardfile +23 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +41 -0
  7. data/Rakefile +39 -0
  8. data/app/assets/javascripts/letter_opener_web/application.js +23 -0
  9. data/app/assets/stylesheets/letter_opener_web/application.css.erb +32 -0
  10. data/app/controllers/letter_opener_web/application_controller.rb +4 -0
  11. data/app/controllers/letter_opener_web/letters_controller.rb +22 -0
  12. data/app/helpers/letter_opener_web/application_helper.rb +4 -0
  13. data/app/models/letter_opener_web/letter.rb +47 -0
  14. data/app/views/layouts/letter_opener_web/application.html.erb +15 -0
  15. data/app/views/letter_opener_web/letters/index.html.erb +43 -0
  16. data/config/routes.rb +5 -0
  17. data/config.ru +9 -0
  18. data/letter_opener_web.gemspec +26 -0
  19. data/lib/letter_opener_web/engine.rb +7 -0
  20. data/lib/letter_opener_web/version.rb +3 -0
  21. data/lib/letter_opener_web.rb +4 -0
  22. data/lib/tasks/letter_opener_web_tasks.rake +4 -0
  23. data/script/rails +8 -0
  24. data/spec/controllers/letter_opener_web/letters_controller_spec.rb +60 -0
  25. data/spec/internal/config/database.yml +3 -0
  26. data/spec/internal/config/routes.rb +5 -0
  27. data/spec/internal/db/schema.rb +3 -0
  28. data/spec/internal/log/.gitignore +1 -0
  29. data/spec/internal/public/favicon.ico +0 -0
  30. data/spec/models/letter_opener_web/letter_spec.rb +61 -0
  31. data/spec/spec_helper.rb +22 -0
  32. data/vendor/assets/images/glyphicons-halflings-white.png +0 -0
  33. data/vendor/assets/images/glyphicons-halflings.png +0 -0
  34. data/vendor/assets/javascripts/bootstrap.min.js +6 -0
  35. data/vendor/assets/javascripts/jquery-1.8.3.min.js +2 -0
  36. data/vendor/assets/stylesheets/bootstrap.min.css +9 -0
  37. metadata +175 -0
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in letter_opener_web.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ gem 'debugger'
9
+
10
+ gem 'rb-inotify', '~> 0.8.8'
11
+ gem 'guard'
12
+ gem 'guard-rspec'
data/Guardfile ADDED
@@ -0,0 +1,23 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec' do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+
9
+ # Rails example
10
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
+ watch('config/routes.rb') { "spec/routing" }
15
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
16
+
17
+ # Capybara features specs
18
+ watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
19
+
20
+ # Turnip features and steps
21
+ watch(%r{^spec/acceptance/(.+)\.feature$})
22
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Fabio Rehm
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # LetterOpenerWeb
2
+
3
+ Gives [letter_opener](https://github.com/ryanb/letter_opener) an interface for
4
+ browsing sent emails.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'letter_opener_web'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install letter_opener_web
19
+
20
+ ## Usage
21
+
22
+ Add to your routest.rb:
23
+
24
+ ```ruby
25
+ if Rails.env.development?
26
+ mount LetterOpenerWeb::Engine, at: "/letter_opener"
27
+ end
28
+ ```
29
+
30
+ ## Credits
31
+
32
+ Part of the code was based on [this pull request](https://github.com/ryanb/letter_opener/pull/12)
33
+ by [@alexrothenberg](https://github.com/alexrothenberg).
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env rake
2
+
3
+ desc 'Print out all defined routes in match order, with names. Target specific controller with CONTROLLER=x.'
4
+ task :routes do
5
+ require 'combustion'
6
+ Bundler.require :default, :development
7
+
8
+ Combustion.initialize! :action_controller, :action_view, :sprockets, :action_mailer
9
+
10
+ all_routes = LetterOpenerWeb::Engine.routes.routes
11
+
12
+ require 'rails/application/route_inspector'
13
+ inspector = Rails::Application::RouteInspector.new
14
+ puts inspector.format(all_routes, ENV['CONTROLLER']).join "\n"
15
+ end
16
+
17
+ begin
18
+ require 'rdoc/task'
19
+ rescue LoadError
20
+ require 'rdoc/rdoc'
21
+ require 'rake/rdoctask'
22
+ RDoc::Task = Rake::RDocTask
23
+ end
24
+
25
+ RDoc::Task.new(:rdoc) do |rdoc|
26
+ rdoc.rdoc_dir = 'rdoc'
27
+ rdoc.title = 'LetterOpenerWeb'
28
+ rdoc.options << '--line-numbers'
29
+ rdoc.rdoc_files.include('README.rdoc')
30
+ rdoc.rdoc_files.include('lib/**/*.rb')
31
+ end
32
+
33
+ require 'bundler/gem_tasks'
34
+
35
+ begin
36
+ require 'rspec/core/rake_task'
37
+ RSpec::Core::RakeTask.new(:spec)
38
+ task :default => :spec
39
+ rescue LoadError; end
@@ -0,0 +1,23 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery-1.8.3.min
14
+ //= require_tree .
15
+
16
+ jQuery(function($) {
17
+ $('.letter-opener tr').click(function() {
18
+ var $this = $(this);
19
+ $('iframe').attr('src', $this.find('a').attr('href'));
20
+ $this.parent().find('.active').removeClass('active');
21
+ $this.addClass('active');
22
+ });
23
+ });
@@ -0,0 +1,32 @@
1
+ /*
2
+ *= require bootstrap.min
3
+ *= require_self
4
+ *= require_tree .
5
+ */
6
+
7
+ .container-fluid {
8
+ padding-top: 20px;
9
+ }
10
+
11
+ iframe {
12
+ width: 100%;
13
+ min-height: 400px;
14
+ border: solid 1px #ccc;
15
+ }
16
+
17
+ .letter-opener .active,
18
+ .letter-opener .active:hover td {
19
+ background: #ccc;
20
+ }
21
+
22
+ .letter-opener tr {
23
+ cursor: pointer;
24
+ }
25
+
26
+ [class^="icon-"], [class*=" icon-"] {
27
+ background-image: url(<%=asset_path "glyphicons-halflings.png"%>);
28
+ }
29
+
30
+ .icon-white {
31
+ background-image: url(<%=asset_path "glyphicons-halflings-white.png"%>);
32
+ }
@@ -0,0 +1,4 @@
1
+ module LetterOpenerWeb
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,22 @@
1
+ require_dependency "letter_opener_web/application_controller"
2
+
3
+ module LetterOpenerWeb
4
+ class LettersController < ApplicationController
5
+ def index
6
+ @letters = Letter.search
7
+ end
8
+
9
+ def show
10
+ letter = Letter.find(params[:id])
11
+ text = letter.send("#{params[:style]}_text").
12
+ gsub(/"plain\.html"/, "\"#{letter_path(id: letter.id, style: 'plain')}\"").
13
+ gsub(/"rich\.html"/, "\"#{letter_path(id: letter.id, style: 'rich')}\"")
14
+ render text: text
15
+ end
16
+
17
+ def clear
18
+ Letter.destroy_all
19
+ redirect_to letters_path
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ module LetterOpenerWeb
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,47 @@
1
+ module LetterOpenerWeb
2
+ class Letter
3
+ cattr_accessor :letters_location do
4
+ Rails.root.join("tmp", "letter_opener")
5
+ end
6
+
7
+ attr_reader :id, :sent_at
8
+
9
+ def self.search
10
+ letters = Dir.glob("#{letters_location}/*").map do |folder|
11
+ new :id => File.basename(folder), :sent_at => File.mtime(folder)
12
+ end
13
+ letters.sort_by(&:sent_at).reverse
14
+ end
15
+
16
+ def self.find(id)
17
+ new id: id
18
+ end
19
+
20
+ def self.destroy_all
21
+ FileUtils.rm_rf(letters_location)
22
+ end
23
+
24
+ def initialize(params)
25
+ @id = params.fetch(:id)
26
+ @sent_at = params[:sent_at]
27
+ end
28
+
29
+ def plain_text
30
+ @plain_text ||= read_file(:plain)
31
+ end
32
+
33
+ def rich_text
34
+ @rich_text ||= read_file(:rich)
35
+ end
36
+
37
+ def to_param
38
+ id
39
+ end
40
+
41
+ private
42
+
43
+ def read_file(style)
44
+ File.read("#{letters_location}/#{id}/#{style}.html")
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>LetterOpenerWeb</title>
5
+ <%= stylesheet_link_tag "letter_opener_web/application", :media => "all" %>
6
+ <%= javascript_include_tag "letter_opener_web/application" %>
7
+ <%= javascript_include_tag 'https://raw.github.com/indirect/jquery-rails/master/vendor/assets/javascripts/jquery_ujs.js' %>
8
+ <%= csrf_meta_tags %>
9
+ </head>
10
+ <body>
11
+
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
@@ -0,0 +1,43 @@
1
+ <div class="container-fluid">
2
+ <div class="row-fluid">
3
+ <div class="span5">
4
+ <h1>
5
+ Letters
6
+ <%= link_to clear_letters_path, method: 'delete', confirm: 'Are you sure?', class: 'btn btn-danger pull-right' do %>
7
+ <i class="icon-trash icon-white"></i>
8
+ Clear
9
+ <% end %>
10
+ </h1>
11
+ <table class="table table-hover letter-opener">
12
+ <thead>
13
+ <tr>
14
+ <th>ID</th>
15
+ <th>Sent at</th>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <% if first_letter = @letters.pop %>
20
+ <tr class="active">
21
+ <td>
22
+ <%= link_to(first_letter.id, letter_path(first_letter, style: 'rich'), target: 'mail') %>
23
+ </td>
24
+ <td><%= first_letter.sent_at %></td>
25
+ </tr>
26
+ <% end %>
27
+ <% @letters.each do |letter| %>
28
+ <tr>
29
+ <td>
30
+ <%= link_to(letter.id, letter_path(letter, style: 'rich'), target: 'mail') %>
31
+ </td>
32
+ <td><%= letter.sent_at %></td>
33
+ </tr>
34
+ <% end %>
35
+ </tbody>
36
+ </table>
37
+ </div>
38
+ <div class="span7">
39
+ <h1>Content</h1>
40
+ <iframe name="mail" id="mail" src="<%= first_letter.present? ? letter_path(first_letter, style: 'rich') : 'about:blank' %>"></iframe>
41
+ </div>
42
+ </div>
43
+ </div>
data/config/routes.rb ADDED
@@ -0,0 +1,5 @@
1
+ LetterOpenerWeb::Engine.routes.draw do
2
+ delete 'clear' => 'letters#clear', as: :clear_letters
3
+ get '/' => 'letters#index', as: :letters
4
+ get ':id(/:style)' => 'letters#show', as: :letter
5
+ end
data/config.ru ADDED
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'combustion'
5
+ Bundler.require :default, :development
6
+
7
+ Combustion.initialize! :action_controller, :action_view, :sprockets, :action_mailer
8
+
9
+ run Combustion::Application
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'letter_opener_web/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "letter_opener_web"
8
+ gem.version = LetterOpenerWeb::VERSION
9
+ gem.authors = ["Fabio Rehm"]
10
+ gem.email = ["fgrehm@gmail.com"]
11
+ gem.description = %q{Gives letter_opener an interface for browsing sent emails}
12
+ gem.summary = gem.description
13
+ gem.homepage = "https://github.com/fgrehm/letter_opener_web"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency 'rails', '~> 3.2'
21
+ gem.add_dependency 'letter_opener', '~> 1.0'
22
+
23
+ gem.add_development_dependency 'rspec-rails'
24
+ gem.add_development_dependency 'shoulda-matchers'
25
+ gem.add_development_dependency 'combustion', '~> 0.3.1'
26
+ end
@@ -0,0 +1,7 @@
1
+ require 'letter_opener'
2
+
3
+ module LetterOpenerWeb
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace LetterOpenerWeb
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module LetterOpenerWeb
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ require "letter_opener_web/engine"
2
+
3
+ module LetterOpenerWeb
4
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :letter_opener_web do
3
+ # # Task goes here
4
+ # end
data/script/rails ADDED
@@ -0,0 +1,8 @@
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
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
+ ENGINE_PATH = File.expand_path('../../lib/letter_opener_web/engine', __FILE__)
6
+
7
+ require 'rails/all'
8
+ require 'rails/engine/commands'
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+
3
+ describe LetterOpenerWeb::LettersController do
4
+ describe 'GET index' do
5
+ before do
6
+ LetterOpenerWeb::Letter.stub(search: :all_letters)
7
+ get :index
8
+ end
9
+ it { should assign_to(:letters).with(:all_letters) }
10
+ end
11
+
12
+ describe 'GET show' do
13
+ let(:id) { 'an-id' }
14
+ let(:rich_text) { "rich text href=\"plain.html\"" }
15
+ let(:plain_text) { "plain text href=\"rich.html\"" }
16
+ let(:letter) { mock(:letter, rich_text: rich_text, plain_text: plain_text, id: id) }
17
+
18
+ before do
19
+ LetterOpenerWeb::Letter.stub(find: letter)
20
+ end
21
+
22
+ context 'rich text version' do
23
+ before { get :show, id: id, style: 'rich' }
24
+
25
+ it "returns letter's rich text contents" do
26
+ response.body.should =~ /^rich text/
27
+ end
28
+
29
+ it 'fixes plain text link' do
30
+ response.body.should_not =~ /href="plain.html"/
31
+ response.body.should =~ /href="#{Regexp.escape letter_path(id: letter.id, style: 'plain')}"/
32
+ end
33
+ end
34
+
35
+ context 'plain text version' do
36
+ before { get :show, id: id, style: 'plain' }
37
+
38
+ it "returns letter's plain text contents" do
39
+ response.body.should =~ /^plain text/
40
+ end
41
+
42
+ it 'fixes rich text link' do
43
+ response.body.should_not =~ /href="rich.html"/
44
+ response.body.should =~ /href="#{Regexp.escape letter_path(id: letter.id, style: 'rich')}"/
45
+ end
46
+ end
47
+ end
48
+
49
+ describe 'DELETE clear' do
50
+ it 'removes all letters' do
51
+ LetterOpenerWeb::Letter.should_receive(:destroy_all)
52
+ delete :clear
53
+ end
54
+
55
+ it 'redirects back to index' do
56
+ delete :clear
57
+ response.should redirect_to(letters_path)
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,3 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: db/combustion_test.sqlite
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+ delete 'clear' => 'letter_opener_web/letters#clear'
3
+ get '/' => 'letter_opener_web/letters#index', as: :letters
4
+ get ':id(/:style)' => 'letter_opener_web/letters#show', as: :letter
5
+ end
@@ -0,0 +1,3 @@
1
+ ActiveRecord::Schema.define do
2
+ #
3
+ end
@@ -0,0 +1 @@
1
+ *.log
File without changes
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe LetterOpenerWeb::Letter do
4
+ let(:location) { File.expand_path('../../../tmp', __FILE__) }
5
+
6
+ before :each do
7
+ described_class.stub(:letters_location).and_return(location)
8
+ described_class.any_instance.stub(:letters_location).and_return(location)
9
+
10
+ ['1111_1111', '2222_2222'].each do |folder|
11
+ FileUtils.mkdir_p("#{location}/#{folder}")
12
+ File.open("#{location}/#{folder}/plain.html", 'w') {|f| f.write("Plain text for #{folder}") }
13
+ File.open("#{location}/#{folder}/rich.html", 'w') {|f| f.write("Rich text for #{folder}") }
14
+ FileUtils.mkdir_p("#{Rails.root.join('tmp', 'letter_opener')}/#{folder}")
15
+ File.open("#{Rails.root.join('tmp', 'letter_opener')}/#{folder}/rich.html", 'w') {|f| f.write("Rich text for #{folder}") }
16
+ end
17
+ end
18
+
19
+ after :each do
20
+ FileUtils.rm_rf(location)
21
+ end
22
+
23
+ it 'loads rich version' do
24
+ described_class.new(id: '1111_1111').rich_text.should == 'Rich text for 1111_1111'
25
+ end
26
+
27
+ it 'loads plain text version' do
28
+ described_class.new(id: '2222_2222').plain_text.should == 'Plain text for 2222_2222'
29
+ end
30
+
31
+ describe '.search' do
32
+ let(:search_results) { described_class.search }
33
+ let(:first_letter) { search_results.first }
34
+ let(:last_letter) { search_results.last }
35
+
36
+ before do
37
+ File.stub(:mtime).with("#{location}/1111_1111").and_return(Date.today - 1.day)
38
+ File.stub(:mtime).with("#{location}/2222_2222").and_return(Date.today)
39
+ end
40
+
41
+ it 'returns a list of ordered letters' do
42
+ first_letter.sent_at.should > last_letter.sent_at
43
+ end
44
+ end
45
+
46
+ describe '.find' do
47
+ let(:id) { 'an-id' }
48
+ let(:letter) { described_class.find(id) }
49
+
50
+ it 'returns a letter with id set' do
51
+ letter.id.should == id
52
+ end
53
+ end
54
+
55
+ describe '.destroy_all' do
56
+ it 'removes all letters' do
57
+ described_class.destroy_all
58
+ Dir["#{location}/**/*"].should be_empty
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,22 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'combustion'
5
+ Bundler.require :default, :test
6
+
7
+ Combustion.initialize! :action_controller, :action_view, :sprockets, :action_mailer
8
+
9
+ require 'rspec/rails'
10
+ require 'shoulda-matchers'
11
+
12
+ RSpec.configure do |config|
13
+ config.treat_symbols_as_metadata_keys_with_true_values = true
14
+ config.filter_run :focus => true
15
+ config.run_all_when_everything_filtered = true
16
+
17
+ # Run specs in random order to surface order dependencies. If you find an
18
+ # order dependency and want to debug it, you can fix the order by providing
19
+ # the seed, which is printed after each run.
20
+ # --seed 1234
21
+ config.order = "random"
22
+ end