paginated_table 0.0.8 → 0.0.9

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.
@@ -2,7 +2,8 @@ require 'test_helper'
2
2
 
3
3
  module PaginatedTable
4
4
  describe TableDescription do
5
- let(:description) { TableDescription.new }
5
+ let(:options) { {} }
6
+ let(:description) { TableDescription.new(options) }
6
7
 
7
8
  describe "#column" do
8
9
  let(:row) { row = stub("row", :column => nil) }
@@ -56,9 +57,9 @@ module PaginatedTable
56
57
  describe "#row" do
57
58
  it "constructs a new RowDescription and appends it to the rows array" do
58
59
  row = stub("row")
59
- options = stub("options")
60
- RowDescription.stubs(:new).with(description, options, nil).returns(row)
61
- description.row(options)
60
+ row_options = stub("options")
61
+ RowDescription.stubs(:new).with(description, row_options, nil).returns(row)
62
+ description.row(row_options)
62
63
  description.rows.must_equal [row]
63
64
  end
64
65
  end
@@ -84,5 +85,12 @@ module PaginatedTable
84
85
  lambda { description.colspan(:foo) }.must_raise ArgumentError
85
86
  end
86
87
  end
88
+
89
+ describe "#model_label" do
90
+ it "returns the model_label option" do
91
+ options[:model_label] = model_label = stub("model_label")
92
+ description.model_label.must_equal model_label
93
+ end
94
+ end
87
95
  end
88
96
  end
@@ -36,7 +36,10 @@ module PaginatedTable
36
36
 
37
37
  describe "#render_pagination_info" do
38
38
  it "makes a div.info with the page_entries_info from will_paginate" do
39
- view.stubs(:page_entries_info).with(data).returns("<info/>")
39
+ model_label = stub("model_label")
40
+ description.stubs(:model_label).returns(model_label)
41
+ view.stubs(:page_entries_info).with(data, :model => model_label).
42
+ returns("<info/>")
40
43
  view.expects(:content_tag).with('div', "<info/>", :class => 'info')
41
44
  table.render_pagination_info
42
45
  end
@@ -9,6 +9,7 @@ module PaginatedTable
9
9
  view.stubs("params" => params)
10
10
  view
11
11
  }
12
+ let(:options) { stub("options") }
12
13
  let(:page) { stub("page") }
13
14
  let(:data_page) { stub("data_page", :page => page) }
14
15
  let(:description_block) { lambda {} }
@@ -16,7 +17,8 @@ module PaginatedTable
16
17
  describe "#paginated_table" do
17
18
  it "renders a table" do
18
19
  table_description = stub("table_description")
19
- TableDescription.stubs("new").with(description_block).returns(table_description)
20
+ TableDescription.stubs("new").with(options, description_block).
21
+ returns(table_description)
20
22
  link_renderer = stub("link_renderer")
21
23
  LinkRenderer.stubs("new").with(page).returns(link_renderer)
22
24
  table_renderer = stub("table_renderer")
@@ -24,7 +26,7 @@ module PaginatedTable
24
26
  with(view, table_description, data_page, link_renderer).
25
27
  returns(table_renderer)
26
28
  table_renderer.expects("render")
27
- view.paginated_table(data_page, &description_block)
29
+ view.paginated_table(data_page, options, &description_block)
28
30
  end
29
31
  end
30
32
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paginated_table
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Donald Ball
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-14 00:00:00 Z
18
+ date: 2012-05-16 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement