Skip to content

Commit

Permalink
use a context block to make these spec lines < 100 chars
Browse files Browse the repository at this point in the history
* so that the quality specs continue to pass on this branch
  • Loading branch information
yob committed May 12, 2013
1 parent 852d8bd commit 3601d1e
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions spec/pages_strategy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,26 @@ class PDF::Reader::PagesStrategy
let(:object_hash) { PDF::Reader::ObjectHash.allocate }
let(:font) { PDF::Reader::Font.new(object_hash, {}) }

it "should send the correct callbacks when processing instructions containing a single text block" do

# mock up an object that will be called with callbacks. This will test that
# the content class correctly recognises all instructions
receiver = mock("receiver")
receiver.should_receive(:begin_text_object).once # BT
receiver.should_receive(:move_text_position).once # Td
receiver.should_receive(:set_text_font_and_size).once # Tf
receiver.should_receive(:set_text_rendering_mode).once # Tr
receiver.should_receive(:show_text).once # Tj
receiver.should_receive(:end_text_object).once # ET

# The instructions to test with
instructions = "BT\n 36.000 794.330 Td\n /F1 10.0 Tf\n 0 Tr\n (047174719X) Tj\n ET"

# process the instructions
content = PDF::Reader::PagesStrategy.new(nil, receiver)
content.content_stream(instructions, {:F1 => font})
context "processing instructions containing a single text block" do
it "should send the correct callbacks" do

# mock up an object that will be called with callbacks. This will test that
# the content class correctly recognises all instructions
receiver = mock("receiver")
receiver.should_receive(:begin_text_object).once # BT
receiver.should_receive(:move_text_position).once # Td
receiver.should_receive(:set_text_font_and_size).once # Tf
receiver.should_receive(:set_text_rendering_mode).once # Tr
receiver.should_receive(:show_text).once # Tj
receiver.should_receive(:end_text_object).once # ET

# The instructions to test with
instructions = "BT\n 36.000 794.330 Td\n /F1 10.0 Tf\n 0 Tr\n (047174719X) Tj\n ET"

# process the instructions
content = PDF::Reader::PagesStrategy.new(nil, receiver)
content.content_stream(instructions, {:F1 => font})
end
end

it "should send the correct callbacks when processing instructions containing 2 text blocks" do
Expand Down

0 comments on commit 3601d1e

Please sign in to comment.