Skip to content

Commit

Permalink
Merge pull request #240 from ryanfox1985/development
Browse files Browse the repository at this point in the history
Refactor.
  • Loading branch information
leikind committed Jul 16, 2015
2 parents f5ec0fe + 2d7739c commit ca64889
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/wice/grid_output_buffer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ def filter_for(detach_with_id)
fail WiceGridException.new("No filter with Detached ID '#{detach_with_id}'!")
end
end
if @filters[detach_with_id] == false

unless @filters[detach_with_id]
fail WiceGridException.new("Filter with Detached ID '#{detach_with_id}' has already been requested once! There cannot be two instances of the same filter on one page")
end

res = @filters[detach_with_id]
@filters[detach_with_id] = false
res
Expand Down
7 changes: 7 additions & 0 deletions spec/wice/lib/grid_output_buffer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,12 @@ module Wice

expect { grid.filter_for('key') }.to raise_error
end

it 'should filter_for return empty string' do
grid = GridOutputBuffer.new
grid.return_empty_strings_for_nonexistent_filters = true

expect(grid.filter_for('key')).to eq('')
end
end
end

0 comments on commit ca64889

Please sign in to comment.