bear 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bear/version.rb +1 -1
- data/templates/admin/cucumber.rb +3 -36
- data/templates/admin/users.rb +1 -1
- data/templates/application_layout.rb +4 -4
- data/templates/bootstrap.rb +3 -0
- data/templates/devise.rb +1 -1
- data/templates/devise/cucumber.rb +11 -10
- data/templates/gemfile.rb +2 -0
- data/templates/haml_generator.rb +1 -1
- data/templates/js.rb +0 -54
- data/templates/sass.rb +9 -4
- data/templates/test_suite.rb +23 -6
- metadata +3 -3
data/lib/bear/version.rb
CHANGED
data/templates/admin/cucumber.rb
CHANGED
@@ -9,20 +9,6 @@ inject_into_file 'features/support/paths.rb', :after => "case page_name\n" do
|
|
9
9
|
FILE
|
10
10
|
end
|
11
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
12
|
create_file 'features/user_admin.feature' do
|
27
13
|
<<-'FILE'
|
28
14
|
Feature: Administer users
|
@@ -30,11 +16,6 @@ Feature: Administer users
|
|
30
16
|
I want to manage the users
|
31
17
|
So that I can provide support for them
|
32
18
|
|
33
|
-
Background:
|
34
|
-
Given the following role records
|
35
|
-
| name |
|
36
|
-
| Member |
|
37
|
-
|
38
19
|
Scenario: Create, update, delete a user in the admin
|
39
20
|
Given a logged in admin user
|
40
21
|
When I am on the add user page
|
@@ -42,35 +23,21 @@ Feature: Administer users
|
|
42
23
|
And I fill in "Email" with "big@sirluciousleftfoot.com"
|
43
24
|
And I fill in "Password" with "Ch!coDusty$"
|
44
25
|
And I fill in "Password confirmation" with "Ch!coDusty$"
|
45
|
-
And I
|
46
|
-
And I press "Save"
|
26
|
+
And I press "Create User"
|
47
27
|
Then I should see "User created!"
|
48
28
|
And I should see "Big Boi"
|
49
29
|
|
50
30
|
When I follow "Big Boi"
|
51
31
|
Then the "Name" field should contain "Big Boi"
|
52
32
|
And the "Email" field should contain "big@sirluciousleftfoot.com"
|
53
|
-
And the "Member" checkbox should be checked
|
54
|
-
And the "Admin" checkbox should not be checked
|
55
33
|
|
56
34
|
Then I fill in "Name" with "Bigger Boi"
|
57
35
|
And I fill in "Email" with "bigger@sirluciousleftfoot.com"
|
58
|
-
And I
|
59
|
-
And I check "Admin"
|
60
|
-
And I press "Save"
|
36
|
+
And I press "Update User"
|
61
37
|
Then I should see "Successfully updated Bigger Boi."
|
62
38
|
|
63
|
-
When I follow "Bigger Boi"
|
64
|
-
Then the "Name" field should contain "Bigger Boi"
|
65
|
-
And the "Email" field should contain "bigger@sirluciousleftfoot.com"
|
66
|
-
And the "Member" checkbox should not be checked
|
67
|
-
And the "Admin" checkbox should be checked
|
68
|
-
Then I press "Save"
|
69
|
-
|
70
39
|
Then I follow "Delete"
|
71
40
|
Then I should see "User deleted."
|
72
41
|
And I should not see "Bigger Boi"
|
73
|
-
|
74
|
-
|
75
42
|
FILE
|
76
|
-
end
|
43
|
+
end
|
data/templates/admin/users.rb
CHANGED
data/templates/bootstrap.rb
CHANGED
data/templates/devise.rb
CHANGED
@@ -71,7 +71,7 @@ end
|
|
71
71
|
generate(:migration, "AddNameToUsers name:string")
|
72
72
|
generate(:migration, "AddDeletedAtToUsers deleted_at:datetime")
|
73
73
|
|
74
|
-
inject_into_file 'app/views/layouts/application.html.haml', :after => "%li= link_to(\"Home\", root_path)" do
|
74
|
+
inject_into_file 'app/views/layouts/application.html.haml', :after => "%li= link_to(\"Home\", root_path)\n" do
|
75
75
|
<<-'FILE'
|
76
76
|
- if user_signed_in?
|
77
77
|
%li
|
@@ -1,5 +1,6 @@
|
|
1
|
+
run 'rm spec/fabricators/users_fabricator.rb'
|
1
2
|
|
2
|
-
create_file 'spec/fabricators/
|
3
|
+
create_file 'spec/fabricators/users_fabricator.rb' do
|
3
4
|
<<-'FILE'
|
4
5
|
Fabricator(:user) do
|
5
6
|
name { Fabricate.sequence(:name) { |i| "Bear #{i}" } }
|
@@ -16,7 +17,7 @@ Fabricator(:admin, :from => :user) do
|
|
16
17
|
end
|
17
18
|
|
18
19
|
Fabricator(:member, :from => :user) do
|
19
|
-
email "member@
|
20
|
+
email "member@yoursite.com"
|
20
21
|
password "password"
|
21
22
|
end
|
22
23
|
FILE
|
@@ -34,7 +35,7 @@ end
|
|
34
35
|
Given /^a logged in admin user$/ do
|
35
36
|
Fabricate(:admin)
|
36
37
|
visit(new_user_session_path)
|
37
|
-
fill_in("user[email]", :with => "
|
38
|
+
fill_in("user[email]", :with => "admin@yoursite.com")
|
38
39
|
fill_in("user[password]", :with => "password")
|
39
40
|
click_button("Sign in")
|
40
41
|
end
|
@@ -42,7 +43,7 @@ end
|
|
42
43
|
Given /^a logged in member user$/ do
|
43
44
|
Fabricate(:member)
|
44
45
|
visit(new_user_session_path)
|
45
|
-
fill_in("user[email]", :with => "member@
|
46
|
+
fill_in("user[email]", :with => "member@yoursite.com")
|
46
47
|
fill_in("user[password]", :with => "password")
|
47
48
|
click_button("Sign in")
|
48
49
|
end
|
@@ -78,13 +79,13 @@ Feature: Forgot password
|
|
78
79
|
Scenario: Follow forget your password link
|
79
80
|
Given the following user records
|
80
81
|
| email |
|
81
|
-
| forgot@
|
82
|
+
| forgot@yoursite.com |
|
82
83
|
When I am on the login page
|
83
84
|
And I follow "Forgot your password?"
|
84
|
-
And I fill in "Email" with "forgot@
|
85
|
+
And I fill in "Email" with "forgot@yoursite.com"
|
85
86
|
And I press "Send me reset password instructions"
|
86
87
|
Then I should see "You will receive an email with instructions about how to reset your password in a few minutes."
|
87
|
-
And 1 emails should be delivered to forgot@
|
88
|
+
And 1 emails should be delivered to forgot@yoursite.com
|
88
89
|
When I click the first link in the email
|
89
90
|
And I fill in "Password" with "myNewP@ssword"
|
90
91
|
And I fill in "Password confirmation" with "myNewP@ssword"
|
@@ -103,13 +104,13 @@ Feature: Resend Verification
|
|
103
104
|
Scenario: Follow resend verification email
|
104
105
|
Given the following user records
|
105
106
|
| email | confirmed_at |
|
106
|
-
| resend@
|
107
|
+
| resend@yoursite.com | nil |
|
107
108
|
When I am on the login page
|
108
109
|
And I follow "Didn't receive confirmation instructions?"
|
109
|
-
And I fill in "Email" with "resend@
|
110
|
+
And I fill in "Email" with "resend@yoursite.com"
|
110
111
|
And I press "Resend confirmation instructions"
|
111
112
|
Then I should see "You will receive an email with instructions about how to confirm your account in a few minutes."
|
112
|
-
And 2 emails should be delivered to resend@
|
113
|
+
And 2 emails should be delivered to resend@yoursite.com
|
113
114
|
When I click the first link in the email
|
114
115
|
Then I should see "Your account was successfully confirmed. You are now signed in."
|
115
116
|
FILE
|
data/templates/gemfile.rb
CHANGED
@@ -7,7 +7,9 @@ gem "autotest", :group => [ :test ]
|
|
7
7
|
gem "autotest-rails", :group => [ :test ]
|
8
8
|
gem "bistro_car"
|
9
9
|
gem "capybara", "0.4.0", :group => [ :cucumber ]
|
10
|
+
gem "carrierwave", "0.5.0"
|
10
11
|
gem "cover_me", ">= 1.0.0.pre2", :require => false, :group => [ :development, :test, :cucumber ]
|
12
|
+
gem "css_sprite", "1.4.10"
|
11
13
|
gem "cucumber", :group => [ :cucumber ]
|
12
14
|
gem "cucumber-rails", :group => [ :cucumber ]
|
13
15
|
gem "database_cleaner", :group => [ :test, :cucumber ]
|
data/templates/haml_generator.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
inject_into_file "config/application.rb", :after => "
|
1
|
+
inject_into_file "config/application.rb", :after => "class Application < Rails::Application\n" do
|
2
2
|
<<-RUBY
|
3
3
|
config.generators do |g|
|
4
4
|
g.template_engine :haml
|
data/templates/js.rb
CHANGED
@@ -2,57 +2,3 @@ get "http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js", "public/
|
|
2
2
|
get_remote_https_file "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
|
3
3
|
get "http://html5shiv.googlecode.com/svn/trunk/html5.js", "public/javascripts/shiv.js"
|
4
4
|
run "rm public/javascripts/application.js"
|
5
|
-
|
6
|
-
create_file "public/javascripts/core.js" do
|
7
|
-
<<-FILE
|
8
|
-
(function($){
|
9
|
-
var QL = QL || {};
|
10
|
-
|
11
|
-
QL = {
|
12
|
-
init: function QL_init(){
|
13
|
-
// some code that needs to be executed after doc ready
|
14
|
-
QL.bindEvents();
|
15
|
-
},
|
16
|
-
bindEvents: function QL_liveEvents(){
|
17
|
-
$('a[rel*=external]').live('click',function(){
|
18
|
-
window.open(this.href);
|
19
|
-
return false;
|
20
|
-
});
|
21
|
-
|
22
|
-
// more globally bound events
|
23
|
-
},
|
24
|
-
helpers: function QL_helpers(){
|
25
|
-
// helper for searching through arrays
|
26
|
-
QL.helpers.arraySearch = function(a){
|
27
|
-
var o = {};
|
28
|
-
for(var i=0;i<a.length;i++){
|
29
|
-
o[a[i]]='';
|
30
|
-
}
|
31
|
-
return o;
|
32
|
-
};
|
33
|
-
//j. resigs array remove overload
|
34
|
-
Array.prototype.remove = function(from, to) {
|
35
|
-
var rest = this.slice((to || from) + 1 || this.length);
|
36
|
-
this.length = from < 0 ? this.length + from : from;
|
37
|
-
return this.push.apply(this, rest);
|
38
|
-
};
|
39
|
-
// duck punch Array.indexOf into IE browsers
|
40
|
-
if(!Array.indexOf){
|
41
|
-
Array.prototype.indexOf = function(obj){
|
42
|
-
for(var i=0; i<this.length; i++){
|
43
|
-
if(this[i]==obj){
|
44
|
-
return i;
|
45
|
-
}
|
46
|
-
}
|
47
|
-
return -1;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
}
|
51
|
-
};
|
52
|
-
|
53
|
-
window.QL = QL;
|
54
|
-
$(document).ready(QL.init);
|
55
|
-
|
56
|
-
})(jQuery);
|
57
|
-
FILE
|
58
|
-
end
|
data/templates/sass.rb
CHANGED
@@ -2,8 +2,8 @@ run "mkdir public/stylesheets/sass"
|
|
2
2
|
|
3
3
|
create_file "public/stylesheets/sass/colors.sass" do
|
4
4
|
<<-FILE
|
5
|
-
|
6
|
-
|
5
|
+
$black: rgba(0, 0, 0, 1)
|
6
|
+
$white: rgba(255, 255, 255, 1)
|
7
7
|
FILE
|
8
8
|
end
|
9
9
|
|
@@ -87,7 +87,7 @@ table
|
|
87
87
|
FILE
|
88
88
|
end
|
89
89
|
|
90
|
-
create_file "public/stylesheets/grid.
|
90
|
+
create_file "public/stylesheets/grid.css" do
|
91
91
|
<<-FILE
|
92
92
|
/*
|
93
93
|
Variable Grid System.
|
@@ -456,4 +456,9 @@ create_file 'public/stylesheets/sass/common.sass' do
|
|
456
456
|
FILE
|
457
457
|
end
|
458
458
|
|
459
|
-
|
459
|
+
create_file 'public/stylesheets/sass/admin.sass' do
|
460
|
+
<<-FILE
|
461
|
+
FILE
|
462
|
+
end
|
463
|
+
|
464
|
+
run 'bundle exec sass public/stylesheets/sass/application.sass public/stylesheets/application.css'
|
data/templates/test_suite.rb
CHANGED
@@ -2,12 +2,10 @@ run "rails generate rspec:install"
|
|
2
2
|
run "rails generate cucumber:install --capybara --rspec"
|
3
3
|
run "rails generate pickle --email"
|
4
4
|
|
5
|
-
inject_into_file "config/application.rb", :after => "
|
5
|
+
inject_into_file "config/application.rb", :after => "g.template_engine :haml\n" do
|
6
6
|
<<-RUBY
|
7
|
-
config.generators do |g|
|
8
7
|
g.test_framework :rspec
|
9
8
|
g.fixture_replacement :fabrication, :dir => "spec/fabricators"
|
10
|
-
end
|
11
9
|
RUBY
|
12
10
|
end
|
13
11
|
|
@@ -17,6 +15,25 @@ $VERBOSE = nil
|
|
17
15
|
RUBY
|
18
16
|
end
|
19
17
|
|
18
|
+
inject_into_file "spec/spec_helper.rb", :before => "# This file is copied to spec/ when you run 'rails generate rspec:install'" do
|
19
|
+
<<-RUBY
|
20
|
+
require 'cover_me'
|
21
|
+
RUBY
|
22
|
+
end
|
23
|
+
|
24
|
+
inject_into_file "spec/spec_helper.rb", :after => "require 'rspec/rails'\n" do
|
25
|
+
<<-RUBY
|
26
|
+
$VERBOSE = nil
|
27
|
+
require 'remarkable/active_model'
|
28
|
+
require 'fabrication'
|
29
|
+
require 'carrierwave/test/matchers'
|
30
|
+
RUBY
|
31
|
+
end
|
32
|
+
|
33
|
+
gsub_file "spec/spec_helper.rb", /# config.mock_with :mocha/, 'config.mock_with :mocha'
|
34
|
+
gsub_file "spec/spec_helper.rb", /config.mock_with :rspec/, '#config.mock_with :rspec'
|
35
|
+
gsub_file "spec/spec_helper.rb", /config.fixture_path = \"\#{::Rails.root\}\/spec\/fixtures\"/, ""
|
36
|
+
|
20
37
|
gsub_file "features/support/env.rb",/require 'cucumber\/rails\/capybara_javascript_emulation'/,'#require \'cucumber/rails/capybara_javascript_emulation\''
|
21
38
|
|
22
39
|
run "mkdir spec/fabricators"
|
@@ -30,11 +47,11 @@ end
|
|
30
47
|
FILE
|
31
48
|
end
|
32
49
|
|
33
|
-
create_file "features/step_definitions/
|
50
|
+
create_file "features/step_definitions/fabrication_steps.rb" do
|
34
51
|
<<-'FILE'
|
35
|
-
Given /^the following (.+) records?$/ do |
|
52
|
+
Given /^the following (.+) records?$/ do |fabrication, table|
|
36
53
|
table.hashes.each do |hash|
|
37
|
-
Fabricate(
|
54
|
+
Fabricate(fabrication.to_sym, hash)
|
38
55
|
end
|
39
56
|
end
|
40
57
|
FILE
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Russ Smith
|
@@ -180,6 +180,6 @@ rubyforge_project: bear
|
|
180
180
|
rubygems_version: 1.3.7
|
181
181
|
signing_key:
|
182
182
|
specification_version: 3
|
183
|
-
summary: bear-0.0.
|
183
|
+
summary: bear-0.0.2
|
184
184
|
test_files: []
|
185
185
|
|