Commit abfab627 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Ignore the order of mixins in tests.

When auto-detecting mixins from code that has:

    mixins: {
        foo: "Some.Class",
	bar: "Other.Class"
    }

we are converting the JavaScript object to Ruby hash - but that means
the order becomes non-deterministing.  This resulted in tests checking
the list of mixins to be flaky as they expected a certain order.  But we
really don't care about the order, so I convert arrays to Sets and compere
these.
parent 01bd04b6
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ describe JsDuck::Aggregator do
      @doc[:extends].should == "Your.Class"
    end
    it "detects mixins" do
      @doc[:mixins].should == ["Foo.Mixin", "Bar.Mixin"]
      Set.new(@doc[:mixins]).should == Set.new(["Foo.Mixin", "Bar.Mixin"])
    end
    it "detects alternate class names" do
      @doc[:alternateClassNames].should == ["AltClass"]
@@ -88,7 +88,7 @@ describe JsDuck::Aggregator do

    it_should_behave_like "class"
    it "collects all mixins together" do
      @doc[:mixins].should == ["My.Mixin", "Your.Mixin", "Other.Mixin"]
      Set.new(@doc[:mixins]).should == Set.new(["My.Mixin", "Your.Mixin", "Other.Mixin"])
    end
  end

@@ -167,7 +167,7 @@ describe JsDuck::Aggregator do
      @doc[:extends].should == "Your.Class"
    end
    it "detects implied mixins" do
      @doc[:mixins].should == ["Ext.util.Observable", "Foo.Bar"]
      Set.new(@doc[:mixins]).should == Set.new(["Ext.util.Observable", "Foo.Bar"])
    end
    it "detects implied alternateClassNames" do
      @doc[:alternateClassNames].should == ["JustClass"]
+3 −3
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ describe "JsDuck::Ast detects class with" do

  describe "mixins in" do
    it "Ext.define() with mixins as string" do
      detect(<<-EOS)[:mixins].should == ["Some.Class", "Other.Class"]
      Set.new(detect(<<-EOS)[:mixins]).should == Set.new(["Some.Class", "Other.Class"])
        /** */
        Ext.define('MyClass', {
            mixins: ["Some.Class", "Other.Class"]
@@ -182,7 +182,7 @@ describe "JsDuck::Ast detects class with" do
    end

    it "Ext.define() with mixins as array of strings" do
      detect(<<-EOS)[:mixins].should == ["Other.Class"]
      Set.new(detect(<<-EOS)[:mixins]).should == Set.new(["Other.Class"])
        /** */
        Ext.define('MyClass', {
            mixins: "Other.Class"
@@ -191,7 +191,7 @@ describe "JsDuck::Ast detects class with" do
    end

    it "Ext.define() with mixins as object" do
      detect(<<-EOS)[:mixins].should == ["Some.Class", "Other.Class"]
      Set.new(detect(<<-EOS)[:mixins]).should == Set.new(["Some.Class", "Other.Class"])
        /** */
        Ext.define('MyClass', {
            mixins: {