Sha256: 29b3e377dadac8a44c5152f4b53c768000ab6784a712f4c4e4ea7c9060b87b34

Contents?: true

Size: 735 Bytes

Versions: 6

Compression:

Stored size: 735 Bytes

Contents

require 'spec_helper'

describe Nyaplot::Frame do

  before(:all) do
    @frame = Nyaplot::Frame.new
    @plot = Nyaplot::Plot.new
    @plot.add(:scatter, [0,1,2], [0,1,2])
  end

  context ".add" do
    it "reflect the result to exported JSON" do
      @frame.add(@plot)
      expect(JSON.parse(@frame.to_json)[:panes] != []).to eq(true)
    end
  end

  context ".generate_body" do
    it "should return correct html" do
      html = @frame.generate_body
      if_brackets_is_same_number = [[/<html(.*?)>/,"</html>"],[/<script(.*?)>/,"</script>"],[/<body(.*?)>/,"</body>"]].all? do |pair|
        html.scan(pair[0]).length == html.scan(pair[1]).length
      end
      expect(if_brackets_is_same_number).to eq(true)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nyaplot-0.1.6 spec/nyaplot/frame_spec.rb
nyaplot-0.1.5 spec/nyaplot/frame_spec.rb
nyaplot-0.1.4 spec/nyaplot/frame_spec.rb
nyaplot-0.2.0.rc1 spec/nyaplot/frame_spec.rb
nyaplot-0.1.3 spec/nyaplot/frame_spec.rb
nyaplot-0.1.2 spec/nyaplot/frame_spec.rb