Sha256: c4561c0042c9165e0859e267d9f10a15aae33a4e98fd6b5910ee9b0ae2d29a48
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
require 'test_helper' module Garb module Management class SegmentTest < MiniTest::Unit::TestCase context "The Segment class" do should "turn entries for path into array of accounts" do feed = stub(:entries => ["entry1"]) Feed.stubs(:new).returns(feed) Segment.stubs(:new) Segment.all assert_received(Feed, :new) {|e| e.with(Session, '/segments')} assert_received(feed, :entries) assert_received(Segment, :new) {|e| e.with("entry1", Session)} end end context "A Segment" do setup do entry = { "link" => [{"rel" => "self", "href" => Feed::BASE_URL+"/segments/12"}], "dxp:segment" => { "id" => "gaid::-3", "name" => "Returning Visitor", "dxp:definition" => "ga:visitorType==Returning Visitor" } } entry = MultiJson.load(read_fixture("ga_segment_management.json"))["items"].first @segment = Segment.new(entry, Session) end should "have an id" do assert_equal "gaid::1", @segment.id end should "have a name" do assert_equal "derpy", @segment.name end should "have a definition" do assert_equal "ga:pagePath=@derpy", @segment.definition end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
garb-0.9.8 | test/unit/garb/management/segment_test.rb |
garb-0.9.7 | test/unit/garb/management/segment_test.rb |