starburst 0.9.1
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +12 -0
- data/app/assets/javascripts/starburst/application.js +13 -0
- data/app/assets/javascripts/starburst/starburst.js +19 -0
- data/app/assets/stylesheets/starburst/application.css +15 -0
- data/app/controllers/starburst/announcements_controller.rb +16 -0
- data/app/controllers/starburst/application_controller.rb +4 -0
- data/app/helpers/starburst/announcements_helper.rb +11 -0
- data/app/models/starburst/announcement.rb +53 -0
- data/app/models/starburst/announcement_view.rb +7 -0
- data/app/views/announcements/starburst/_announcement.html.erb +6 -0
- data/app/views/announcements/starburst/_announcement_bootstrap.html.erb +8 -0
- data/app/views/announcements/starburst/_announcement_foundation.html.erb +6 -0
- data/app/views/layouts/starburst/application.html.erb +14 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20141004214002_create_announcement_tables.rb +17 -0
- data/lib/helpers/starburst/configuration.rb +21 -0
- data/lib/starburst.rb +9 -0
- data/lib/starburst/engine.rb +13 -0
- data/lib/starburst/version.rb +3 -0
- data/lib/tasks/starburst_tasks.rake +4 -0
- data/spec/controllers/starburst/announcements_controller_spec.rb +34 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +6 -0
- data/spec/dummy/app/controllers/pages_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/user.rb +5 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/pages/home.html.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +23 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +82 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/devise.en.yml +60 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/20141004231338_create_users.rb +8 -0
- data/spec/dummy/db/schema.rb +39 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +1427 -0
- data/spec/dummy/log/test.log +27180 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/factories/announcements.rb +5 -0
- data/spec/factories/users.rb +5 -0
- data/spec/features/announcements_spec.rb +36 -0
- data/spec/models/starburst/announcement_spec.rb +155 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/support/wait_for_ajax.rb +15 -0
- metadata +274 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/404.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature 'Announcements' do
|
4
|
+
scenario 'show announcement to user' do
|
5
|
+
#@user = FactoryGirl.create(:user)
|
6
|
+
#login_as(@user, :scope => :user, :run_callbacks => false)
|
7
|
+
@current_user = FactoryGirl.create(:user)
|
8
|
+
ActionController::Base.any_instance.stub(:current_user).and_return(@current_user)
|
9
|
+
ActionView::Base.any_instance.stub(:current_user).and_return(@current_user)
|
10
|
+
announcement = FactoryGirl.create(:announcement, :body => "My announcement")
|
11
|
+
visit root_path
|
12
|
+
page.should have_content "My announcement"
|
13
|
+
end
|
14
|
+
scenario 'show no announcements if user not logged in' do
|
15
|
+
ActionController::Base.any_instance.stub(:current_user).and_return(nil)
|
16
|
+
ActionView::Base.any_instance.stub(:current_user).and_return(nil)
|
17
|
+
announcement = FactoryGirl.create(:announcement, :body => "My announcement")
|
18
|
+
visit root_path
|
19
|
+
page.should_not have_content "My announcement"
|
20
|
+
page.should have_content "Sample homepage"
|
21
|
+
end
|
22
|
+
scenario 'mark announcement as read then hide it from now on' do
|
23
|
+
pending
|
24
|
+
@user = FactoryGirl.create(:user)
|
25
|
+
login_as(@user, :scope => :user, :run_callbacks => false)
|
26
|
+
#ActionView::Base.any_instance.stub(:current_user).and_return(@current_user)
|
27
|
+
#ActionController::Base.any_instance.stub(:current_user).and_return(@current_user)
|
28
|
+
announcement = FactoryGirl.create(:announcement, :body => "My announcement")
|
29
|
+
visit root_path
|
30
|
+
page.should have_content "My announcement"
|
31
|
+
click_link "starburst-close"
|
32
|
+
wait_for_ajax
|
33
|
+
visit root_path
|
34
|
+
page.should_not have_content "My announcement"
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
require_relative "../../spec_helper"
|
2
|
+
|
3
|
+
module Starburst
|
4
|
+
|
5
|
+
describe Announcement do
|
6
|
+
|
7
|
+
context "a basic announcement" do
|
8
|
+
|
9
|
+
it "can be created with just a body" do
|
10
|
+
expect(Announcement.create(:body => "This is an announcement.")).to be_valid
|
11
|
+
end
|
12
|
+
|
13
|
+
it "can be created with just a title" do
|
14
|
+
expect(Announcement.create(:body => "This is an announcement.", :title => "Test title")).to be_valid
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
context "a scheduled annoucement" do
|
20
|
+
|
21
|
+
it "does not show up past its end date" do
|
22
|
+
Announcement.create(:stop_delivering_at => 1.day.ago)
|
23
|
+
expect(Announcement.current.blank?).to eq true
|
24
|
+
end
|
25
|
+
|
26
|
+
it "shows before its end date" do
|
27
|
+
Announcement.create(:stop_delivering_at => Date.today + 1.day)
|
28
|
+
expect(Announcement.current.present?).to eq true
|
29
|
+
end
|
30
|
+
|
31
|
+
it "does not show up before its start date" do
|
32
|
+
Announcement.create(:start_delivering_at => Date.today + 1.day)
|
33
|
+
expect(Announcement.current.blank?).to eq true
|
34
|
+
end
|
35
|
+
|
36
|
+
it "shows after its start date" do
|
37
|
+
Announcement.create(:start_delivering_at => 1.day.ago)
|
38
|
+
expect(Announcement.current.present?).to eq true
|
39
|
+
end
|
40
|
+
|
41
|
+
it "shows up between its start and end dates" do
|
42
|
+
Announcement.create(:start_delivering_at => Date.today, :stop_delivering_at => Date.today + 1)
|
43
|
+
expect(Announcement.current.present?).to eq true
|
44
|
+
end
|
45
|
+
|
46
|
+
it "does not show when its start and end dates are the same" do
|
47
|
+
Announcement.create(:start_delivering_at => Date.today, :stop_delivering_at => Date.today)
|
48
|
+
expect(Announcement.current.blank?).to eq true
|
49
|
+
end
|
50
|
+
|
51
|
+
it "does not show when its start and end dates are the same" do
|
52
|
+
Announcement.create(:start_delivering_at => Date.today, :stop_delivering_at => Date.today)
|
53
|
+
expect(Announcement.current.blank?).to eq true
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
context "an announcement not yet read by the current user" do
|
59
|
+
|
60
|
+
it "shows up" do
|
61
|
+
read_announcement = Announcement.create(:start_delivering_at => 1.day.ago)
|
62
|
+
unread_announcement = Announcement.create(:start_delivering_at => Date.today)
|
63
|
+
user_who_read_announcement = FactoryGirl.create(:user)
|
64
|
+
AnnouncementView.create(:announcement => read_announcement, :user => user_who_read_announcement)
|
65
|
+
expect(Announcement.unread_by(user_who_read_announcement)).to eq [unread_announcement]
|
66
|
+
end
|
67
|
+
|
68
|
+
it "shows up for the current user even when others have read it" do
|
69
|
+
read_announcement = Announcement.create(:start_delivering_at => 1.day.ago)
|
70
|
+
unread_announcement = Announcement.create(:start_delivering_at => Date.today)
|
71
|
+
user_who_read_announcement = FactoryGirl.create(:user)
|
72
|
+
user_who_read_no_announcements = FactoryGirl.create(:user)
|
73
|
+
AnnouncementView.create(:announcement => read_announcement, :user => user_who_read_announcement)
|
74
|
+
expect(Announcement.unread_by(user_who_read_no_announcements)).to include(unread_announcement, read_announcement)
|
75
|
+
end
|
76
|
+
|
77
|
+
it "shows up for the current user even when they have read other announcements" do
|
78
|
+
read_announcement = Announcement.create(:start_delivering_at => 1.day.ago)
|
79
|
+
unread_announcement = Announcement.create(:start_delivering_at => Date.today)
|
80
|
+
user_who_read_announcement = FactoryGirl.create(:user)
|
81
|
+
AnnouncementView.create(:announcement => read_announcement, :user => user_who_read_announcement)
|
82
|
+
expect(Starburst::Announcement.current(user_who_read_announcement)).to eq unread_announcement
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
context "an announcement targeted to certain users" do
|
89
|
+
it "has a limited_to_users field that is retrieveable from the database" do
|
90
|
+
limited_announcement = Announcement.create(:limit_to_users => [
|
91
|
+
{
|
92
|
+
:field => "subscription",
|
93
|
+
:value => "",
|
94
|
+
:operator => "="
|
95
|
+
}
|
96
|
+
])
|
97
|
+
expect(limited_announcement.limit_to_users[0][:field]).to eq "subscription"
|
98
|
+
end
|
99
|
+
|
100
|
+
it "shows up for the proper user only (one positive condition)" do
|
101
|
+
limited_announcement = Announcement.create(:limit_to_users => [
|
102
|
+
{
|
103
|
+
:field => "subscription",
|
104
|
+
:value => ""
|
105
|
+
}
|
106
|
+
])
|
107
|
+
user_who_should_see_announcement = FactoryGirl.create(:user, :subscription => "")
|
108
|
+
user_who_should_not_see_announcement = FactoryGirl.create(:user, :subscription => "monthly")
|
109
|
+
expect(Announcement.find_announcement_for_current_user(Announcement.where(nil), user_who_should_see_announcement)).to eq limited_announcement
|
110
|
+
expect(Announcement.find_announcement_for_current_user(Announcement.where(nil), user_who_should_not_see_announcement)).to eq nil
|
111
|
+
end
|
112
|
+
|
113
|
+
it "shows up for the proper user only (method condition)" do
|
114
|
+
Starburst.user_instance_methods = ["free?"]
|
115
|
+
limited_announcement = Announcement.create(:limit_to_users => [
|
116
|
+
{
|
117
|
+
:field => "free?",
|
118
|
+
:value => true
|
119
|
+
}
|
120
|
+
])
|
121
|
+
user_who_should_see_announcement = FactoryGirl.create(:user, :subscription => "")
|
122
|
+
user_who_should_not_see_announcement = FactoryGirl.create(:user, :subscription => "monthly")
|
123
|
+
expect(Announcement.find_announcement_for_current_user(Announcement.where(nil), user_who_should_see_announcement)).to eq limited_announcement
|
124
|
+
expect(Announcement.find_announcement_for_current_user(Announcement.where(nil), user_who_should_not_see_announcement)).to eq nil
|
125
|
+
end
|
126
|
+
|
127
|
+
# it "performs" do
|
128
|
+
# pending
|
129
|
+
# require 'benchmark'
|
130
|
+
|
131
|
+
# (1 .. 500).each do
|
132
|
+
# Announcement.create(:limit_to_users => [
|
133
|
+
# {
|
134
|
+
# :field => "subscription",
|
135
|
+
# :value => ""
|
136
|
+
# }
|
137
|
+
# ])
|
138
|
+
# end
|
139
|
+
|
140
|
+
# (1 .. 10000).each do
|
141
|
+
# create(:user, :subscription => "")
|
142
|
+
# end
|
143
|
+
|
144
|
+
# Benchmark.realtime{
|
145
|
+
# Announcement.current(User.last)
|
146
|
+
# }
|
147
|
+
# end
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# http://viget.com/extend/rails-engine-testing-with-rspec-capybara-and-factorygirl
|
2
|
+
ENV['RAILS_ENV'] ||= 'test'
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require 'rspec/rails'
|
6
|
+
require 'rspec/autorun'
|
7
|
+
require 'factory_girl_rails'
|
8
|
+
require 'capybara'
|
9
|
+
|
10
|
+
Rails.backtrace_cleaner.remove_silencers!
|
11
|
+
|
12
|
+
# Load support files
|
13
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.mock_with :rspec
|
17
|
+
config.use_transactional_fixtures = true
|
18
|
+
config.infer_base_class_for_anonymous_controllers = false
|
19
|
+
config.order = "random"
|
20
|
+
end
|
21
|
+
|
22
|
+
Capybara.javascript_driver = :selenium
|