refinerycms 0.9.7.8 → 0.9.7.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -1
- data/Gemfile +1 -1
- data/bin/refinery-upgrade-096-to-097 +30 -13
- data/bin/refinerycms +32 -20
- data/changelog.md +14 -0
- data/db/migrate/20100729221735_remove_page_translations_if_present.rb +12 -0
- data/db/schema.rb +13 -15
- data/features/refinery/create_inquiries.feature +40 -0
- data/features/refinery/dashboard.feature +35 -1
- data/features/refinery/manage_files.feature +42 -1
- data/features/refinery/manage_images.feature +58 -1
- data/features/refinery/manage_inquiries.feature +55 -3
- data/features/refinery/manage_pages.feature +1 -1
- data/features/refinery/manage_refinery_settings.feature +1 -0
- data/features/refinery/manage_users.feature +1 -1
- data/features/refinery/plugin_generator.feature +27 -0
- data/features/refinery/site_bar.feature +4 -3
- data/features/refinery/theme_generator.feature +16 -0
- data/features/step_definitions/refinery/core_steps.rb +4 -0
- data/features/step_definitions/refinery/file_steps.rb +22 -0
- data/features/step_definitions/refinery/generator_steps.rb +11 -0
- data/features/step_definitions/refinery/image_steps.rb +43 -0
- data/features/step_definitions/refinery/inquiry_steps.rb +13 -0
- data/features/step_definitions/refinery/page_steps.rb +4 -6
- data/features/step_definitions/refinery/plugin_generator_steps.rb +16 -0
- data/features/step_definitions/refinery/theme_generator_steps.rb +15 -0
- data/features/step_definitions/refinery/user_steps.rb +1 -1
- data/features/step_definitions/web_steps.rb +18 -18
- data/features/support/env.rb +6 -7
- data/features/support/paths.rb +25 -1
- data/features/uploads/beach.INVALID +0 -0
- data/features/uploads/beach.jpeg +0 -0
- data/features/uploads/id-rather-be-here.jpg +0 -0
- data/features/uploads/refinery_is_awesome.txt +1 -0
- data/public/javascripts/refinery/admin.js +4 -4
- data/public/stylesheets/refinery/refinery.css +4 -1
- data/readme.md +1 -1
- data/todo.md +20 -8
- data/vendor/plugins/authentication/app/models/user.rb +1 -1
- data/vendor/plugins/dashboard/app/views/admin/dashboard/index.rss.builder +26 -0
- data/vendor/plugins/inquiries/app/views/admin/inquiries/_inquiry.html.erb +2 -1
- data/vendor/plugins/inquiries/app/views/admin/inquiry_settings/_confirmation_email_form.html.erb +9 -5
- data/vendor/plugins/inquiries/config/locales/en.yml +2 -2
- data/vendor/plugins/inquiries/config/routes.rb +14 -4
- data/vendor/plugins/pages/app/controllers/pages_controller.rb +3 -1
- data/vendor/plugins/refinery/app/views/shared/_google_analytics.html.erb +2 -2
- data/vendor/plugins/refinery/app/views/shared/_menu.html.erb +18 -13
- data/vendor/plugins/refinery/app/views/shared/admin/_form_actions.html.erb +3 -0
- data/vendor/plugins/refinery/app/views/shared/admin/_search.html.erb +1 -3
- data/vendor/plugins/refinery/config/locales/en.yml +1 -1
- data/vendor/plugins/refinery/lib/crud.rb +4 -1
- data/vendor/plugins/refinery/lib/generators/refinery/refinery_generator.rb +4 -61
- data/vendor/plugins/refinery/lib/generators/refinery_plugin/README +36 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/Rakefile +2 -3
- data/vendor/plugins/refinery/lib/generators/refinery_plugin/USAGE +2 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/install.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/refinery_plugin/refinery_plugin_generator.rb +76 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/MIGRATE +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/config/locales/en.yml +4 -1
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/config/locales/nb.yml +4 -1
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/config/locales/nl.yml +4 -1
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/config/routes.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/controller.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/migration.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/model.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/public_controller.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/refinery_plugin/templates/rails/init.rb +9 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/seed.rb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/_form.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/_singular_name.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/_sortable_list.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/edit.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/index.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/admin/new.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/index.html.erb +0 -0
- data/vendor/plugins/refinery/lib/generators/{refinery → refinery_plugin}/templates/views/show.html.erb +0 -0
- data/vendor/plugins/refinery/lib/refinery.rb +1 -1
- data/vendor/plugins/refinery/lib/refinery/activity.rb +3 -3
- data/vendor/plugins/refinery/lib/refinery/application_controller.rb +1 -1
- data/vendor/plugins/refinery/lib/tasks/refinery.rake +109 -32
- data/vendor/plugins/refinery/plugins.md +3 -3
- data/vendor/plugins/refinery_settings/app/models/refinery_setting.rb +26 -10
- data/vendor/plugins/refinery_settings/app/views/admin/refinery_settings/_form.html.erb +1 -2
- data/vendor/plugins/themes/generators/refinery_theme/README +17 -0
- data/vendor/plugins/themes/generators/refinery_theme/Rakefile +11 -0
- data/vendor/plugins/themes/generators/refinery_theme/USAGE +2 -0
- data/vendor/plugins/themes/generators/refinery_theme/install.rb +2 -0
- data/vendor/plugins/themes/generators/refinery_theme/refinery_theme_generator.rb +41 -0
- data/vendor/plugins/themes/generators/refinery_theme/templates/stylesheets/application.css +5 -0
- data/vendor/plugins/themes/generators/refinery_theme/templates/stylesheets/formatting.css +7 -0
- data/vendor/plugins/themes/generators/refinery_theme/templates/stylesheets/home.css +5 -0
- data/vendor/plugins/themes/generators/refinery_theme/templates/views/layouts/application.html.erb +21 -0
- data/vendor/plugins/themes/generators/refinery_theme/templates/views/pages/home.html.erb +4 -0
- data/vendor/plugins/themes/generators/refinery_theme/templates/views/pages/show.html.erb +4 -0
- data/vendor/plugins/themes/rails/init.rb +0 -1
- data/vendor/plugins/themes/readme.md +7 -2
- metadata +54 -28
- data/db/migrate/20100606173919_create_page_translations.rb +0 -12
- data/vendor/plugins/refinery/lib/generators/refinery/README +0 -30
- data/vendor/plugins/refinery/lib/generators/refinery/USAGE +0 -2
- data/vendor/plugins/refinery/lib/generators/refinery/templates/rails/init.rb +0 -13
@@ -1,4 +1,61 @@
|
|
1
|
+
@images @images-manage
|
1
2
|
Feature: Manage Images
|
2
3
|
In order to control the content on my website
|
3
4
|
As an administrator
|
4
|
-
I want to create and manage images
|
5
|
+
I want to create and manage images
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I am a logged in refinery user
|
9
|
+
|
10
|
+
Scenario: Create Valid Image
|
11
|
+
Given I have no images
|
12
|
+
When I go to the list of images
|
13
|
+
And I follow "Create New Image"
|
14
|
+
When I attach the image at "features/uploads/beach.jpeg"
|
15
|
+
And I press "Save"
|
16
|
+
Then the image "beach.jpeg" should have uploaded successfully
|
17
|
+
And I should have the correct default number of images
|
18
|
+
And the image should have size "254718"
|
19
|
+
And the image should have width "500"
|
20
|
+
And the image should have height "375"
|
21
|
+
And the image should have content_type "image/jpeg"
|
22
|
+
#This line handles properly if you have any plugins installed. Ie: Portfolio will generate two additional thumbs.
|
23
|
+
And the image should have all default thumbnail generations
|
24
|
+
|
25
|
+
Scenario: Create Invalid Image (format)
|
26
|
+
Given I have no images
|
27
|
+
When I go to the list of images
|
28
|
+
And I follow "Create New Image"
|
29
|
+
When I attach the image at "features/uploads/beach.INVALID"
|
30
|
+
And I press "Save"
|
31
|
+
Then I should see "Your image must be either a JPG, PNG or GIF"
|
32
|
+
And I should have 0 images
|
33
|
+
|
34
|
+
|
35
|
+
Scenario: Edit Existing Image
|
36
|
+
Given I have no images
|
37
|
+
When I go to the list of images
|
38
|
+
And I follow "Create New Image"
|
39
|
+
When I attach the image at "features/uploads/beach.jpeg"
|
40
|
+
And I press "Save"
|
41
|
+
Then the image "beach.jpeg" should have uploaded successfully
|
42
|
+
Then I go to the list of images
|
43
|
+
And I follow "Edit this image"
|
44
|
+
And I attach the image at "features/uploads/id-rather-be-here.jpg"
|
45
|
+
And I press "Save"
|
46
|
+
#Note: The following line is a workaround for the flash. It isn't working, so this catches the created image's name='' attribute.
|
47
|
+
Then I should see "Id Rather Be Here"
|
48
|
+
And I should have the correct default number of images
|
49
|
+
|
50
|
+
Scenario: Delete Image
|
51
|
+
Given I have no images
|
52
|
+
When I go to the list of images
|
53
|
+
And I follow "Create New Image"
|
54
|
+
When I attach the image at "features/uploads/beach.jpeg"
|
55
|
+
And I press "Save"
|
56
|
+
Then the image "beach.jpeg" should have uploaded successfully
|
57
|
+
Then I go to the list of images
|
58
|
+
#Delete functionality doesn't test properly, yet.
|
59
|
+
#And I follow "Remove this image forever"
|
60
|
+
#And I press "Ok"
|
61
|
+
#Then I should have 0 images
|
@@ -1,4 +1,56 @@
|
|
1
|
+
@inquiries @inquiries-manage
|
1
2
|
Feature: Manage Inquiries
|
2
|
-
In order to
|
3
|
-
As an
|
4
|
-
I want to
|
3
|
+
In order to see inquiries left for me on my website
|
4
|
+
As an Administrator
|
5
|
+
I want to manage inquiries
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given I am a logged in refinery user
|
9
|
+
And I have an inquiry from "David Jones" with email "dave@refinerycms.com" and message "Hello, I really like your website. Was it hard to build and maintain or could anyone do it?"
|
10
|
+
|
11
|
+
Scenario: Inquiries List
|
12
|
+
When I go to the list of inquiries
|
13
|
+
Then I should see "David Jones said Hello, I really like your website. Was it hard to build ..."
|
14
|
+
And I should have 1 inquiries
|
15
|
+
And I should not see "Create"
|
16
|
+
|
17
|
+
Scenario: Spam List
|
18
|
+
When I go to the list of inquiries
|
19
|
+
And I follow "Spam"
|
20
|
+
Then I should see "Hooray! You don't have any spam."
|
21
|
+
|
22
|
+
Scenario: Updating who gets notified
|
23
|
+
When I go to the list of inquiries
|
24
|
+
And I follow "Update who gets notified"
|
25
|
+
And I fill in "Send notifications to" with "phil@refinerycms.com"
|
26
|
+
And I press "Save"
|
27
|
+
Then I should be redirected back to "the list of inquiries"
|
28
|
+
And I should see "'Notification Recipients' was successfully updated."
|
29
|
+
And I should be on the list of inquiries
|
30
|
+
|
31
|
+
Scenario: Updating confirmation email copy
|
32
|
+
When I go to the list of inquiries
|
33
|
+
And I follow "Edit confirmation email"
|
34
|
+
And I fill in "Message" with "Thanks %name%! We'll never get back to you!"
|
35
|
+
And I press "Save"
|
36
|
+
Then I should be redirected back to "the list of inquiries"
|
37
|
+
And I should see "'Confirmation Body' was successfully updated."
|
38
|
+
And I should be on the list of inquiries
|
39
|
+
|
40
|
+
Scenario: Inquiries Show
|
41
|
+
When I go to the list of inquiries
|
42
|
+
And I follow "Read the inquiry"
|
43
|
+
Then I should see "From David Jones [dave@refinerycms.com]"
|
44
|
+
And I should see "Hello, I really like your website. Was it hard to build and maintain or could anyone do it?"
|
45
|
+
And I should see "Age"
|
46
|
+
And I should see "Back to all Inquiries"
|
47
|
+
And I should see "Remove this inquiry forever"
|
48
|
+
|
49
|
+
# not worth it unless someone can confirm javascript confirmations??
|
50
|
+
#Scenario: Inquiries Delete
|
51
|
+
# When I go to the list of inquiries
|
52
|
+
# And I follow "Read the inquiry"
|
53
|
+
# And I follow "Remove this inquiry forever"
|
54
|
+
# And I press "OK"
|
55
|
+
# Then I should see "'David Jones' was successfully destroyed."
|
56
|
+
# And I should have 0 inquiries
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Feature: Plugin generation
|
2
|
+
In order to create my own plugin
|
3
|
+
As a refinery user
|
4
|
+
I want to generate a basic plugin directory structure
|
5
|
+
|
6
|
+
Scenario: Generating a plugin with a name
|
7
|
+
Given I have a refinery application
|
8
|
+
When I generate a plugin with the arguments of "product title:string description:text image:image brochure:resource"
|
9
|
+
Then I should have a directory "vendor/plugins/products"
|
10
|
+
And I should have a directory "vendor/plugins/products/app"
|
11
|
+
And I should have a directory "vendor/plugins/products/config"
|
12
|
+
And I should have a directory "vendor/plugins/products/rails"
|
13
|
+
And I should have a directory "vendor/plugins/products/rails"
|
14
|
+
And I should have a file "vendor/plugins/products/rails/init.rb"
|
15
|
+
And I should have a file "vendor/plugins/products/app/controllers/admin/products_controller.rb"
|
16
|
+
And I should have a file "vendor/plugins/products/app/controllers/products_controller.rb"
|
17
|
+
And I should have a file "vendor/plugins/products/app/models/product.rb"
|
18
|
+
And I should have a file "vendor/plugins/products/config/routes.rb"
|
19
|
+
And I should have a file "vendor/plugins/products/config/locales/en.yml"
|
20
|
+
And I should have a file "vendor/plugins/products/app/views/admin/products/_form.html.erb"
|
21
|
+
And I should have a file "vendor/plugins/products/app/views/admin/products/_sortable_list.html.erb"
|
22
|
+
And I should have a file "vendor/plugins/products/app/views/admin/products/edit.html.erb"
|
23
|
+
And I should have a file "vendor/plugins/products/app/views/admin/products/index.html.erb"
|
24
|
+
And I should have a file "vendor/plugins/products/app/views/admin/products/new.html.erb"
|
25
|
+
And I should have a file "vendor/plugins/products/app/views/admin/products/_product.html.erb"
|
26
|
+
And I should have a file "vendor/plugins/products/app/views/products/index.html.erb"
|
27
|
+
And I should have a file "vendor/plugins/products/app/views/products/show.html.erb"
|
@@ -1,10 +1,11 @@
|
|
1
|
+
@site_bar
|
1
2
|
Feature: Site Bar
|
2
3
|
In order to allow administrators to easily switch between editing and viewing their website
|
3
4
|
I want logged in refinery users to see a site bar
|
4
5
|
And I want logged in customers to not see a site bar
|
5
6
|
|
6
7
|
Background:
|
7
|
-
Given I have a
|
8
|
+
Given I have a page titled "Home" with a custom url "/"
|
8
9
|
And I am not logged in
|
9
10
|
|
10
11
|
Scenario: Not logged in
|
@@ -12,7 +13,7 @@ Feature: Site Bar
|
|
12
13
|
Then I should not see "Log out"
|
13
14
|
|
14
15
|
Scenario: Logged in as a Refinery user
|
15
|
-
Given I am a logged in user
|
16
|
+
Given I am a logged in refinery user
|
16
17
|
When I go to the home page
|
17
18
|
Then I should see "Log out"
|
18
19
|
|
@@ -20,4 +21,4 @@ Feature: Site Bar
|
|
20
21
|
Given A Refinery user exists
|
21
22
|
And I am a logged in customer
|
22
23
|
When I go to the home page
|
23
|
-
Then I should not see "
|
24
|
+
Then I should not see "Switch to your website editor"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: Theme generation
|
2
|
+
In order to create my own theme
|
3
|
+
As a refinery user
|
4
|
+
I want to generate a basic theme directory structure
|
5
|
+
|
6
|
+
Scenario: Generating a theme with a name
|
7
|
+
Given I have a refinery application
|
8
|
+
When I generate a theme with the name of "modern"
|
9
|
+
Then I should have a directory "themes/modern"
|
10
|
+
And I should have a file "themes/modern/stylesheets/application.css"
|
11
|
+
And I should have a file "themes/modern/stylesheets/home.css"
|
12
|
+
And I should have a file "themes/modern/stylesheets/formatting.css"
|
13
|
+
And I should have a file "themes/modern/views/layouts/application.html.erb"
|
14
|
+
And I should have a file "themes/modern/views/pages/home.html.erb"
|
15
|
+
And I should have a file "themes/modern/views/pages/show.html.erb"
|
16
|
+
And I should have a directory "themes/modern/javascripts"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Given /^I have no files$/ do
|
2
|
+
Resource.delete_all
|
3
|
+
end
|
4
|
+
|
5
|
+
When /^I attach the file at "([^"]*)"$/ do |file_path|
|
6
|
+
attach_file('resource[uploaded_data]', File.join(Rails.root, file_path))
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^the file "([^"]*)" should have uploaded successfully$/ do |file_name|
|
10
|
+
Resource.find_by_filename(file_name).nil?.should == false
|
11
|
+
end
|
12
|
+
|
13
|
+
And /^I should have ([0-9]+) files?$/ do |number|
|
14
|
+
Resource.count.should == number.to_i
|
15
|
+
end
|
16
|
+
|
17
|
+
When /^I upload the file at "([^"]*)"$/ do |file_path|
|
18
|
+
visit new_admin_resource_path
|
19
|
+
attach_file('resource[uploaded_data]', File.join(Rails.root, file_path))
|
20
|
+
click_button 'Save'
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Given /^I have a refinery application$/ do
|
2
|
+
FileUtils.mkdir(File.join(@app_root))
|
3
|
+
end
|
4
|
+
|
5
|
+
Then /^I should have a directory "([^"]*)"$/ do |name|
|
6
|
+
File.exist?(File.join(@tmp_refinery_app_root, name)).should be_true
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^I should have a file "([^"]*)"$/ do |name|
|
10
|
+
File.exist?(File.join(@tmp_refinery_app_root, name)).should be_true
|
11
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
Given /^I have no images$/ do
|
2
|
+
Image.delete_all
|
3
|
+
end
|
4
|
+
|
5
|
+
When /^I attach the image at "([^"]*)"$/ do |file_path|
|
6
|
+
attach_file('image[uploaded_data]', File.join(Rails.root, file_path))
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^the image "([^"]*)" should have uploaded successfully$/ do |file_name|
|
10
|
+
Image.find_by_filename(file_name).nil?.should == false
|
11
|
+
end
|
12
|
+
|
13
|
+
Then /^I should have the correct default number of images$/ do
|
14
|
+
image_number = RefinerySetting['image_thumbnails'].length
|
15
|
+
Image.count.should == image_number + 1
|
16
|
+
end
|
17
|
+
|
18
|
+
Then /^the image should have size "([^"]*)"$/ do |size|
|
19
|
+
Image.first.size.should == size.to_i
|
20
|
+
end
|
21
|
+
|
22
|
+
Then /^the image should have width "([^"]*)"$/ do |width|
|
23
|
+
Image.first.width.should == width.to_i
|
24
|
+
end
|
25
|
+
|
26
|
+
Then /^the image should have height "([^"]*)"$/ do |height|
|
27
|
+
Image.first.height.should == height.to_i
|
28
|
+
end
|
29
|
+
|
30
|
+
Then /^the image should have content_type "([^"]*)"$/ do |content_type|
|
31
|
+
Image.first.content_type.should == content_type.to_s
|
32
|
+
end
|
33
|
+
|
34
|
+
Then /^the image should have all default thumbnail generations$/ do
|
35
|
+
parent_id = Image.first.id
|
36
|
+
Image.find_all_by_parent_id(parent_id).each do |image|
|
37
|
+
RefinerySetting['image_thumbnails'].has_key?(image.thumbnail.to_sym).should == true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
Then /^I should have ([0-9]+) images?$/ do |number|
|
42
|
+
Image.count.should == number.to_i
|
43
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Given /^I have no inquiries$/ do
|
2
|
+
Inquiry.delete_all
|
3
|
+
end
|
4
|
+
|
5
|
+
Then /^I should have ([0-9]+) inquiries?$/ do |count|
|
6
|
+
Inquiry.count.should == count.to_i
|
7
|
+
end
|
8
|
+
|
9
|
+
Given /^I have an inquiry from "([^"]*)" with email "([^\"]*)" and message "([^\"]*)"$/ do |name, email, message|
|
10
|
+
Inquiry.create(:name => name,
|
11
|
+
:email => email,
|
12
|
+
:message => message)
|
13
|
+
end
|
@@ -1,10 +1,8 @@
|
|
1
|
-
Given /^I (only )?have a
|
1
|
+
Given /^I (only )?have a page titled (.+) with a custom url (.+)?$/ do |only, title, link_url|
|
2
2
|
Page.delete_all if only
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
Page.create(:title => title, :link_url => '/')
|
7
|
-
end
|
3
|
+
|
4
|
+
Page.create(:title => title,
|
5
|
+
:link_url => link_url)
|
8
6
|
end
|
9
7
|
|
10
8
|
Given /^I (only )?have pages titled (.+)$/ do |only, titles|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Before do
|
2
|
+
@plugin_generator_root = File.join(File.dirname(__FILE__), "/../../")
|
3
|
+
@tmp_refinery_app_name = "tmp_refinery_app"
|
4
|
+
@tmp_refinery_app_root = File.join(@plugin_generator_root, @tmp_refinery_app_name)
|
5
|
+
@app_root = @tmp_refinery_app_root
|
6
|
+
Rails::Generator::Base.append_sources(Rails::Generator::PathSource.new(:plugin, "#{@plugin_generator_root}/generators/"))
|
7
|
+
end
|
8
|
+
|
9
|
+
After do
|
10
|
+
FileUtils.rm_rf(@tmp_refinery_app_root)
|
11
|
+
end
|
12
|
+
|
13
|
+
When /^I generate a plugin with the arguments of "([^"]*)"$/ do |arguments|
|
14
|
+
Rails::Generator::Scripts::Generate.new.run((["refinery_plugin"] | arguments.split(" ")), {:quiet => true, :destination => @app_root})
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Before do
|
2
|
+
@theme_generator_root = File.join(File.dirname(__FILE__), "/../../")
|
3
|
+
@tmp_refinery_app_name = "tmp_refinery_app"
|
4
|
+
@tmp_refinery_app_root = File.join(@theme_generator_root, @tmp_refinery_app_name)
|
5
|
+
@app_root = @tmp_refinery_app_root
|
6
|
+
Rails::Generator::Base.append_sources(Rails::Generator::PathSource.new(:theme, "#{@theme_generator_root}/generators/"))
|
7
|
+
end
|
8
|
+
|
9
|
+
After do
|
10
|
+
FileUtils.rm_rf(@tmp_refinery_app_root)
|
11
|
+
end
|
12
|
+
|
13
|
+
When /^I generate a theme with the name of "([^"]*)"$/ do |name|
|
14
|
+
Rails::Generator::Scripts::Generate.new.run(['refinery_theme', name], {:quiet => true, :destination => @app_root})
|
15
|
+
end
|
@@ -24,25 +24,25 @@ When /^(?:|I )go to (.+)$/ do |page_name|
|
|
24
24
|
visit path_to(page_name)
|
25
25
|
end
|
26
26
|
|
27
|
-
When /^(?:|I )press "([
|
27
|
+
When /^(?:|I )press "([^\"]*)"(?: within "([^\"]*)")?$/ do |button, selector|
|
28
28
|
with_scope(selector) do
|
29
29
|
click_button(button)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
When /^(?:|I )follow "([
|
33
|
+
When /^(?:|I )follow "([^\"]*)"(?: within "([^\"]*)")?$/ do |link, selector|
|
34
34
|
with_scope(selector) do
|
35
35
|
click_link(link)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
When /^(?:|I )fill in "([
|
39
|
+
When /^(?:|I )fill in "([^\"]*)" with "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, value, selector|
|
40
40
|
with_scope(selector) do
|
41
41
|
fill_in(field, :with => value)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
When /^(?:|I )fill in "([
|
45
|
+
When /^(?:|I )fill in "([^\"]*)" for "([^\"]*)"(?: within "([^\"]*)")?$/ do |value, field, selector|
|
46
46
|
with_scope(selector) do
|
47
47
|
fill_in(field, :with => value)
|
48
48
|
end
|
@@ -59,7 +59,7 @@ end
|
|
59
59
|
# TODO: Add support for checkbox, select or option
|
60
60
|
# based on naming conventions.
|
61
61
|
#
|
62
|
-
When /^(?:|I )fill in the following(?: within "([
|
62
|
+
When /^(?:|I )fill in the following(?: within "([^\"]*)")?:$/ do |selector, fields|
|
63
63
|
with_scope(selector) do
|
64
64
|
fields.rows_hash.each do |name, value|
|
65
65
|
When %{I fill in "#{name}" with "#{value}"}
|
@@ -67,31 +67,31 @@ When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, field
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
When /^(?:|I )select "([
|
70
|
+
When /^(?:|I )select "([^\"]*)" from "([^\"]*)"(?: within "([^\"]*)")?$/ do |value, field, selector|
|
71
71
|
with_scope(selector) do
|
72
72
|
select(value, :from => field)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
When /^(?:|I )check "([
|
76
|
+
When /^(?:|I )check "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector|
|
77
77
|
with_scope(selector) do
|
78
78
|
check(field)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
When /^(?:|I )uncheck "([
|
82
|
+
When /^(?:|I )uncheck "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector|
|
83
83
|
with_scope(selector) do
|
84
84
|
uncheck(field)
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
-
When /^(?:|I )choose "([
|
88
|
+
When /^(?:|I )choose "([^\"]*)"(?: within "([^\"]*)")?$/ do |field, selector|
|
89
89
|
with_scope(selector) do
|
90
90
|
choose(field)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
When /^(?:|I )attach the file "([
|
94
|
+
When /^(?:|I )attach the file "([^\"]*)" to "([^\"]*)"(?: within "([^\"]*)")?$/ do |path, field, selector|
|
95
95
|
with_scope(selector) do
|
96
96
|
attach_file(field, path)
|
97
97
|
end
|
@@ -104,7 +104,7 @@ Then /^(?:|I )should see JSON:$/ do |expected_json|
|
|
104
104
|
expected.should == actual
|
105
105
|
end
|
106
106
|
|
107
|
-
Then /^(?:|I )should see "([
|
107
|
+
Then /^(?:|I )should see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector|
|
108
108
|
with_scope(selector) do
|
109
109
|
if page.respond_to? :should
|
110
110
|
page.should have_content(text)
|
@@ -114,7 +114,7 @@ Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
-
Then /^(?:|I )should see \/([^\/]*)\/(?: within "([
|
117
|
+
Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^\"]*)")?$/ do |regexp, selector|
|
118
118
|
regexp = Regexp.new(regexp)
|
119
119
|
with_scope(selector) do
|
120
120
|
if page.respond_to? :should
|
@@ -125,7 +125,7 @@ Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, select
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
-
Then /^(?:|I )should not see "([
|
128
|
+
Then /^(?:|I )should not see "([^\"]*)"(?: within "([^\"]*)")?$/ do |text, selector|
|
129
129
|
with_scope(selector) do
|
130
130
|
if page.respond_to? :should
|
131
131
|
page.should have_no_content(text)
|
@@ -135,7 +135,7 @@ Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selecto
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
-
Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([
|
138
|
+
Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^\"]*)")?$/ do |regexp, selector|
|
139
139
|
regexp = Regexp.new(regexp)
|
140
140
|
with_scope(selector) do
|
141
141
|
if page.respond_to? :should
|
@@ -146,7 +146,7 @@ Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, se
|
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
-
Then /^the "([
|
149
|
+
Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should contain "([^\"]*)"$/ do |field, selector, value|
|
150
150
|
with_scope(selector) do
|
151
151
|
field = find_field(field)
|
152
152
|
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
@@ -158,7 +158,7 @@ Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
-
Then /^the "([
|
161
|
+
Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should not contain "([^\"]*)"$/ do |field, selector, value|
|
162
162
|
with_scope(selector) do
|
163
163
|
field = find_field(field)
|
164
164
|
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
@@ -170,7 +170,7 @@ Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/
|
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
173
|
-
Then /^the "([
|
173
|
+
Then /^the "([^\"]*)" checkbox(?: within "([^\"]*)")? should be checked$/ do |label, selector|
|
174
174
|
with_scope(selector) do
|
175
175
|
field_checked = find_field(label)['checked']
|
176
176
|
if field_checked.respond_to? :should
|
@@ -181,7 +181,7 @@ Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |labe
|
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
184
|
-
Then /^the "([
|
184
|
+
Then /^the "([^\"]*)" checkbox(?: within "([^\"]*)")? should not be checked$/ do |label, selector|
|
185
185
|
with_scope(selector) do
|
186
186
|
field_checked = find_field(label)['checked']
|
187
187
|
if field_checked.respond_to? :should
|