prologue 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Prologue
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,78 @@
1
+ inject_into_file 'features/support/paths.rb', :after => "case page_name\n" do
2
+ <<-'FILE'
3
+
4
+ when /the admin/
5
+ '/admin'
6
+
7
+ when /the add user page/
8
+ '/admin/users/new'
9
+ FILE
10
+ end
11
+
12
+ create_file 'features/admin.feature' do
13
+ <<-'FILE'
14
+ Feature: Admin dashboard
15
+ As an administrator
16
+ I want to manage the application
17
+ So that I can have full control over the site
18
+
19
+ Scenario: Login as an admin
20
+ Given a logged in admin user
21
+ When I am on the admin
22
+ Then I should see "Admin"
23
+ FILE
24
+ end
25
+
26
+ create_file 'features/user_admin.feature' do
27
+ <<-'FILE'
28
+ Feature: Administer users
29
+ As an administrator
30
+ I want to manage the users
31
+ So that I can provide support for them
32
+
33
+ Background:
34
+ Given the following role records
35
+ | name |
36
+ | Member |
37
+
38
+ @javascript
39
+ Scenario: Create, update, delete a user in the admin
40
+ Given a logged in admin user
41
+ When I am on the add user page
42
+ And I fill in "Name" with "Big Boi"
43
+ And I fill in "Email" with "big@sirluciousleftfoot.com"
44
+ And I fill in "Password" with "Ch!coDusty$"
45
+ And I fill in "Password confirmation" with "Ch!coDusty$"
46
+ And I check "Member"
47
+ And I press "Save"
48
+ Then I should see "User created!"
49
+ And I should see "Big Boi"
50
+
51
+ When I follow "Big Boi"
52
+ Then the "Name" field should contain "Big Boi"
53
+ And the "Email" field should contain "big@sirluciousleftfoot.com"
54
+ And the "Member" checkbox should be checked
55
+ And the "Admin" checkbox should not be checked
56
+
57
+ Then I fill in "Name" with "Bigger Boi"
58
+ And I fill in "Email" with "bigger@sirluciousleftfoot.com"
59
+ And I uncheck "Member"
60
+ And I check "Admin"
61
+ And I press "Save"
62
+ Then I should see "Successfully updated Bigger Boi."
63
+
64
+ When I follow "Bigger Boi"
65
+ Then the "Name" field should contain "Bigger Boi"
66
+ And the "Email" field should contain "bigger@sirluciousleftfoot.com"
67
+ And the "Member" checkbox should not be checked
68
+ And the "Admin" checkbox should be checked
69
+ Then I press "Save"
70
+
71
+ When I confirm a js popup on the next step
72
+ Then I follow "Delete"
73
+ Then I should see "User deleted."
74
+ And I should not see "Bigger Boi"
75
+
76
+
77
+ FILE
78
+ end
@@ -36,7 +36,7 @@ end
36
36
 
37
37
  create_file 'app/views/admin/shared/_end_scripts.html.haml' do
38
38
  <<-FILE
39
- = javascript_include_tag :defaults
39
+ = include_javascripts :common
40
40
  FILE
41
41
  end
42
42
 
@@ -111,13 +111,11 @@ create_file 'app/views/admin/users/index.html.haml' do
111
111
  %th Name
112
112
  %th Email
113
113
  %th
114
- %th
115
114
  %tbody
116
- - for user in @users
115
+ - @users.each do |user|
117
116
  %tr
118
- %td= user.name
117
+ %td= link_to user.name, edit_admin_user_path(user), :class => 'edit_link'
119
118
  %td= user.email
120
- %td= link_to "Edit", edit_admin_user_path(user), :class => 'edit_link'
121
119
  %td
122
120
  - if user.id != current_user.id
123
121
  = link_to "Delete", admin_user_path(user), :confirm => 'Are you sure?', :method => :delete, :class => 'delete_link'
data/templates/admin.rb CHANGED
@@ -25,4 +25,5 @@ gsub_file 'app/controllers/admin/dashboard_controller.rb', /ApplicationControlle
25
25
  # make a user admin
26
26
  apply File.expand_path("../admin/users.rb", __FILE__)
27
27
  apply File.expand_path("../admin/dashboard_spec.rb", __FILE__)
28
- apply File.expand_path("../admin/users_spec.rb", __FILE__)
28
+ apply File.expand_path("../admin/users_spec.rb", __FILE__)
29
+ apply File.expand_path("../admin/cucumber.rb", __FILE__)
@@ -28,7 +28,7 @@ end
28
28
 
29
29
  create_file 'app/views/shared/_end_scripts.html.haml' do
30
30
  <<-FILE
31
- = javascript_include_tag :defaults
31
+ = include_javascripts :common
32
32
  FILE
