Skip to content

Commit

Permalink
Use subject and described_class in specs
Browse files Browse the repository at this point in the history
  • Loading branch information
alno committed Feb 22, 2016
1 parent ec12f4c commit 4ebd91f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 2 additions & 4 deletions spec/paginators/none_spec.rb
@@ -1,18 +1,16 @@
require "spec_helper"

describe Irwi::Paginators::None do
let(:p) { Irwi::Paginators::None.new }

specify "should paginate collection - call find" do
coll = double "Collection"
expect(coll).to receive(:all).and_return("full collection")

expect(p.paginate(coll, page: 10)).to eq("full collection")
expect(subject.paginate(coll, page: 10)).to eq("full collection")
end

specify "should render paginated section" do
a = nil
p.paginated_section "view", "collection" do
subject.paginated_section "view", "collection" do
a = true
end
expect(a).to be true
Expand Down
6 changes: 2 additions & 4 deletions spec/paginators/will_paginate_spec.rb
@@ -1,13 +1,11 @@
require "spec_helper"

describe Irwi::Paginators::WillPaginate do
let(:p) { Irwi::Paginators::WillPaginate.new }

specify "should paginate collection" do
coll = double "Collection"
expect(coll).to receive(:paginate).with(page: 15).and_return("paginated_collection")

expect(p.paginate(coll, page: 15)).to eq("paginated_collection")
expect(subject.paginate(coll, page: 15)).to eq("paginated_collection")
end

specify "should render paginated collection" do
Expand All @@ -16,6 +14,6 @@
view = double "View"
expect(view).to receive(:paginated_section).with(coll, &block).and_return("result")

expect(p.paginated_section(view, coll, &block)).to eq("result")
expect(subject.paginated_section(view, coll, &block)).to eq("result")
end
end
2 changes: 1 addition & 1 deletion spec/support/template_finder_spec.rb
Expand Up @@ -7,7 +7,7 @@
subject { Object.new }

before(:each) do
subject.send :extend, Irwi::Support::TemplateFinder
subject.send :extend, described_class

allow(subject).to receive(:controller_path).and_return('my_controller')
end
Expand Down

0 comments on commit 4ebd91f

Please sign in to comment.