Skip to content

Commit

Permalink
Refactor Prawn::Text::Formatted::Arranger#preview_next_string specs
Browse files Browse the repository at this point in the history
  • Loading branch information
packetmonkey committed Jul 30, 2015
1 parent fbe148b commit 13efc9a
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions spec/formatted_text_arranger_spec.rb
Expand Up @@ -36,25 +36,27 @@
expect(subject.unconsumed[3]).to eq(text: "world")
end
end
end

describe "Core::Text::Formatted::Arranger#preview_next_string" do
it "should not populate the consumed array" do
create_pdf
arranger = Prawn::Text::Formatted::Arranger.new(@pdf)
array = [{ :text => "hello" }]
arranger.format_array = array
arranger.preview_next_string
expect(arranger.consumed).to eq([])
end
it "should not consumed array" do
create_pdf
arranger = Prawn::Text::Formatted::Arranger.new(@pdf)
array = [{ :text => "hello" }]
arranger.format_array = array
expect(arranger.preview_next_string).to eq("hello")
describe '#preview_next_string' do
context 'with a formatted array' do
let(:array) { [{text: 'hello' }] }

before do
subject.format_array = array
end

it 'does not populate the consumed array' do
subject.preview_next_string
expect(subject.consumed).to eq([])
end

it 'returns the text of the next unconsumed hash' do
expect(subject.preview_next_string).to eq("hello")
end
end
end
end

describe "Core::Text::Formatted::Arranger#next_string" do
before(:each) do
create_pdf
Expand Down

0 comments on commit 13efc9a

Please sign in to comment.