Sha256: 706a6a05aea3f6d8ca71177a9558731bd4733a71377204df04ae683521168dae

Contents?: true

Size: 783 Bytes

Versions: 3

Compression:

Stored size: 783 Bytes

Contents

require 'spec_helper'

def create_account_user
  @user ||= { email: "user@example.com", password: "password", password_confirmation: "password" }
end

def find_account_by_email
  @account = Cadenero::V1::Account.where(name: @user[:email]).first
end

def sign_up_user(url)
  create_account_user
  post "#{url}/v1/users", format: :json, user: @user
  find_account_by_email
end

feature "User signup" do
  let!(:account) { FactoryGirl.create(:account_with_schema) }
  let(:root_url) { "http://#{account.subdomain}.example.com/" }
  scenario "under an account" do
    sign_up_user root_url
    expect(last_response.status).to eq 201
    expect(JSON.parse(last_response.body)["user"]["membership_ids"]).to eq [account.id]
    expect(last_request.url).to eq "#{root_url}v1/users"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cadenero-0.0.2.b2 spec/features/users/sign_up_spec.rb
cadenero-0.0.2.b1 spec/features/users/sign_up_spec.rb
cadenero-0.0.2.a3 spec/features/users/sign_up_spec.rb