spec/controllers/cadenero/v1/accounts_controller_spec.rb in cadenero-0.0.2.b4 vs spec/controllers/cadenero/v1/accounts_controller_spec.rb in cadenero-0.0.2.b5
- old
+ new
@@ -1,27 +1,25 @@
require 'spec_helper'
module Cadenero
describe V1::AccountsController do
let!(:account) { stub_model(Cadenero::V1::Account, id: 1001, authentication_token: "dsdaefer412add") }
-
+
before do
Cadenero::V1::Account.should_receive(:create_with_owner).and_return(account)
controller.stub(:force_authentication!)
end
context "creates the account's schema" do
before do
account.stub :valid? => true
- end
+ end
it "should create a schema and ensure a token is returned for the account on successful creation" do
- account.should_receive(:create_schema)
- account.should_receive(:ensure_authentication_token!)
post :create, format: :json, account: { name: "First Account", subdomain: "first" }, use_route: :cadenero
expect(response.status).to eq(201)
expect(assigns(:account)).to eq(account)
expect(assigns(:account)[:authentication_token]).to eq(account.authentication_token)
- end
+ end
end
context "when the message fails to save" do
before do
account.stub(:save).and_return(false)