docbrown/spec/requests/live_articles_spec.rb
Fabbri Paolo 89e893f157 Fix rubocop detected offenses (#4552)
* Run Inspecting 1050 files
....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C.....................................................................................................................................................................................................................................................................................................

Offenses:

spec/models/article_spec.rb:195:7: C: RSpec/NestedGroups: Maximum example group nesting exceeded [4/3]. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups)
      context "when description is empty" do
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1050 files inspected, 1 offense detected to fix autofixable errors

* Refactor  to correct test

it was braking the rule RSpec/NestedGroups: Maximum example group nesting exceeded [4/3]. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups)

* Run `rubocop --auto-gen-config` to regenrate `.rubocop_todo.yml`
2019-10-24 11:53:03 -04:00

22 lines
611 B
Ruby

require "rails_helper"
RSpec.describe "Live Articles", type: :request do
describe "GET /live_articles" do
it "returns no articles if none are live" do
get "/live_articles"
expect(response.body).to eq("{}")
end
it "returns a live article if it is live" do
article = create(:article, live_now: true)
get "/live_articles"
expect(response.body).to include(article.title)
end
it "returns a live event if it is live" do
event = create(:event, live_now: true)
get "/live_articles"
expect(response.body).to include(event.title)
end
end
end