33
33
  end
34
34
 
data/templates/cancan.rb CHANGED
@@ -76,12 +76,12 @@ end
76
76
 
77
77
  if ENV['PROLOGUE_ADMIN']
78
78
  inject_into_file 'app/views/admin/users/_form.html.haml', :after => "= f.password_field :password_confirmation\n" do
79
- <<-RUBY
80
- .form_row
81
- - for role in Role.find(:all, :order => "name")
82
- .check_box_item
83
- = check_box_tag "user[role_ids][]", role.id, @user.roles.include?(role)
84
- = role.name.humanize
79
+ <<-'RUBY'
80
+ .form_row
81
+ - Role.find(:all, :order => "name").each do |role|
82
+ .check_box_item
83
+ = check_box_tag "user[role_ids][]", role.id, @user.roles.include?(role), :id => "user_role_#{role.id}"
84
+ %label{:for => "user_role_#{role.id}"}= role.name.humanize
85
85
  RUBY
86
86
  end
87
87
 
@@ -1,16 +1,3 @@
1
- create_file 'features/authentication.feature' do
2
- <<-'FILE'
3
- Feature: User admin authentication
4
- As an administrator
5
- I want to manage the application
6
- So that I can have full control over the site
7
-
8
- Scenario: Login as an admin
9
- Given a logged in admin user
10
- When I am on the admin
11
- Then I should see "Admin"
12
- FILE
13
- end
14
1
 
15
2
  create_file 'spec/factories/user.rb' do
16
3
  <<-'FILE'
@@ -26,13 +13,13 @@ end
26
13
  Factory.define :admin, :parent => :user do |admin|
27
14
  admin.email "quickleft@quickleft.com"
28
15
  admin.password "password"
29
- admin.roles { [ Factory(:role, :name => 'admin') ] }
16
+ admin.roles { [ Factory(:role, :name => 'Admin') ] }
30
17
  end
31
18
 
32
19
  Factory.define :member, :parent => :user do |member|
33
20
  member.email "member@quickleft.com"
34
21
  member.password "password"
35
- member.roles { [ Factory(:role, :name => 'member') ] }
22
+ member.roles { [ Factory(:role, :name => 'Member') ] }
36
23
  end
37
24
 
38
25
  Factory.define :role do |role|
@@ -79,9 +66,6 @@ end
79
66
  inject_into_file 'features/support/paths.rb', :after => "case page_name\n" do
80
67
  <<-'FILE'
81
68
 
82
- when /the admin/
83
- '/admin'
84
-
85
69
  when /logout/
86
70
  '/users/sign_out'
87
71
 
data/templates/jammit.rb CHANGED
@@ -4,7 +4,8 @@ embed_assets: on
4
4
 
5
5
  javascripts:
6
6
  common:
7
- - public/javascriptsjquery.js
7
+ - public/javascripts/jquery.js
8
+ - public/javascripts/rails.js
8
9
 
9
10
  stylesheets:
10
11
  common:
@@ -8,4 +8,23 @@ inject_into_file 'config/application.rb', :after => "# Configure the default enc
8
8
  RUBY
9
9
  end
10
10
 
11
- run 'mkdir spec/factories'
11
+ run 'mkdir spec/factories'
12
+
13
+ create_file 'features/step_definitions/helper_steps.rb' do
14
+ <<-'FILE'
15
+ When /^I confirm a js popup on the next step$/ do
16
+ page.evaluate_script("window.alert = function(msg) { return true; }")
17
+ page.evaluate_script("window.confirm = function(msg) { return true; }")
18
+ end
19
+ FILE
20
+ end
21
+
22
+ create_file 'features/step_definitions/factory_steps.rb' do
23
+ <<-'FILE'
24
+ Given /^the following (.+) records?$/ do |factory, table|
25
+ table.hashes.each do |hash|
26
+ Factory(factory, hash)
27
+ end
28
+ end
29
+ FILE
30
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
7
  - 2
9
- version: 0.1.2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Quick Left
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-20 00:00:00 -06:00
17
+ date: 2010-10-22 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -127,6 +127,7 @@ files:
127
127
  - lib/prologue/version.rb
128
128
  - prologue.gemspec
129
129
  - templates/admin.rb
130
+ - templates/admin/cucumber.rb
130
131
  - templates/admin/dashboard_spec.rb
131
132
  - templates/admin/layout.rb
132
133
  - templates/admin/sass.rb
@@ -185,6 +186,6 @@ rubyforge_project: prologue
185
186
  rubygems_version: 1.3.7
186
187
  signing_key:
187
188
  specification_version: 3
188
- summary: prologue-0.1.2
189
+ summary: prologue-0.2.0
189
190
  test_files: []
190
191