refinerycms-members-ci 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/db/migrate/add_need_login_to_pages.rb +9 -0
- data/db/migrate/create_members.rb +26 -0
- data/db/seeds/members.rb +6 -0
- data/features/admin_manage_members.feature +63 -0
- data/features/manage_member.feature +60 -0
- data/features/step_definitions/member_steps.rb +36 -0
- data/features/support/paths.rb +24 -0
- data/readme.md +36 -0
- data/spec/models/member_spec.rb +34 -0
- metadata +12 -3
@@ -0,0 +1,26 @@
|
|
1
|
+
class CreateMembers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table(:members) do |t|
|
4
|
+
|
5
|
+
t.database_authenticatable :null => false
|
6
|
+
t.recoverable
|
7
|
+
t.rememberable
|
8
|
+
t.trackable
|
9
|
+
|
10
|
+
# t.confirmable
|
11
|
+
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
|
12
|
+
# t.token_authenticatable
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index :members, :email, :unique => true
|
18
|
+
add_index :members, :reset_password_token, :unique => true
|
19
|
+
# add_index :members, :confirmation_token, :unique => true
|
20
|
+
# add_index :members, :unlock_token, :unique => true
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.down
|
24
|
+
drop_table :members
|
25
|
+
end
|
26
|
+
end
|
data/db/seeds/members.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
@members
|
2
|
+
Feature: Members
|
3
|
+
In order to have members on my website
|
4
|
+
As an administrator
|
5
|
+
I want to manage members
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I am a logged in refinery user
|
9
|
+
And I have no members
|
10
|
+
|
11
|
+
@members-list @list
|
12
|
+
Scenario: Members List
|
13
|
+
Given I have members titled foo@example.com, bar@example.com
|
14
|
+
When I go to the list of members
|
15
|
+
Then I should see "foo@example.com"
|
16
|
+
And I should see "bar@example.com"
|
17
|
+
|
18
|
+
@members-valid @valid
|
19
|
+
Scenario: Create Valid Member
|
20
|
+
When I go to the list of members
|
21
|
+
And I follow "Add New Member"
|
22
|
+
And I fill in "Email" with "foo@example.com"
|
23
|
+
And I press "Save"
|
24
|
+
Then I should see "'foo@example.com' was successfully added."
|
25
|
+
And I should have 1 member
|
26
|
+
|
27
|
+
@members-invalid @invalid
|
28
|
+
Scenario: Create Invalid Member (without email)
|
29
|
+
When I go to the list of members
|
30
|
+
And I follow "Add New Member"
|
31
|
+
And I press "Save"
|
32
|
+
Then I should see "Email can't be blank"
|
33
|
+
And I should have 0 members
|
34
|
+
|
35
|
+
@members-edit @edit
|
36
|
+
Scenario: Edit Existing Member
|
37
|
+
Given I have members titled "foo"
|
38
|
+
When I go to the list of members
|
39
|
+
And I follow "Edit this member" within ".actions"
|
40
|
+
Then I fill in "Email" with "bar"
|
41
|
+
And I press "Save"
|
42
|
+
Then I should see "'bar' was successfully updated."
|
43
|
+
And I should be on the list of members
|
44
|
+
And I should not see "foo"
|
45
|
+
|
46
|
+
@members-duplicate @duplicate
|
47
|
+
Scenario: Create Duplicate Member
|
48
|
+
Given I only have members titled UniqueTitleOne, UniqueTitleTwo
|
49
|
+
When I go to the list of members
|
50
|
+
And I follow "Add New Member"
|
51
|
+
And I fill in "Email" with "UniqueTitleTwo"
|
52
|
+
And I press "Save"
|
53
|
+
Then I should see "There were problems"
|
54
|
+
And I should have 2 members
|
55
|
+
|
56
|
+
@members-delete @delete
|
57
|
+
Scenario: Delete Member
|
58
|
+
Given I only have members titled UniqueTitleOne
|
59
|
+
When I go to the list of members
|
60
|
+
And I follow "Remove this member forever"
|
61
|
+
Then I should see "'UniqueTitleOne' was successfully removed."
|
62
|
+
And I should have 0 members
|
63
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
@members
|
2
|
+
Feature: Members
|
3
|
+
In order to be a member
|
4
|
+
As an User
|
5
|
+
I want to manage my own member account
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I am a logged in refinery user
|
9
|
+
And I have no members
|
10
|
+
|
11
|
+
@member
|
12
|
+
Scenario: Create Valid Member
|
13
|
+
When I go to the signup page
|
14
|
+
Then I should see "Sign up"
|
15
|
+
And I fill in "Email" with "foo@example.com"
|
16
|
+
And I fill in "Password" with "123456"
|
17
|
+
And I fill in "Password confirmation" with "123456"
|
18
|
+
And I press "Sign up"
|
19
|
+
And I should have 1 member
|
20
|
+
|
21
|
+
@member @member-invalid
|
22
|
+
Scenario: Create Invalid Member (without email)
|
23
|
+
When I go to the signup page
|
24
|
+
And I press "Sign up"
|
25
|
+
Then I should see "Email can't be blank"
|
26
|
+
And I should see "Password can't be blank"
|
27
|
+
And I fill in "Email" with "foo@example.com"
|
28
|
+
And I press "Sign up"
|
29
|
+
Then I should see "Password can't be blank"
|
30
|
+
And I fill in "Email" with "foo@example.com"
|
31
|
+
And I fill in "Password" with "654321"
|
32
|
+
And I fill in "Password confirmation" with "123456"
|
33
|
+
And I press "Sign up"
|
34
|
+
Then I should see "Password doesn't match confirmation"
|
35
|
+
And I should have 0 members
|
36
|
+
|
37
|
+
@member @member-invalid
|
38
|
+
Scenario: Create Duplicate Member
|
39
|
+
Given I have one member "foo@example.com" with password "123456"
|
40
|
+
When I go to the signup page
|
41
|
+
And I fill in "Email" with "foo@example.com"
|
42
|
+
And I fill in "Password" with "123456"
|
43
|
+
And I fill in "Password confirmation" with "123456"
|
44
|
+
And I press "Sign up"
|
45
|
+
Then I should see "Email has already been taken"
|
46
|
+
|
47
|
+
@member @member-profile
|
48
|
+
Scenario: Edit Existing Member
|
49
|
+
Given I am a new, authenticated member "testing@example.com" with password "secretpass"
|
50
|
+
When I go to the profile page
|
51
|
+
Then the "member_email" field should contain "testing@example.com"
|
52
|
+
When I fill in "Email" with "foo@example.com"
|
53
|
+
And I press "Update"
|
54
|
+
Then I should be on the home page
|
55
|
+
Given I am not authenticated
|
56
|
+
When I go to the members login page
|
57
|
+
And I fill in "Email" with "foo@example.com"
|
58
|
+
And I fill in "Password" with "secretpass"
|
59
|
+
And I press "Sign in"
|
60
|
+
Then I should be on the home page
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Given /^I have no members$/ do
|
2
|
+
Member.delete_all
|
3
|
+
end
|
4
|
+
|
5
|
+
Given /^I (only )?have members titled "?([^\"]*)"?$/ do |only, emails|
|
6
|
+
Member.delete_all if only
|
7
|
+
emails.split(', ').each do |email|
|
8
|
+
Member.create!(:email => email, :password => '123456', :password_confirmation => '123456')
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
Then /^I should have ([0-9]+) members?$/ do |count|
|
13
|
+
Member.count.should == count.to_i
|
14
|
+
end
|
15
|
+
|
16
|
+
#Devise
|
17
|
+
|
18
|
+
Given /^I am not authenticated$/ do
|
19
|
+
visit('/members/sign_out') # ensure that at least
|
20
|
+
end
|
21
|
+
|
22
|
+
Given /^I have one\s+member "([^\"]*)" with password "([^\"]*)"$/ do |email, password|
|
23
|
+
Member.new(:email => email,
|
24
|
+
:password => password,
|
25
|
+
:password_confirmation => password).save!
|
26
|
+
end
|
27
|
+
|
28
|
+
Given /^I am a new, authenticated member "([^\"]*)" with password "([^\"]*)"$/ do |email, password|
|
29
|
+
|
30
|
+
Given %{I have one member "#{email}" with password "#{password}"}
|
31
|
+
And %{I go to the members login page}
|
32
|
+
And %{I fill in "member_email" with "#{email}"}
|
33
|
+
And %{I fill in "member_password" with "#{password}"}
|
34
|
+
And %{I press "Sign in"}
|
35
|
+
end
|
36
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module NavigationHelpers
|
2
|
+
module Refinery
|
3
|
+
module Members
|
4
|
+
def path_to(page_name)
|
5
|
+
case page_name
|
6
|
+
when /the home page/
|
7
|
+
root_path
|
8
|
+
when /the list of members/
|
9
|
+
admin_members_path
|
10
|
+
when /the new member form/
|
11
|
+
new_admin_member_path
|
12
|
+
when /the signup page/
|
13
|
+
new_member_registration_path
|
14
|
+
when /the members login page/
|
15
|
+
new_member_session_path
|
16
|
+
when /the profile page/
|
17
|
+
edit_member_registration_path
|
18
|
+
else
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/readme.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Refinery CMS Member
|
2
|
+
|
3
|
+
Simple member engine for [Refinery CMS](http://refinerycms.com). It supports members management and page privilege setting.
|
4
|
+
|
5
|
+
This version of `refinerycms-member` supports Rails 3.0.x, development for RefineryCMS 0.9.9 and upper.
|
6
|
+
|
7
|
+
## Requirements
|
8
|
+
|
9
|
+
Refinery CMS version 0.9.9 or above.
|
10
|
+
|
11
|
+
## Install
|
12
|
+
|
13
|
+
Download the source code and place under folder "RAILS_ROOT/vendor/engines"
|
14
|
+
|
15
|
+
Open up your ``Gemfile`` and add at the bottom this line:
|
16
|
+
|
17
|
+
gem 'refinerycms-members', '1.0', :path => 'vendor/engines'
|
18
|
+
|
19
|
+
Now, run ``bundle install``
|
20
|
+
|
21
|
+
Next, to install the member plugin run:
|
22
|
+
|
23
|
+
rails generate refinerycms_members
|
24
|
+
|
25
|
+
Finally migrate your database and you're done.
|
26
|
+
|
27
|
+
rake db:migrate
|
28
|
+
|
29
|
+
## How to build this engine as a gem
|
30
|
+
|
31
|
+
cd vendor/engines/members
|
32
|
+
gem build refinerycms-members.gempspec
|
33
|
+
gem install refinerycms-members.gem
|
34
|
+
|
35
|
+
# Sign up for a http://rubygems.org/ account and publish the gem
|
36
|
+
gem push refinerycms-members.gem
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Member do
|
4
|
+
|
5
|
+
def reset_member(options = {})
|
6
|
+
@valid_attributes = {
|
7
|
+
:id => 1,
|
8
|
+
:email => 'foo@example.com',
|
9
|
+
:password => '123456',
|
10
|
+
:password_confirmation => '123456'
|
11
|
+
}
|
12
|
+
|
13
|
+
@member.destroy! if @member
|
14
|
+
@member = Member.create!(@valid_attributes.update(options))
|
15
|
+
end
|
16
|
+
|
17
|
+
before(:each) do
|
18
|
+
reset_member
|
19
|
+
end
|
20
|
+
|
21
|
+
context "validations" do
|
22
|
+
|
23
|
+
it "rejects empty email" do
|
24
|
+
Member.new(@valid_attributes.merge(:email => "")).should_not be_valid
|
25
|
+
end
|
26
|
+
|
27
|
+
it "rejects non unique email" do
|
28
|
+
# as one gets created before each spec by reset_member
|
29
|
+
Member.new(@valid_attributes).should_not be_valid
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-members-ci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Based on work of n5ken, modified by ovargas27
|
@@ -64,6 +64,15 @@ files:
|
|
64
64
|
- app/views/registrations/edit.html.erb
|
65
65
|
- app/views/registrations/new.html.erb
|
66
66
|
- app/views/shared/_header.html.erb
|
67
|
+
- db/migrate/add_need_login_to_pages.rb
|
68
|
+
- db/migrate/create_members.rb
|
69
|
+
- db/seeds/members.rb
|
70
|
+
- features/admin_manage_members.feature
|
71
|
+
- features/manage_member.feature
|
72
|
+
- features/step_definitions/member_steps.rb
|
73
|
+
- features/support/paths.rb
|
74
|
+
- spec/models/member_spec.rb
|
75
|
+
- readme.md
|
67
76
|
has_rdoc: true
|
68
77
|
homepage: https://github.com/crowdint/refinerycms-member
|
69
78
|
licenses: []
|