date_book 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -1
- data/.rubocop_todo.yml +2 -1
- data/.travis.yml +3 -0
- data/Gemfile +16 -4
- data/Gemfile.lock +14 -2
- data/VERSION +1 -1
- data/app/assets/javascripts/date_book/calendar_events.js +3 -3
- data/app/assets/stylesheets/date_book.css.scss +31 -2
- data/app/controllers/date_book/calendars_controller.rb +30 -19
- data/app/controllers/date_book/date_book_controller.rb +1 -1
- data/app/controllers/date_book/events_controller.rb +60 -62
- data/app/controllers/date_book/graphql_controller.rb +10 -11
- data/app/graphql/date_book_schema.rb +4 -4
- data/app/graphql/types/calendar_type.rb +4 -2
- data/app/graphql/types/date_time_type.rb +9 -5
- data/app/graphql/types/event_occurrence_type.rb +4 -2
- data/app/graphql/types/event_type.rb +4 -2
- data/app/graphql/types/mutation_type.rb +3 -1
- data/app/graphql/types/query_type.rb +12 -26
- data/app/helpers/date_book/application_helper.rb +4 -7
- data/app/helpers/date_book/events_helper.rb +43 -23
- data/app/views/date_book/application/_date_range.html.haml +3 -3
- data/app/views/date_book/calendars/index.html.haml +19 -3
- data/app/views/date_book/calendars/show.html.haml +29 -4
- data/app/views/date_book/events/_event.json.jbuilder +3 -1
- data/app/views/date_book/events/_form.html.haml +4 -4
- data/app/views/date_book/events/_occurrence_dates.html.haml +3 -3
- data/app/views/date_book/events/fields/_date.html.haml +1 -1
- data/app/views/date_book/events/fields/_day.html.haml +1 -1
- data/app/views/date_book/events/fields/_day_of_week.html.haml +3 -3
- data/app/views/date_book/events/fields/_duration.html.haml +3 -3
- data/app/views/date_book/events/fields/_interval.html.haml +1 -1
- data/app/views/date_book/events/fields/_time.html.haml +1 -1
- data/app/views/date_book/events/index.html.haml +1 -1
- data/app/views/date_book/events/rules/_daily.html.haml +3 -3
- data/app/views/date_book/events/rules/_monthly.html.haml +4 -4
- data/app/views/date_book/events/rules/_singular.html.haml +3 -3
- data/app/views/date_book/events/rules/_weekly.html.haml +4 -4
- data/app/views/date_book/events/show.html.haml +1 -1
- data/app/views/layouts/_date_book_scripts.html.haml +2 -4
- data/config/locales/en.yml +2 -0
- data/config/routes.rb +1 -1
- data/date_book.gemspec +25 -22
- data/db/migrate/20170807133845_create_calendars.rb +3 -0
- data/db/migrate/20170807133846_create_events.rb +3 -0
- data/db/migrate/20170807133847_create_schedules.rb +9 -6
- data/db/migrate/20170807133848_add_fields_to_schedule.rb +3 -0
- data/db/migrate/20170807133849_create_event_occurrences.rb +4 -3
- data/db/migrate/20170807133850_add_fields_to_event_occurrences.rb +3 -0
- data/lib/date_book.rb +11 -2
- data/lib/date_book/concerns/ability.rb +9 -12
- data/lib/date_book/concerns/acts_as_calendar.rb +5 -6
- data/lib/date_book/concerns/acts_as_event.rb +30 -9
- data/lib/date_book/concerns/acts_as_event_occurrence.rb +21 -9
- data/lib/date_book/concerns/acts_as_ownable.rb +9 -3
- data/lib/date_book/concerns/acts_as_owner.rb +5 -6
- data/lib/date_book/concerns/acts_as_schedule.rb +14 -7
- data/lib/date_book/configuration.rb +14 -11
- data/lib/date_book/engine.rb +7 -5
- data/lib/date_book/version.rb +2 -0
- data/lib/generators/date_book/install/install_generator.rb +27 -29
- data/lib/generators/date_book/install/templates/app/models/calendar.rb +4 -1
- data/lib/generators/date_book/install/templates/app/models/event.rb +4 -1
- data/lib/generators/date_book/install/templates/app/models/event_occurrence.rb +4 -1
- data/lib/generators/date_book/install/templates/app/models/schedule.rb +4 -1
- data/spec/abilities/event_spec.rb +1 -1
- data/spec/controllers/date_book/calendars_controller_spec.rb +48 -20
- data/spec/controllers/date_book/events_controller_spec.rb +145 -39
- data/spec/dummy/app/models/calendar.rb +3 -1
- data/spec/dummy/app/models/event.rb +3 -1
- data/spec/dummy/app/models/event_occurrence.rb +3 -1
- data/spec/dummy/app/models/role.rb +7 -5
- data/spec/dummy/app/models/schedule.rb +3 -1
- data/spec/dummy/app/models/user.rb +3 -3
- data/spec/dummy/config/initializers/devise.rb +61 -40
- data/spec/dummy/config/initializers/high_voltage.rb +2 -0
- data/spec/dummy/config/initializers/rolify.rb +5 -2
- data/spec/dummy/config/routes.rb +6 -9
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20170728171103_create_users_table.rb +2 -0
- data/spec/dummy/db/migrate/20170807134122_add_devise_to_users.rb +4 -3
- data/spec/dummy/db/migrate/20170807134128_rolify_create_roles.rb +6 -4
- data/spec/dummy/db/migrate/{20170808150915_create_calendars.date_book.rb → 20170808200808_create_calendars.date_book.rb} +3 -0
- data/spec/dummy/db/migrate/{20170808150916_create_events.date_book.rb → 20170808200809_create_events.date_book.rb} +3 -0
- data/spec/dummy/db/migrate/{20170808150917_create_schedules.date_book.rb → 20170808200810_create_schedules.date_book.rb} +9 -6
- data/spec/dummy/db/migrate/{20170808150918_add_fields_to_schedule.date_book.rb → 20170808200811_add_fields_to_schedule.date_book.rb} +3 -0
- data/spec/dummy/db/migrate/{20170808150919_create_event_occurrences.date_book.rb → 20170808200812_create_event_occurrences.date_book.rb} +4 -3
- data/spec/dummy/db/migrate/{20170808150920_add_fields_to_event_occurrences.date_book.rb → 20170808200813_add_fields_to_event_occurrences.date_book.rb} +3 -0
- data/spec/dummy/db/schema.rb +1 -1
- data/spec/dummy/db/seeds/calendars.seeds.rb +2 -1
- data/spec/dummy/db/seeds/events.seeds.rb +5 -5
- data/spec/dummy/db/seeds/users.seeds.rb +3 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/basic_benchmark.rb +2 -0
- data/spec/factories/calendars.rb +2 -0
- data/spec/factories/events.rb +2 -0
- data/spec/factories/roles.rb +2 -1
- data/spec/factories/users.rb +2 -0
- data/spec/features/calendars_spec.rb +47 -5
- data/spec/features/events_spec.rb +35 -9
- data/spec/helpers/date_book/application_helper_spec.rb +32 -0
- data/spec/helpers/date_book/events_helper_spec.rb +181 -13
- data/spec/models/calendar_spec.rb +3 -1
- data/spec/models/event_spec.rb +3 -1
- data/spec/models/role_spec.rb +1 -0
- data/spec/rails_helper.rb +6 -1
- data/spec/requests/date_book/api_spec.rb +76 -0
- data/spec/routing/date_book/calendars_routing_spec.rb +4 -2
- data/spec/routing/date_book/events_routing_spec.rb +48 -11
- data/spec/support/controller_behaviors.rb +2 -0
- data/spec/support/controller_macros.rb +3 -1
- data/spec/support/factory_girl.rb +2 -0
- data/spec/support/feature_behaviors.rb +9 -9
- data/spec/support/loaded_site.rb +2 -0
- data/spec/support/loaded_site/calendars.rb +2 -0
- data/spec/support/loaded_site/events.rb +3 -1
- data/spec/support/loaded_site/users.rb +2 -0
- data/spec/support/request_behaviors.rb +12 -63
- data/spec/support/shared_connection.rb +2 -0
- data/spec/support/utilities.rb +6 -5
- metadata +79 -42
- data/app/graphql/types/profile_type.rb +0 -7
- data/app/helpers/date_book/calendar_helper.rb +0 -4
- data/app/views/date_book/application/_all_day_checkbox.html.haml +0 -1
- data/bin/rails +0 -15
- data/spec/helpers/date_book/calendar_helper_spec.rb +0 -17
- data/spec/requests/date_book/events_spec.rb +0 -56
data/spec/models/event_spec.rb
CHANGED
data/spec/models/role_spec.rb
CHANGED
data/spec/rails_helper.rb
CHANGED
@@ -66,7 +66,12 @@ RSpec.configure do |config|
|
|
66
66
|
|
67
67
|
config.include Rails.application.routes.url_helpers
|
68
68
|
|
69
|
-
|
69
|
+
# Capybara doesn't work on helpers
|
70
|
+
config.include RSpecHtmlMatchers, type: :helper
|
71
|
+
|
72
|
+
config.before :each, type: :helper do
|
73
|
+
helper.class.include DateBook::Engine.routes.url_helpers
|
74
|
+
end
|
70
75
|
|
71
76
|
# In order to tell Rspec how to use Devise, as per
|
72
77
|
# https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-3-and-4-%28and-RSpec%29
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_helper'
|
4
|
+
|
5
|
+
RSpec.describe 'DateBook API', folder: :requests do
|
6
|
+
include_context 'loaded site'
|
7
|
+
|
8
|
+
let(:calendar_query) do
|
9
|
+
{ query: '
|
10
|
+
{
|
11
|
+
calendar(slug: "regular-calendar") {
|
12
|
+
event_occurrences {
|
13
|
+
url,
|
14
|
+
popover_url,
|
15
|
+
start,
|
16
|
+
end,
|
17
|
+
event {
|
18
|
+
id,
|
19
|
+
name,
|
20
|
+
css_class,
|
21
|
+
text_color,
|
22
|
+
background_color,
|
23
|
+
border_color,
|
24
|
+
all_day
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
' }
|
30
|
+
end
|
31
|
+
|
32
|
+
let(:event_occurrences_query) do
|
33
|
+
{ query: '
|
34
|
+
{
|
35
|
+
event_occurrences {
|
36
|
+
url,
|
37
|
+
popover_url,
|
38
|
+
start,
|
39
|
+
end,
|
40
|
+
event {
|
41
|
+
id,
|
42
|
+
name,
|
43
|
+
css_class,
|
44
|
+
text_color,
|
45
|
+
background_color,
|
46
|
+
border_color,
|
47
|
+
all_day
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
' }
|
52
|
+
end
|
53
|
+
|
54
|
+
describe 'Browsing Events' do
|
55
|
+
describe 'at /date_book/api' do
|
56
|
+
describe 'with a global query' do
|
57
|
+
before do
|
58
|
+
post '/date_book/api.json', params: event_occurrences_query
|
59
|
+
end
|
60
|
+
it_behaves_like(
|
61
|
+
'a graphql object listing a collection of items',
|
62
|
+
EventOccurrence
|
63
|
+
)
|
64
|
+
end
|
65
|
+
describe 'with a calendar query' do
|
66
|
+
before do
|
67
|
+
post '/date_book/api.json', params: calendar_query
|
68
|
+
end
|
69
|
+
it_behaves_like(
|
70
|
+
'a graphql object showing an item',
|
71
|
+
Calendar
|
72
|
+
)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rails_helper'
|
2
4
|
|
3
5
|
module DateBook
|
@@ -6,8 +8,8 @@ module DateBook
|
|
6
8
|
|
7
9
|
describe 'Routing' do
|
8
10
|
it 'routes to #index' do
|
9
|
-
expect(get: '/calendars')
|
10
|
-
to route_to(controller: 'date_book/calendars', action: 'index')
|
11
|
+
expect(get: '/calendars')
|
12
|
+
.to route_to(controller: 'date_book/calendars', action: 'index')
|
11
13
|
end
|
12
14
|
|
13
15
|
it 'routes to #new' do
|
@@ -1,53 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rails_helper'
|
2
4
|
|
3
5
|
module DateBook
|
4
|
-
RSpec.describe EventsController,
|
6
|
+
RSpec.describe EventsController,
|
7
|
+
folder: :routing do
|
5
8
|
routes { DateBook::Engine.routes }
|
6
9
|
|
7
10
|
describe 'Routing' do
|
8
11
|
it 'routes to #index' do
|
9
|
-
expect(get: '/calendars/calendar-slug/events')
|
10
|
-
to route_to(
|
12
|
+
expect(get: '/calendars/calendar-slug/events')
|
13
|
+
.to route_to(
|
14
|
+
controller: 'date_book/events',
|
15
|
+
action: 'index',
|
16
|
+
calendar_id: 'calendar-slug'
|
17
|
+
)
|
11
18
|
end
|
12
19
|
|
13
20
|
it 'routes to #new' do
|
14
21
|
expect(get: '/calendars/calendar-slug/events/new')
|
15
|
-
.to route_to(
|
22
|
+
.to route_to(
|
23
|
+
'date_book/events#new',
|
24
|
+
calendar_id: 'calendar-slug'
|
25
|
+
)
|
16
26
|
end
|
17
27
|
|
18
28
|
it 'routes to #show' do
|
19
29
|
expect(get: '/calendars/calendar-slug/events/slug')
|
20
|
-
.to route_to(
|
30
|
+
.to route_to(
|
31
|
+
'date_book/events#show',
|
32
|
+
id: 'slug',
|
33
|
+
calendar_id: 'calendar-slug'
|
34
|
+
)
|
21
35
|
end
|
22
36
|
|
23
37
|
it 'routes to #popover' do
|
24
38
|
expect(get: '/calendars/calendar-slug/events/slug/popover')
|
25
|
-
.to route_to(
|
39
|
+
.to route_to(
|
40
|
+
'date_book/events#popover',
|
41
|
+
id: 'slug',
|
42
|
+
calendar_id: 'calendar-slug'
|
43
|
+
)
|
26
44
|
end
|
27
45
|
|
28
46
|
it 'routes to #edit' do
|
29
47
|
expect(get: '/calendars/calendar-slug/events/slug/edit')
|
30
|
-
.to route_to(
|
48
|
+
.to route_to(
|
49
|
+
'date_book/events#edit',
|
50
|
+
id: 'slug',
|
51
|
+
calendar_id: 'calendar-slug'
|
52
|
+
)
|
31
53
|
end
|
32
54
|
|
33
55
|
it 'routes to #create' do
|
34
56
|
expect(post: '/calendars/calendar-slug/events')
|
35
|
-
.to route_to(
|
57
|
+
.to route_to(
|
58
|
+
'date_book/events#create',
|
59
|
+
calendar_id: 'calendar-slug'
|
60
|
+
)
|
36
61
|
end
|
37
62
|
|
38
63
|
it 'routes to #update via PUT' do
|
39
64
|
expect(put: '/calendars/calendar-slug/events/slug')
|
40
|
-
.to route_to(
|
65
|
+
.to route_to(
|
66
|
+
'date_book/events#update',
|
67
|
+
id: 'slug',
|
68
|
+
calendar_id: 'calendar-slug'
|
69
|
+
)
|
41
70
|
end
|
42
71
|
|
43
72
|
it 'routes to #update via PATCH' do
|
44
73
|
expect(patch: '/calendars/calendar-slug/events/slug')
|
45
|
-
.to route_to(
|
74
|
+
.to route_to(
|
75
|
+
'date_book/events#update',
|
76
|
+
id: 'slug',
|
77
|
+
calendar_id: 'calendar-slug'
|
78
|
+
)
|
46
79
|
end
|
47
80
|
|
48
81
|
it 'routes to #destroy' do
|
49
82
|
expect(delete: '/calendars/calendar-slug/events/slug')
|
50
|
-
.to route_to(
|
83
|
+
.to route_to(
|
84
|
+
'date_book/events#destroy',
|
85
|
+
id: 'slug',
|
86
|
+
calendar_id: 'calendar-slug'
|
87
|
+
)
|
51
88
|
end
|
52
89
|
end
|
53
90
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ControllerMacros
|
2
4
|
def login_user(user)
|
3
5
|
@request.env['devise.mapping'] = Devise.mappings[:user]
|
@@ -9,7 +11,7 @@ shared_context 'authentication for routes' do
|
|
9
11
|
let(:warden) do
|
10
12
|
instance_double('Warden::Proxy').tap do |warden|
|
11
13
|
allow(warden).to receive(:authenticate?).with(scope: :user)
|
12
|
-
|
14
|
+
.and_return(authenticated?)
|
13
15
|
allow(warden).to receive(:user).with(:user).and_return(user)
|
14
16
|
end
|
15
17
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
shared_examples_for 'a restricted page' do
|
2
4
|
describe 'redirects to the home page' do
|
3
5
|
subject { current_path }
|
@@ -65,15 +67,13 @@ shared_examples_for 'a bootstrap page '\
|
|
65
67
|
)
|
66
68
|
end
|
67
69
|
end
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
expect(page).to have_link(link_text)
|
76
|
-
end
|
70
|
+
options[:links]&.each do |link_text|
|
71
|
+
it "has a #{link_text} link" do
|
72
|
+
click_link_or_button 'Menu'
|
73
|
+
within find('.navbar', text: options[:text]) do
|
74
|
+
click_link_or_button options[:text]
|
75
|
+
within first('li.dropdown', text: options[:text]) do
|
76
|
+
expect(page).to have_link(link_text)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
data/spec/support/loaded_site.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
shared_context 'events' do
|
2
4
|
let(:monday_event) { Event.friendly.find('monday') }
|
3
|
-
let(:
|
5
|
+
let(:science_fiction_club) { Event.friendly.find('science-fiction-club') }
|
4
6
|
let(:yesterdays_event) { Event.friendly.find('yesterday-s-event') }
|
5
7
|
let(:tomorrows_event) { Event.friendly.find('tomorrow-s-event') }
|
6
8
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
shared_examples_for 'a Json authentication error' do
|
2
4
|
it_behaves_like(
|
3
5
|
'a json object with an error',
|
@@ -19,71 +21,18 @@ shared_examples_for 'a blank response' do
|
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
22
|
-
shared_examples_for 'a
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
shared_examples_for 'a json object' do |options = {}|
|
30
|
-
describe 'displays an object with information about itself' do
|
31
|
-
subject { JSON.parse(response.body) }
|
32
|
-
its(['title']) { should eq options[:title] }
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
shared_examples_for 'a json object with a message' do |key, text|
|
37
|
-
subject { JSON.parse(response.body) }
|
38
|
-
its([key.to_s]) { should match(/#{text}/) }
|
39
|
-
end
|
40
|
-
|
41
|
-
shared_examples_for 'a json object without a message' do |key|
|
42
|
-
subject { JSON.parse(response.body) }
|
43
|
-
its([key.to_s]) { should be nil }
|
44
|
-
end
|
45
|
-
|
46
|
-
shared_examples_for 'a json object with an error' do |text|
|
47
|
-
it_behaves_like 'a json object with a message', :error, text
|
48
|
-
it_behaves_like 'a json object without a message', :info
|
49
|
-
it_behaves_like 'a json object without a message', :notice
|
50
|
-
end
|
51
|
-
|
52
|
-
shared_examples_for 'a json object with a notice' do |text|
|
53
|
-
it_behaves_like 'a json object with a message', :notice, text
|
54
|
-
it_behaves_like 'a json object without a message', :error
|
55
|
-
it_behaves_like 'a json object without a message', :info
|
56
|
-
end
|
57
|
-
|
58
|
-
shared_examples_for 'a json object with info' do |text|
|
59
|
-
it_behaves_like 'a json object with a message', :info, text
|
60
|
-
it_behaves_like 'a json object without a message', :error
|
61
|
-
it_behaves_like 'a json object without a message', :notice
|
62
|
-
end
|
63
|
-
|
64
|
-
shared_examples_for 'a json object '\
|
65
|
-
'listing a collection of items' do |object, options = {}|
|
66
|
-
options[:minimum] ||= 1
|
67
|
-
options[:plural_name] ||= object.table_name.to_s
|
68
|
-
objects_key = options[:plural_name].to_sym
|
69
|
-
it_behaves_like 'a json array'
|
70
|
-
describe "displays a list of #{objects_key}" do
|
71
|
-
subject { JSON.parse(response.body) }
|
72
|
-
its(:count) { should >= options[:minimum] }
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
shared_examples_for 'a json object '\
|
77
|
-
'showing an item' do |object, title, options = {}|
|
78
|
-
describe "displays an item" do
|
79
|
-
subject { JSON.parse(response.body) }
|
80
|
-
its(['title']) { should eq title }
|
24
|
+
shared_examples_for 'a graphql object '\
|
25
|
+
'showing an item' do |object|
|
26
|
+
describe 'displays an item' do
|
27
|
+
subject { JSON.parse(response.body)['data'][object.table_name.singularize] }
|
28
|
+
it { should be_a Hash }
|
81
29
|
end
|
82
30
|
end
|
83
31
|
|
84
|
-
shared_examples_for 'a
|
85
|
-
|
86
|
-
|
87
|
-
|
32
|
+
shared_examples_for 'a graphql object '\
|
33
|
+
'listing a collection of items' do |object|
|
34
|
+
describe 'displays a collection of items' do
|
35
|
+
subject { JSON.parse(response.body)['data'][object.table_name] }
|
36
|
+
it { should be_an Array }
|
88
37
|
end
|
89
38
|
end
|
data/spec/support/utilities.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
def path_to_url(path)
|
2
4
|
protocol = request.protocol
|
3
5
|
host = request.host_with_port.sub(/:80$/, '')
|
@@ -17,10 +19,9 @@ def wait_until(delay = 1)
|
|
17
19
|
sleep delay
|
18
20
|
seconds_waited += 1
|
19
21
|
end
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
22
|
+
return if yield
|
23
|
+
puts "Waited for #{Capybara.default_max_wait_time} seconds."
|
24
|
+
puts "{#{yield}} did not become true, continuing."
|
24
25
|
end
|
25
26
|
|
26
27
|
def submit_via_execute(form_selector)
|
@@ -36,7 +37,7 @@ end
|
|
36
37
|
def fill_in_wysiwyg(locator, text)
|
37
38
|
include ActionView::Helpers::JavaScriptHelper
|
38
39
|
locator = find_field_by_label(locator)
|
39
|
-
text = text.
|
40
|
+
text = text.tr("'", "\'").gsub("\n", '\\\n')
|
40
41
|
|
41
42
|
# Fill the editor content
|
42
43
|
page.execute_script <<-SCRIPT
|