                         Keyboard.shared().topEdge = screenHeight - 303.0
                         postNotification(Keyboard.Notifications.KeyboardWillShow, Keyboard.shared())
 
-                        expect(controller.scrollView.contentInset.bottom) > 50
+                        expect(subject.scrollView.contentInset.bottom) > 50
                     }
                 }
 

            context("passwordTextField") {

                it("is properly configured") {
                    expect(controller.passwordTextField.keyboardType.rawValue) == UIKeyboardType.Default.rawValue
                    expect(controller.passwordTextField.returnKeyType.rawValue) == UIReturnKeyType.Go.rawValue
                    expect(controller.passwordTextField.secureTextEntry) == true
                }

                it("has controller as delegate") {
                    expect(controller.passwordTextField.delegate) === controller
                }
            }
        }

        describe("-viewDidLoad") {

            beforeEach {
                controller = SignInViewController()
                controller.loadView()
                controller.viewDidLoad()
            }

            it("has a cross dissolve modal transition style") {
                expect(controller.modalTransitionStyle.rawValue) == UIModalTransitionStyle.CrossDissolve.rawValue
            }

            it("has a disabled enter button") {
                expect(controller.enterButton.enabled) == false
            }
        }

        describe("notifications") {

            beforeEach {
                controller = SignInViewController()
                controller.loadView()
                controller.viewDidLoad()
            }

            describe("UIKeyboardWillShowNotification") {


class SignInViewControllerSpec: QuickSpec {
    override func spec() {

        var subject = SignInViewController()
        let screenHeight = subject.view.bounds.size.height
        let screenWidth = subject.view.bounds.size.width

        beforeEach {
            subject = SignInViewController()
            subject.loadView()
            subject.viewDidLoad()
        }

        describe("initialization") {

            describe("nib") {

                it("IBOutlets are  not nil") {
                    expect(subject.scrollView).notTo(beNil())
                    expect(subject.enterButton).notTo(beNil())
                    expect(subject.forgotPasswordButton).notTo(beNil())
                    expect(subject.emailTextField).notTo(beNil())
                    expect(subject.passwordTextField).notTo(beNil())
                    expect(subject.joinButton).notTo(beNil())
                    expect(subject.enterButtonTopContraint).notTo(beNil())
                    expect(subject.errorLabel).notTo(beNil())
                    expect(subject.elloLogo).notTo(beNil())
                    expect(subject.onePasswordButton).notTo(beNil())
                }

                it("IBActions are wired up") {
                    let enterActions = subject.enterButton.actionsForTarget(subject, forControlEvent: UIControlEvents.TouchUpInside)
                    expect(enterActions).to(contain("enterTapped:"))
                    expect(enterActions?.count) == 1

                    let forgotPasswordActions = subject.forgotPasswordButton.actionsForTarget(subject, forControlEvent: UIControlEvents.TouchUpInside)
                    expect(forgotPasswordActions).to(contain("forgotPasswordTapped:"))
                    expect(forgotPasswordActions?.count) == 1

                    let joinActions = subject.joinButton.actionsForTarget(subject, forControlEvent: UIControlEvents.TouchUpInside)
                    expect(joinActions).to(contain("joinTapped:"))
                    expect(joinActions?.count) == 1

                    let onePasswordActions = subject.onePasswordButton.actionsForTarget(subject, forControlEvent: UIControlEvents.TouchUpInside)
                    expect(onePasswordActions).to(contain("findLoginFrom1Password:"))
                    expect(onePasswordActions?.count) == 1
                }
            }

            it("can be instantiated from nib") {
                expect(subject).notTo(beNil())
            }

            it("is a BaseElloViewController") {
                expect(subject).to(beAKindOf(BaseElloViewController.self))
            }

            it("is a SignInViewController") {
                expect(subject).to(beAKindOf(SignInViewController.self))
            }
        }

        describe("text fields") {

            context("emailTextField") {

                it("is properly configured") {
                    expect(subject.emailTextField.keyboardType.rawValue) == UIKeyboardType.EmailAddress.rawValue
                    expect(subject.emailTextField.returnKeyType.rawValue) == UIReturnKeyType.Next.rawValue
                }

                it("has controller as delegate") {
                    expect(subject.emailTextField.delegate) === subject
                }

            }
