cadenero 0.0.2.a2 → 0.0.2.a3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,7 +11,7 @@ end
11
11
 
12
12
  def sign_up
13
13
  create_account
14
- post "/v1/accounts", account: @visitor
14
+ post "/v1/accounts", format: :json, account: @visitor
15
15
  find_account_by_name
16
16
  end
17
17
 
@@ -19,11 +19,13 @@ feature 'Accounts' do
19
19
  scenario "creating an account" do
20
20
  sign_up
21
21
  expect(last_response.status).to eq 201
22
- expect(JSON.parse(last_response.body)).to have_content "auth_token"
22
+ expect(JSON.parse(last_response.body)).to have_content "authentication_token"
23
+ expect(JSON.parse(last_response.body)["account"]["authentication_token"]).not_to eq nil
23
24
  end
24
25
 
25
26
  scenario "cannot create an account with an already used subdomain" do
26
- Cadenero::V1::Account.create!(:subdomain => "test", :name => "Testy")
27
+ create_account
28
+ Cadenero::V1::Account.create!(@visitor)
27
29
  sign_up
28
30
  expect(last_response.status).to eq 422
29
31
  errors = { errors: {subdomain:["has already been taken"]} }
@@ -12,7 +12,6 @@ feature Cadenero::V1::Account do
12
12
  }
13
13
  }
14
14
  account = Cadenero::V1::Account.create_with_owner(params)
15
- account.should be_persisted
16
15
  account.users.first.should == account.owner
17
16
  end
18
17
 
@@ -35,24 +35,27 @@ feature 'User sign in' do
35
35
  expect(last_response.status).to eq 201
36
36
  expect(JSON.parse(last_response.body)["user"]["account_ids"]).to eq [account.id]
37
37
  user_email = JSON.parse(last_response.body)["user"]["email"]
38
+ expect(JSON.parse(last_response.body)).to have_content "auth_token"
39
+ access_token = JSON.parse(last_response.body)["user"]["auth_token"]
40
+ expect(JSON.parse(last_response.body)["user"]["auth_token"]).to eq account.authentication_token
38
41
  get root_url
42
+ expect(last_response.status).to eq 200
39
43
  expect(JSON.parse(last_response.body)["message"]).to have_content user_email
40
44
  end
41
- end
42
45
 
43
- within_account_subdomain do
44
46
  scenario "signout as an account owner successfully" do
45
47
  sign_in_user sessions_url, account_user(account.owner)
46
48
  expect(last_response.status).to eq 201
47
49
  expect(JSON.parse(last_response.body)["user"]["account_ids"]).to eq [account.id]
48
50
  user_email = JSON.parse(last_response.body)["user"]["email"]
49
51
  delete sessions_url, id: account.owner.id
50
- expect(last_response.status).to eq 201
52
+ expect(last_response.status).to eq 200
51
53
  expect(JSON.parse(last_response.body)["message"]).to have_content "Successful logout"
52
54
  get cadenero.v1_root_url(:subdomain => account.subdomain)
53
- expect(last_response.body).to eql(errors_redirect_ro_sign_in)
54
55
  expect(last_response.status).to eq 422
56
+ expect(last_response.body).to eql(errors_redirect_ro_sign_in)
55
57
  end
58
+
56
59
  end
57
60
 
58
61
  it "attempts sign in with an invalid password and fails" do
@@ -10,7 +10,7 @@ end
10
10
 
11
11
  def sign_up_user(url)
12
12
  create_account_user
13
- post "#{url}/v1/users", user: @user
13
+ post "#{url}/v1/users", format: :json, user: @user
14
14
  find_account_by_email
15
15
  end
16
16
 
@@ -20,7 +20,7 @@ feature "User signup" do
20
20
  scenario "under an account" do
21
21
  sign_up_user root_url
22
22
  expect(last_response.status).to eq 201
23
- expect(JSON.parse(last_response.body)["user"]["account_ids"]).to eq [account.id]
23
+ expect(JSON.parse(last_response.body)["user"]["membership_ids"]).to eq [account.id]
24
24
  expect(last_request.url).to eq "#{root_url}v1/users"
25
25
  end
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cadenero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.a2
4
+ version: 0.0.2.a3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-28 00:00:00.000000000 Z
12
+ date: 2013-06-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails-api