Sha256: 463522740e394fecc3eb867ff6731eabb42c7c6f00a00ccd5e90289536d149c9
Contents?: true
Size: 1.34 KB
Versions: 12
Compression:
Stored size: 1.34 KB
Contents
require 'spec_helper' describe Mtdevise::AccountsController do context "creates the account's schema" do routes { Mtdevise::Engine.routes } # let!(:account) { double(Mtdevise::Account) } # before do # Mtdevise::Account.should_receive(:create_with_owner). # and_return(account) # allow(account).to receive(:valid?).and_return(value) # account.stub :valid? => true # controller.stub(:force_authentication!) # end let(:params) do {:account => {name: 'something', firstname: 'something', lastname: 'something', username: 'something', subdomain: 'something', owner_attributes: {email: 'bb@gmail.com', password: 'password', password_confirmation: 'password'}}} end context "the user is already signed in" do before do allow(subject).to receive(:user_signed_in).and_return(true) end it 'adds the admin role for this account' do post :create, params account = Mtdevise::Account.first user = account.owner expect(user.has_role? :admin, account).to be_truthy end end context "the user is not signed in" do before do allow(subject).to receive(:user_signed_in).and_return(false) end it 'adds the admin role for this account' do post :create, params account = Mtdevise::Account.first user = account.owner expect(user.has_role? :admin, account).to be_truthy end end end end
Version data entries
12 entries across 12 versions & 1 rubygems