Skip to content

Instantly share code, notes, and snippets.

@walidvb
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walidvb/a7d890b492cb800d9370 to your computer and use it in GitHub Desktop.
Save walidvb/a7d890b492cb800d9370 to your computer and use it in GitHub Desktop.
include ActionDispatch::TestProcess
Fabricator(:chapter) do
body "Chapter Body"
tile_title "hello"
tile_description ""
tile_extra_html ""
file {fixture_file_upload(Rails.root + 'spec/fabricators/assets/chapter.rtf')}
end
require 'spec_helper'
describe SendToKindleController do
before do
@user = Fabricate(:user, kindle_wanted: true, kindle_email: "you@kindle.com")
@chapter = Fabricate(:chapter, file: File.new(Rails.root + 'spec/fabricators/assets/chapter.rtf'))
@chapter.file.exists?.should == true
@book = Fabricate(:book, chapters: [@chapter])
sign_in @user
SubscribeMailer.deliveries = []
end
it "doesn't send books to an unsubscribed user" do
get :book, { book: @book.slug }
SubscribeMailer.should have(0).delivery
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment