paul_revere 1.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +16 -2
- data/MIT-LICENSE +1 -1
- data/NEWS.md +8 -0
- data/README.md +47 -49
- data/Rakefile +12 -9
- data/app/assets/javascripts/announcements.js +22 -8
- data/app/helpers/announcements_helper.rb +10 -2
- data/app/models/announcement.rb +5 -1
- data/app/views/announcements/_private_announcement.html.erb +3 -0
- data/app/views/announcements/_public_announcement.html.erb +8 -0
- data/gemfiles/rails_4.0.0.gemfile +1 -1
- data/gemfiles/rails_4.1.0.gemfile +1 -1
- data/gemfiles/rails_4.2.0.gemfile +1 -1
- data/lib/generators/paul_revere/paul_revere_generator.rb +6 -10
- data/lib/generators/paul_revere/templates/migration.rb +2 -6
- data/lib/paul_revere.rb +1 -1
- data/lib/paul_revere/version.rb +1 -1
- data/paul_revere.gemspec +17 -15
- data/spec/factories.rb +5 -0
- data/spec/fake_app.rb +5 -1
- data/spec/helpers/announcements_helper_spec.rb +75 -23
- data/spec/javascripts/announcements_spec.js +10 -0
- data/spec/javascripts/helpers/.gitkeep +0 -0
- data/spec/javascripts/support/jasmine.yml +10 -0
- data/spec/javascripts/support/jquery-2.1.3.min.js +4 -0
- data/spec/lib/generators/paul_revere/paul_revere_generator_spec.rb +14 -2
- data/spec/models/announcement_spec.rb +11 -16
- data/spec/paul_revere_spec.rb +1 -1
- data/spec/rails_helper.rb +4 -0
- data/spec/views/announcements/_email_announcement.erb_spec.rb +1 -1
- data/spec/views/announcements/_private_announcement.html.erb_spec.rb +21 -0
- data/spec/views/announcements/_public_announcement.html.erb_spec.rb +20 -0
- metadata +55 -12
- data/app/views/announcements/_announcement.html.erb +0 -1
- data/app/views/announcements/_announcement_for_all.html.erb +0 -8
- data/lib/generators/paul_revere/USAGE +0 -9
- data/shoulda_macros/announcement.rb +0 -18
- data/spec/views/announcements/_announcement.html.erb_spec.rb +0 -29
- data/spec/views/announcements/_announcement_for_all.html.erb_spec.rb +0 -26
@@ -1 +0,0 @@
|
|
1
|
-
<%= render 'announcements/announcement_for_all' if current_user %>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<% if current_announcement.exists? && !announcement_hidden?(current_announcement) %>
|
2
|
-
<div id="announcement">
|
3
|
-
<span><%= current_announcement.body.html_safe %></span>
|
4
|
-
<span class="hide">
|
5
|
-
<%= link_to "hide", "#", onclick: "hideAnnouncement('announcement_#{current_announcement.created_at.iso8601}')" %>
|
6
|
-
</span>
|
7
|
-
</div>
|
8
|
-
<% end %>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
class ActiveSupport::TestCase
|
2
|
-
|
3
|
-
def self.with_current_announcement(&blk)
|
4
|
-
context "When there is a current announcement" do
|
5
|
-
setup do
|
6
|
-
Annoucement.create!(:body => 'therefore,')
|
7
|
-
end
|
8
|
-
merge_block(&blk)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.should_display_current_announcement
|
13
|
-
should "have the current announcement in it" do
|
14
|
-
assert_match Announcement.current.body, @email.body
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
class User; end
|
4
|
-
|
5
|
-
module ApplicationHelper
|
6
|
-
def current_user
|
7
|
-
raise
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "announcements/_announcement" do
|
12
|
-
before(:example) do
|
13
|
-
stub_template "announcements/_announcement_for_all.html.erb" => "Partial"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "renders the all partial when there is a user" do
|
17
|
-
allow(view).to receive(:current_user).and_return(User.new)
|
18
|
-
render
|
19
|
-
|
20
|
-
expect(rendered).to match /Partial/
|
21
|
-
end
|
22
|
-
|
23
|
-
it "does not render the all partial when there is not a user" do
|
24
|
-
allow(view).to receive(:current_user).and_return(nil)
|
25
|
-
render
|
26
|
-
|
27
|
-
expect(rendered).to eq "\n"
|
28
|
-
end
|
29
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require "rails_helper"
|
2
|
-
|
3
|
-
describe "announcements/_announcement_for_all" do
|
4
|
-
it "renders nothing when announcement does not exist" do
|
5
|
-
expect(Announcement.count).to eq 0
|
6
|
-
render
|
7
|
-
|
8
|
-
expect(rendered).to eq ""
|
9
|
-
end
|
10
|
-
|
11
|
-
it "renders nothing when an Announcement exists but is hidden" do
|
12
|
-
Announcement.create!(body: "Test")
|
13
|
-
allow(view).to receive(:announcement_hidden?).and_return(true)
|
14
|
-
render
|
15
|
-
|
16
|
-
expect(rendered).to eq ""
|
17
|
-
end
|
18
|
-
|
19
|
-
it "renders the announcement when an Announcement exists and is not hidden" do
|
20
|
-
announcement = Announcement.create!(body: "Test")
|
21
|
-
render
|
22
|
-
|
23
|
-
expect(rendered).to match /Test/
|
24
|
-
expect(rendered).to match /announcement_#{announcement.created_at.iso8601}/
|
25
|
-
end
|
26
|
-
end
|