added tests

This commit is contained in:
Hauke Klement
2015-02-23 11:25:15 +01:00
parent 466f8967e2
commit 6d592472e7
2 changed files with 34 additions and 0 deletions

View File

@ -36,6 +36,33 @@ describe ApplicationController do
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
before(:each) { get :welcome }

View File

@ -3,9 +3,16 @@ require 'rails_helper'
describe DockerContainerMixin do
[:binds, :port_bindings].each do |method|
describe "##{method}" do
let(:data) { [] }
it 'is defined for Docker::Container' do
expect(Docker::Container.instance_methods).to include(method)
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