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.
- data/README.md +56 -24
- data/app/controllers/cadenero/v1/account/dashboard_controller.rb +5 -2
- data/app/controllers/cadenero/v1/account/sessions_controller.rb +10 -11
- data/app/controllers/cadenero/v1/account/users_controller.rb +1 -1
- data/app/controllers/cadenero/v1/accounts_controller.rb +6 -7
- data/app/models/cadenero/user.rb +8 -2
- data/app/models/cadenero/v1/account.rb +27 -14
- data/app/serializers/cadenero/account_serializer.rb +3 -4
- data/app/serializers/cadenero/user_serializer.rb +3 -3
- data/lib/cadenero/version.rb +1 -1
- data/spec/controllers/cadenero/v1/accounts_controller_spec.rb +27 -11
- data/spec/dummy/log/development.log +109 -574
- data/spec/dummy/log/test.log +5885 -449
- data/spec/features/accounts/sign_up_spec.rb +5 -3
- data/spec/features/cadenero/account_spec.rb +0 -1
- data/spec/features/users/sign_in_spec.rb +7 -4
- data/spec/features/users/sign_up_spec.rb +2 -2
- metadata +2 -2
@@ -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 "
|
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
|
-
|
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"]} }
|
@@ -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
|
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"]["
|
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.
|
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-
|
12
|
+
date: 2013-06-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails-api
|