Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from dziemian007/proc_bind_fix
Fix Proc#bind being depreciated in activesupport 4.2
- Loading branch information
Showing
2 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# encoding: UTF-8 | ||
require 'spec_helper' | ||
|
||
RSpec.describe Translator::TranslationsController do | ||
|
||
before :all do | ||
conn = Mongo::Connection.new.db("translator_test").collection("translations") | ||
Translator.current_store = Translator::MongoStore.new(conn) | ||
I18n.backend = Translator.setup_backend(I18n::Backend::Simple.new) | ||
end | ||
|
||
after :all do | ||
Translator.auth_handler = nil | ||
end | ||
|
||
describe "GET index" do | ||
context "auth_handler" do | ||
it "responds OK with no auth proc" do | ||
get :index, use_route: '/' | ||
expect(response.status).to eq(200) | ||
end | ||
|
||
it "responds 401 with auth proc defined" do | ||
Translator.auth_handler = proc { | ||
head 401 | ||
} | ||
get :index, use_route: '/' | ||
expect(response.status).to eq(401) | ||
end | ||
end | ||
end | ||
end |