lolita 3.1.10 → 3.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -5
- data/.rspec +2 -2
- data/GUIDELINES.rdoc +24 -24
- data/Gemfile +26 -26
- data/History.rdoc +162 -154
- data/LICENSE.txt +22 -22
- data/README.rdoc +98 -98
- data/Rakefile +40 -40
- data/VERSION +1 -1
- data/app/controllers/lolita/info_controller.rb +41 -41
- data/app/controllers/lolita/rest_controller.rb +130 -130
- data/app/helpers/components/lolita/configuration/list_component.rb +10 -10
- data/app/helpers/lolita_helper.rb +11 -11
- data/app/views/components/lolita/configuration/column/_display.html.erb +4 -4
- data/app/views/components/lolita/configuration/column/_header.html.erb +7 -7
- data/app/views/components/lolita/configuration/column/_sort.html.erb +4 -4
- data/app/views/components/lolita/configuration/columns/_body.html.erb +4 -4
- data/app/views/components/lolita/configuration/columns/_display.html.erb +1 -1
- data/app/views/components/lolita/configuration/columns/_first.html.erb +2 -2
- data/app/views/components/lolita/configuration/columns/_first_column_header.html.erb +3 -3
- data/app/views/components/lolita/configuration/columns/_header.html.erb +8 -8
- data/app/views/components/lolita/configuration/columns/_last.html.erb +4 -4
- data/app/views/components/lolita/configuration/columns/_last_column_header.html.erb +2 -2
- data/app/views/components/lolita/configuration/columns/_row.html.erb +7 -7
- data/app/views/components/lolita/configuration/field/_display.html.erb +9 -9
- data/app/views/components/lolita/configuration/field/_label.html.erb +1 -1
- data/app/views/components/lolita/configuration/field/_object.html.erb +1 -1
- data/app/views/components/lolita/configuration/field/array/_display.html.erb +4 -4
- data/app/views/components/lolita/configuration/field/array/habtm/_display.html.erb +26 -26
- data/app/views/components/lolita/configuration/field/array/select/_display.html.erb +5 -5
- data/app/views/components/lolita/configuration/field/boolean/filter/_display.html.erb +1 -1
- data/app/views/components/lolita/configuration/field/date/_display.html.erb +1 -1
- data/app/views/components/lolita/configuration/field/date_time/date/_display.html.erb +1 -1
- data/app/views/components/lolita/configuration/field/integer/_display.html.erb +1 -1
- data/app/views/components/lolita/configuration/field/string/_display.html.erb +4 -4
- data/app/views/components/lolita/configuration/field/string/disabled/_display.html.erb +1 -1
- data/app/views/components/lolita/configuration/field/string/password/_display.html.erb +3 -3
- data/app/views/components/lolita/configuration/field/string/text/_display.html.erb +18 -18
- data/app/views/components/lolita/configuration/field_set/_display.html.erb +5 -5
- data/app/views/components/lolita/configuration/list/_display.html.erb +10 -10
- data/app/views/components/lolita/configuration/list/_filter.html.erb +7 -7
- data/app/views/components/lolita/configuration/list/_new_resource.html.erb +4 -4
- data/app/views/components/lolita/configuration/list/_title.html.erb +4 -4
- data/app/views/components/lolita/configuration/tab/_display.html.erb +17 -17
- data/app/views/components/lolita/configuration/tab/_fields.html.erb +6 -6
- data/app/views/components/lolita/configuration/tab/content/_display.html.erb +1 -1
- data/app/views/components/lolita/configuration/tab/default/_display.html.erb +8 -8
- data/app/views/components/lolita/configuration/tabs/_display.html.erb +10 -10
- data/app/views/components/lolita/navigation/_display.html.erb +2 -2
- data/app/views/components/lolita/navigation/_tree.html.erb +38 -38
- data/app/views/components/lolita/shared/_flash.html.erb +5 -5
- data/app/views/components/lolita/shared/_header.html.erb +8 -8
- data/app/views/components/lolita/shared/_right_sidebar.html.erb +13 -13
- data/app/views/layouts/lolita/application.html.erb +44 -44
- data/app/views/lolita/info/index.html.erb +232 -232
- data/app/views/lolita/rest/form.html.erb +1 -1
- data/app/views/lolita/rest/index.html.erb +1 -1
- data/author +1 -1
- data/config/locales/default/lv.yml +180 -180
- data/config/locales/en.yml +20 -20
- data/config/locales/lv.yml +20 -20
- data/config/routes.rb +3 -3
- data/db/seed.rb +1 -1
- data/features/create_page.feature +19 -19
- data/features/step_definitions/lolita_steps.rb +7 -7
- data/features/step_definitions/web_steps.rb +219 -219
- data/features/support/env.rb +73 -73
- data/features/support/paths.rb +35 -35
- data/lib/generators/helpers/file_helper.rb +22 -22
- data/lib/generators/lolita/assets_generator.rb +18 -18
- data/lib/generators/lolita/install_generator.rb +28 -28
- data/lib/generators/templates/lolita.rb +19 -19
- data/lib/lolita.rb +184 -184
- data/lib/lolita/adapter/abstract_adapter.rb +13 -13
- data/lib/lolita/adapter/active_record.rb +148 -148
- data/lib/lolita/adapter/mongoid.rb +127 -127
- data/lib/lolita/base_configuration.rb +165 -165
- data/lib/lolita/builder.rb +249 -249
- data/lib/lolita/configuration/base.rb +76 -76
- data/lib/lolita/configuration/column.rb +93 -94
- data/lib/lolita/configuration/columns.rb +66 -66
- data/lib/lolita/configuration/factory.rb +55 -55
- data/lib/lolita/configuration/field.rb +216 -216
- data/lib/lolita/configuration/field/array.rb +75 -75
- data/lib/lolita/configuration/field/big_decimal.rb +12 -12
- data/lib/lolita/configuration/field/boolean.rb +12 -12
- data/lib/lolita/configuration/field/date.rb +12 -12
- data/lib/lolita/configuration/field/date_time.rb +13 -13
- data/lib/lolita/configuration/field/integer.rb +12 -12
- data/lib/lolita/configuration/field/string.rb +13 -13
- data/lib/lolita/configuration/field/time.rb +13 -13
- data/lib/lolita/configuration/field_set.rb +25 -25
- data/lib/lolita/configuration/fields.rb +35 -35
- data/lib/lolita/configuration/filter.rb +108 -108
- data/lib/lolita/configuration/list.rb +104 -104
- data/lib/lolita/configuration/page.rb +125 -124
- data/lib/lolita/configuration/tab.rb +187 -187
- data/lib/lolita/configuration/tab/content.rb +21 -21
- data/lib/lolita/configuration/tab/default.rb +25 -25
- data/lib/lolita/configuration/tabs.rb +132 -132
- data/lib/lolita/controllers/component_helpers.rb +127 -127
- data/lib/lolita/controllers/internal_helpers.rb +109 -109
- data/lib/lolita/controllers/url_helpers.rb +111 -111
- data/lib/lolita/controllers/user_helpers.rb +32 -32
- data/lib/lolita/controllers/view_user_helpers.rb +12 -12
- data/lib/lolita/dbi/base.rb +50 -50
- data/lib/lolita/errors.rb +12 -12
- data/lib/lolita/hooks.rb +355 -355
- data/lib/lolita/hooks/named_hook.rb +125 -125
- data/lib/lolita/lazy_loader.rb +46 -46
- data/lib/lolita/mapping.rb +55 -55
- data/lib/lolita/modules.rb +6 -6
- data/lib/lolita/modules/rest.rb +10 -10
- data/lib/lolita/navigation/branch.rb +132 -132
- data/lib/lolita/navigation/tree.rb +116 -116
- data/lib/lolita/observed_array.rb +74 -74
- data/lib/lolita/rails.rb +20 -20
- data/lib/lolita/rails/all.rb +10 -10
- data/lib/lolita/rails/routes.rb +133 -133
- data/lib/lolita/ruby_ext/accessors.rb +26 -26
- data/lib/lolita/support/formatter.rb +62 -62
- data/lib/lolita/support/formatter/rails.rb +56 -56
- data/lib/lolita/test/matchers.rb +77 -77
- data/lolita.gemspec +2 -2
- data/public/javascripts/jquery-1.6.min.js +15 -15
- data/public/javascripts/jquery-ui-1.8.13.min.js +407 -407
- data/public/javascripts/lolita/main.js +39 -39
- data/public/javascripts/lolita/tab.js +41 -41
- data/public/javascripts/modernizr-1.7.min.js +1 -1
- data/public/javascripts/rails.js +137 -137
- data/public/javascripts/tinymce/langs/en.js +221 -221
- data/public/javascripts/tinymce/license.txt +504 -504
- data/public/javascripts/tinymce/themes/advanced/about.htm +52 -52
- data/public/javascripts/tinymce/themes/advanced/anchor.htm +26 -26
- data/public/javascripts/tinymce/themes/advanced/charmap.htm +51 -51
- data/public/javascripts/tinymce/themes/advanced/color_picker.htm +74 -74
- data/public/javascripts/tinymce/themes/advanced/editor_template_src.js +1328 -1328
- data/public/javascripts/tinymce/themes/advanced/image.htm +80 -80
- data/public/javascripts/tinymce/themes/advanced/js/about.js +73 -73
- data/public/javascripts/tinymce/themes/advanced/js/anchor.js +42 -42
- data/public/javascripts/tinymce/themes/advanced/js/charmap.js +354 -354
- data/public/javascripts/tinymce/themes/advanced/js/color_picker.js +329 -329
- data/public/javascripts/tinymce/themes/advanced/js/image.js +247 -247
- data/public/javascripts/tinymce/themes/advanced/js/link.js +153 -153
- data/public/javascripts/tinymce/themes/advanced/js/source_editor.js +56 -56
- data/public/javascripts/tinymce/themes/advanced/langs/en.js +68 -68
- data/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +53 -53
- data/public/javascripts/tinymce/themes/advanced/link.htm +57 -57
- data/public/javascripts/tinymce/themes/advanced/shortcuts.htm +47 -47
- data/public/javascripts/tinymce/themes/advanced/skins/cirkuit/content.css +66 -66
- data/public/javascripts/tinymce/themes/advanced/skins/cirkuit/dialog.css +117 -117
- data/public/javascripts/tinymce/themes/advanced/skins/cirkuit/ui.css +988 -988
- data/public/javascripts/tinymce/themes/advanced/source_editor.htm +25 -25
- data/public/javascripts/tinymce/tiny_mce_popup.js +4 -4
- data/public/javascripts/tinymce_config.js +15 -15
- data/public/stylesheets/lolita/default.css +169 -169
- data/public/stylesheets/lolita/style.css +253 -253
- data/spec/adapter_helper.rb +43 -43
- data/spec/builder_spec.rb +120 -120
- data/spec/configuration/base_spec.rb +44 -44
- data/spec/configuration/column_spec.rb +89 -89
- data/spec/configuration/columns_spec.rb +54 -54
- data/spec/configuration/field_set_spec.rb +12 -12
- data/spec/configuration/field_spec.rb +118 -118
- data/spec/configuration/filter_spec.rb +122 -122
- data/spec/configuration/list_spec.rb +76 -76
- data/spec/configuration/page_spec.rb +19 -19
- data/spec/configuration/tab_spec.rb +165 -165
- data/spec/configuration/tabs_spec.rb +106 -106
- data/spec/controllers/component_helpers_spec.rb +5 -5
- data/spec/controllers/internal_helpers_spec.rb +76 -76
- data/spec/controllers/lolita_rest_nested_resources_spec.rb +33 -33
- data/spec/controllers/lolita_rest_spec.rb +53 -53
- data/spec/dbi/base_spec.rb +44 -44
- data/spec/hooks_spec.rb +257 -257
- data/spec/lolita_spec.rb +13 -13
- data/spec/mapping_spec.rb +29 -29
- data/spec/navigation/branch_spec.rb +81 -81
- data/spec/navigation/tree_spec.rb +73 -73
- data/spec/orm/mongoid.rb +11 -11
- data/spec/rails_app/app/controllers/application_controller.rb +3 -3
- data/spec/rails_app/app/helpers/application_helper.rb +3 -3
- data/spec/rails_app/app/mongoid/address.rb +7 -7
- data/spec/rails_app/app/mongoid/category.rb +5 -5
- data/spec/rails_app/app/mongoid/comment.rb +5 -5
- data/spec/rails_app/app/mongoid/post.rb +18 -18
- data/spec/rails_app/app/mongoid/preference.rb +5 -5
- data/spec/rails_app/app/mongoid/profile.rb +13 -13
- data/spec/rails_app/app/mongoid/tag.rb +3 -3
- data/spec/rails_app/app/views/components/lolita/configuration/list/_body_cell.html.erb +1 -1
- data/spec/rails_app/config/application.rb +26 -26
- data/spec/rails_app/config/boot.rb +13 -13
- data/spec/rails_app/config/environment.rb +5 -5
- data/spec/rails_app/config/environments/development.rb +19 -19
- data/spec/rails_app/config/environments/production.rb +33 -33
- data/spec/rails_app/config/environments/test.rb +33 -33
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -7
- data/spec/rails_app/config/initializers/inflections.rb +2 -2
- data/spec/rails_app/config/initializers/secret_token.rb +1 -1
- data/spec/rails_app/config/routes.rb +2 -2
- data/spec/rails_app/lib/lolita/configuration/field/my_custom_collection.rb +13 -13
- data/spec/rails_app/public/javascripts/jquery-1.5.1.min.js +15 -15
- data/spec/rails_app/public/javascripts/lolita/main.js +6 -6
- data/spec/rails_app/public/javascripts/lolita/tab.js +40 -40
- data/spec/rails_app/public/javascripts/modernizr-1.7.min.js +1 -1
- data/spec/rails_app/public/javascripts/rails.js +137 -137
- data/spec/rails_app/public/javascripts/tinymce/langs/en.js +221 -221
- data/spec/rails_app/public/javascripts/tinymce/license.txt +504 -504
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/about.htm +52 -52
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/anchor.htm +26 -26
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/charmap.htm +51 -51
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/color_picker.htm +74 -74
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/editor_template_src.js +1328 -1328
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/image.htm +80 -80
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/about.js +73 -73
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/anchor.js +42 -42
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/charmap.js +354 -354
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/color_picker.js +329 -329
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/image.js +247 -247
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/link.js +153 -153
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/source_editor.js +56 -56
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/langs/en.js +68 -68
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +53 -53
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/link.htm +57 -57
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/shortcuts.htm +47 -47
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/skins/cirkuit/content.css +66 -66
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/skins/cirkuit/dialog.css +117 -117
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/skins/cirkuit/ui.css +988 -988
- data/spec/rails_app/public/javascripts/tinymce/themes/advanced/source_editor.htm +25 -25
- data/spec/rails_app/public/javascripts/tinymce/tiny_mce_popup.js +4 -4
- data/spec/rails_app/public/stylesheets/lolita/default.css +169 -169
- data/spec/rails_app/public/stylesheets/lolita/style.css +214 -214
- data/spec/routing/routes_spec.rb +15 -15
- data/spec/spec_helper.rb +46 -46
- data/spec/support/factories/category.rb +3 -3
- data/spec/support/factories/post.rb +4 -4
- data/spec/support/factories/tag.rb +2 -2
- data/spec/support/formatter_spec.rb +42 -42
- metadata +31 -31
data/config/routes.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Rails.application.routes.draw do
|
2
|
-
match '/lolita' => "lolita/info#index"
|
3
|
-
match '/lolita/info/properties' => "lolita/info#properties"
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
match '/lolita' => "lolita/info#index"
|
3
|
+
match '/lolita/info/properties' => "lolita/info#properties"
|
4
4
|
end
|
data/db/seed.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
puts "Loading Lolita data to application..."
|
1
|
+
puts "Loading Lolita data to application..."
|
@@ -1,20 +1,20 @@
|
|
1
|
-
Feature: Create pages
|
2
|
-
In order to manage content
|
3
|
-
As lolita user
|
4
|
-
I want to create posts
|
5
|
-
|
6
|
-
Scenario: List and create new with valid data
|
7
|
-
When I go to list
|
8
|
-
And I follow "Add new post"
|
9
|
-
And I fill in "Title" with "Lolita is nice"
|
10
|
-
When I press "Save" within ".save"
|
11
|
-
Then I should see "Successfully saved"
|
12
|
-
When I follow "Post"
|
13
|
-
#Then I should see "Lolita is nice"
|
14
|
-
|
15
|
-
Scenario: List and create new with invalid data
|
16
|
-
When I go to list
|
17
|
-
And I follow "Add new post"
|
18
|
-
When I press "Save" within ".save"
|
19
|
-
Then I should see "Save did not succeed"
|
1
|
+
Feature: Create pages
|
2
|
+
In order to manage content
|
3
|
+
As lolita user
|
4
|
+
I want to create posts
|
5
|
+
|
6
|
+
Scenario: List and create new with valid data
|
7
|
+
When I go to list
|
8
|
+
And I follow "Add new post"
|
9
|
+
And I fill in "Title" with "Lolita is nice"
|
10
|
+
When I press "Save" within ".save"
|
11
|
+
Then I should see "Successfully saved"
|
12
|
+
When I follow "Post"
|
13
|
+
#Then I should see "Lolita is nice"
|
14
|
+
|
15
|
+
Scenario: List and create new with invalid data
|
16
|
+
When I go to list
|
17
|
+
And I follow "Add new post"
|
18
|
+
When I press "Save" within ".save"
|
19
|
+
Then I should see "Save did not succeed"
|
20
20
|
When I follow "Post"
|
@@ -1,7 +1,7 @@
|
|
1
|
-
Given /^I am lolita user$/ do
|
2
|
-
@profile = Profile.create
|
3
|
-
end
|
4
|
-
|
5
|
-
Then /^print output$/ do
|
6
|
-
save_and_open_page
|
7
|
-
end
|
1
|
+
Given /^I am lolita user$/ do
|
2
|
+
@profile = Profile.create
|
3
|
+
end
|
4
|
+
|
5
|
+
Then /^print output$/ do
|
6
|
+
save_and_open_page
|
7
|
+
end
|
@@ -1,219 +1,219 @@
|
|
1
|
-
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
-
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
-
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
-
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
-
# files.
|
6
|
-
|
7
|
-
|
8
|
-
require 'uri'
|
9
|
-
require 'cgi'
|
10
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
11
|
-
|
12
|
-
module WithinHelpers
|
13
|
-
def with_scope(locator)
|
14
|
-
locator ? within(locator) { yield } : yield
|
15
|
-
end
|
16
|
-
end
|
17
|
-
World(WithinHelpers)
|
18
|
-
|
19
|
-
Given /^(?:|I )am on (.+)$/ do |page_name|
|
20
|
-
visit path_to(page_name)
|
21
|
-
end
|
22
|
-
|
23
|
-
When /^(?:|I )go to (.+)$/ do |page_name|
|
24
|
-
visit path_to(page_name)
|
25
|
-
end
|
26
|
-
|
27
|
-
When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
|
28
|
-
with_scope(selector) do
|
29
|
-
click_button(button)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
|
34
|
-
with_scope(selector) do
|
35
|
-
click_link(link)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
|
40
|
-
with_scope(selector) do
|
41
|
-
fill_in(field, :with => value)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
|
46
|
-
with_scope(selector) do
|
47
|
-
fill_in(field, :with => value)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Use this to fill in an entire form with data from a table. Example:
|
52
|
-
#
|
53
|
-
# When I fill in the following:
|
54
|
-
# | Account Number | 5002 |
|
55
|
-
# | Expiry date | 2009-11-01 |
|
56
|
-
# | Note | Nice guy |
|
57
|
-
# | Wants Email? | |
|
58
|
-
#
|
59
|
-
# TODO: Add support for checkbox, select og option
|
60
|
-
# based on naming conventions.
|
61
|
-
#
|
62
|
-
When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields|
|
63
|
-
with_scope(selector) do
|
64
|
-
fields.rows_hash.each do |name, value|
|
65
|
-
When %{I fill in "#{name}" with "#{value}"}
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
|
71
|
-
with_scope(selector) do
|
72
|
-
select(value, :from => field)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
When /^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
77
|
-
with_scope(selector) do
|
78
|
-
check(field)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
When /^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
83
|
-
with_scope(selector) do
|
84
|
-
uncheck(field)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
89
|
-
with_scope(selector) do
|
90
|
-
choose(field)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector|
|
95
|
-
with_scope(selector) do
|
96
|
-
attach_file(field, path)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
Then /^(?:|I )should see JSON:$/ do |expected_json|
|
101
|
-
require 'json'
|
102
|
-
expected = JSON.pretty_generate(JSON.parse(expected_json))
|
103
|
-
actual = JSON.pretty_generate(JSON.parse(response.body))
|
104
|
-
expected.should == actual
|
105
|
-
end
|
106
|
-
|
107
|
-
Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
|
108
|
-
with_scope(selector) do
|
109
|
-
if page.respond_to? :should
|
110
|
-
page.should have_content(text)
|
111
|
-
else
|
112
|
-
assert page.has_content?(text)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
|
118
|
-
regexp = Regexp.new(regexp)
|
119
|
-
with_scope(selector) do
|
120
|
-
if page.respond_to? :should
|
121
|
-
page.should have_xpath('//*', :text => regexp)
|
122
|
-
else
|
123
|
-
assert page.has_xpath?('//*', :text => regexp)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
|
129
|
-
with_scope(selector) do
|
130
|
-
if page.respond_to? :should
|
131
|
-
page.should have_no_content(text)
|
132
|
-
else
|
133
|
-
assert page.has_no_content?(text)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
|
139
|
-
regexp = Regexp.new(regexp)
|
140
|
-
with_scope(selector) do
|
141
|
-
if page.respond_to? :should
|
142
|
-
page.should have_no_xpath('//*', :text => regexp)
|
143
|
-
else
|
144
|
-
assert page.has_no_xpath?('//*', :text => regexp)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |field, selector, value|
|
150
|
-
with_scope(selector) do
|
151
|
-
field = find_field(field)
|
152
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
153
|
-
if field_value.respond_to? :should
|
154
|
-
field_value.should =~ /#{value}/
|
155
|
-
else
|
156
|
-
assert_match(/#{value}/, field_value)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/ do |field, selector, value|
|
162
|
-
with_scope(selector) do
|
163
|
-
field = find_field(field)
|
164
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
165
|
-
if field_value.respond_to? :should_not
|
166
|
-
field_value.should_not =~ /#{value}/
|
167
|
-
else
|
168
|
-
assert_no_match(/#{value}/, field_value)
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector|
|
174
|
-
with_scope(selector) do
|
175
|
-
field_checked = find_field(label)['checked']
|
176
|
-
if field_checked.respond_to? :should
|
177
|
-
field_checked.should be_true
|
178
|
-
else
|
179
|
-
assert field_checked
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector|
|
185
|
-
with_scope(selector) do
|
186
|
-
field_checked = find_field(label)['checked']
|
187
|
-
if field_checked.respond_to? :should
|
188
|
-
field_checked.should be_false
|
189
|
-
else
|
190
|
-
assert !field_checked
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
196
|
-
current_path = URI.parse(current_url).path
|
197
|
-
if current_path.respond_to? :should
|
198
|
-
current_path.should == path_to(page_name)
|
199
|
-
else
|
200
|
-
assert_equal path_to(page_name), current_path
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
205
|
-
query = URI.parse(current_url).query
|
206
|
-
actual_params = query ? CGI.parse(query) : {}
|
207
|
-
expected_params = {}
|
208
|
-
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
209
|
-
|
210
|
-
if actual_params.respond_to? :should
|
211
|
-
actual_params.should == expected_params
|
212
|
-
else
|
213
|
-
assert_equal expected_params, actual_params
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
Then /^show me the page$/ do
|
218
|
-
save_and_open_page
|
219
|
-
end
|
1
|
+
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
+
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
+
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
+
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
+
# files.
|
6
|
+
|
7
|
+
|
8
|
+
require 'uri'
|
9
|
+
require 'cgi'
|
10
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
11
|
+
|
12
|
+
module WithinHelpers
|
13
|
+
def with_scope(locator)
|
14
|
+
locator ? within(locator) { yield } : yield
|
15
|
+
end
|
16
|
+
end
|
17
|
+
World(WithinHelpers)
|
18
|
+
|
19
|
+
Given /^(?:|I )am on (.+)$/ do |page_name|
|
20
|
+
visit path_to(page_name)
|
21
|
+
end
|
22
|
+
|
23
|
+
When /^(?:|I )go to (.+)$/ do |page_name|
|
24
|
+
visit path_to(page_name)
|
25
|
+
end
|
26
|
+
|
27
|
+
When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
|
28
|
+
with_scope(selector) do
|
29
|
+
click_button(button)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
|
34
|
+
with_scope(selector) do
|
35
|
+
click_link(link)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
|
40
|
+
with_scope(selector) do
|
41
|
+
fill_in(field, :with => value)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
|
46
|
+
with_scope(selector) do
|
47
|
+
fill_in(field, :with => value)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Use this to fill in an entire form with data from a table. Example:
|
52
|
+
#
|
53
|
+
# When I fill in the following:
|
54
|
+
# | Account Number | 5002 |
|
55
|
+
# | Expiry date | 2009-11-01 |
|
56
|
+
# | Note | Nice guy |
|
57
|
+
# | Wants Email? | |
|
58
|
+
#
|
59
|
+
# TODO: Add support for checkbox, select og option
|
60
|
+
# based on naming conventions.
|
61
|
+
#
|
62
|
+
When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields|
|
63
|
+
with_scope(selector) do
|
64
|
+
fields.rows_hash.each do |name, value|
|
65
|
+
When %{I fill in "#{name}" with "#{value}"}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
|
71
|
+
with_scope(selector) do
|
72
|
+
select(value, :from => field)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
When /^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
77
|
+
with_scope(selector) do
|
78
|
+
check(field)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
When /^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
83
|
+
with_scope(selector) do
|
84
|
+
uncheck(field)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
89
|
+
with_scope(selector) do
|
90
|
+
choose(field)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector|
|
95
|
+
with_scope(selector) do
|
96
|
+
attach_file(field, path)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
Then /^(?:|I )should see JSON:$/ do |expected_json|
|
101
|
+
require 'json'
|
102
|
+
expected = JSON.pretty_generate(JSON.parse(expected_json))
|
103
|
+
actual = JSON.pretty_generate(JSON.parse(response.body))
|
104
|
+
expected.should == actual
|
105
|
+
end
|
106
|
+
|
107
|
+
Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
|
108
|
+
with_scope(selector) do
|
109
|
+
if page.respond_to? :should
|
110
|
+
page.should have_content(text)
|
111
|
+
else
|
112
|
+
assert page.has_content?(text)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
|
118
|
+
regexp = Regexp.new(regexp)
|
119
|
+
with_scope(selector) do
|
120
|
+
if page.respond_to? :should
|
121
|
+
page.should have_xpath('//*', :text => regexp)
|
122
|
+
else
|
123
|
+
assert page.has_xpath?('//*', :text => regexp)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
|
129
|
+
with_scope(selector) do
|
130
|
+
if page.respond_to? :should
|
131
|
+
page.should have_no_content(text)
|
132
|
+
else
|
133
|
+
assert page.has_no_content?(text)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
|
139
|
+
regexp = Regexp.new(regexp)
|
140
|
+
with_scope(selector) do
|
141
|
+
if page.respond_to? :should
|
142
|
+
page.should have_no_xpath('//*', :text => regexp)
|
143
|
+
else
|
144
|
+
assert page.has_no_xpath?('//*', :text => regexp)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |field, selector, value|
|
150
|
+
with_scope(selector) do
|
151
|
+
field = find_field(field)
|
152
|
+
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
153
|
+
if field_value.respond_to? :should
|
154
|
+
field_value.should =~ /#{value}/
|
155
|
+
else
|
156
|
+
assert_match(/#{value}/, field_value)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/ do |field, selector, value|
|
162
|
+
with_scope(selector) do
|
163
|
+
field = find_field(field)
|
164
|
+
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
165
|
+
if field_value.respond_to? :should_not
|
166
|
+
field_value.should_not =~ /#{value}/
|
167
|
+
else
|
168
|
+
assert_no_match(/#{value}/, field_value)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector|
|
174
|
+
with_scope(selector) do
|
175
|
+
field_checked = find_field(label)['checked']
|
176
|
+
if field_checked.respond_to? :should
|
177
|
+
field_checked.should be_true
|
178
|
+
else
|
179
|
+
assert field_checked
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector|
|
185
|
+
with_scope(selector) do
|
186
|
+
field_checked = find_field(label)['checked']
|
187
|
+
if field_checked.respond_to? :should
|
188
|
+
field_checked.should be_false
|
189
|
+
else
|
190
|
+
assert !field_checked
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
196
|
+
current_path = URI.parse(current_url).path
|
197
|
+
if current_path.respond_to? :should
|
198
|
+
current_path.should == path_to(page_name)
|
199
|
+
else
|
200
|
+
assert_equal path_to(page_name), current_path
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
205
|
+
query = URI.parse(current_url).query
|
206
|
+
actual_params = query ? CGI.parse(query) : {}
|
207
|
+
expected_params = {}
|
208
|
+
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
209
|
+
|
210
|
+
if actual_params.respond_to? :should
|
211
|
+
actual_params.should == expected_params
|
212
|
+
else
|
213
|
+
assert_equal expected_params, actual_params
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
Then /^show me the page$/ do
|
218
|
+
save_and_open_page
|
219
|
+
end
|