added tests
This commit is contained in:
@ -36,6 +36,33 @@ describe ApplicationController do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#set_locale' do
|
||||||
|
let(:locale) { :de }
|
||||||
|
|
||||||
|
context 'when specifying a locale' do
|
||||||
|
it 'overwrites the session' do
|
||||||
|
expect(session).to receive(:[]=).with(:locale, locale.to_s)
|
||||||
|
get :welcome, locale: locale
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with a 'locale' value in the session" do
|
||||||
|
it 'sets this locale' do
|
||||||
|
session[:locale] = locale
|
||||||
|
expect(I18n).to receive(:locale=).with(locale)
|
||||||
|
get :welcome
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "without a 'locale' value in the session" do
|
||||||
|
it 'sets the default locale' do
|
||||||
|
expect(session[:locale]).to be_blank
|
||||||
|
expect(I18n).to receive(:locale=).with(I18n.default_locale)
|
||||||
|
get :welcome
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'GET #welcome' do
|
describe 'GET #welcome' do
|
||||||
before(:each) { get :welcome }
|
before(:each) { get :welcome }
|
||||||
|
|
||||||
|
@ -3,9 +3,16 @@ require 'rails_helper'
|
|||||||
describe DockerContainerMixin do
|
describe DockerContainerMixin do
|
||||||
[:binds, :port_bindings].each do |method|
|
[:binds, :port_bindings].each do |method|
|
||||||
describe "##{method}" do
|
describe "##{method}" do
|
||||||
|
let(:data) { [] }
|
||||||
|
|
||||||
it 'is defined for Docker::Container' do
|
it 'is defined for Docker::Container' do
|
||||||
expect(Docker::Container.instance_methods).to include(method)
|
expect(Docker::Container.instance_methods).to include(method)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'returns the correct information' do
|
||||||
|
expect(CONTAINER).to receive(:json).and_return('HostConfig' => {method.to_s.camelize => data})
|
||||||
|
expect(CONTAINER.send(method)).to eq(data)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user