Sha256: 7ca82bb89df5ad97b7a3c1b1d96a3fd9926bb1bb3919451a0abae7405867642a

Contents?: true

Size: 1.17 KB

Versions: 24

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe Marty::RpcController do
  before(:each) { @routes = Marty::Engine.routes }

  before(:each) {
    @tags = []
    @tags << Marty::Script.load_script_bodies({
                         "A" => "A:\n    a = 1\n",
                         "B" => "B:\n    b = 0\n",
                       }, Date.today)

    @tags << Marty::Script.load_script_bodies({
                         "B" => "import A\nB:\n    b = A::A().a\n",
                       }, Date.today + 1.minute)

    @tags << Marty::Script.load_script_bodies({
                         "A" => "A:\n    a = 2\n",
                       }, Date.today + 2.minute)


    # create an untagged version for DEV
    s = Marty::Script.lookup('infinity', "A")
    s.body = "A:\n    a = 3\n"
    s.save!
  }

  let(:tags) { @tags }

  it "should properly import different versions of a script" do
    # try the test 3 times for fun
    (0..2).each {
      tags.each_with_index { |t, i|
        get 'evaluate', {
              format: :json,
              script: "B",
              node: "B",
              attrs: "b",
              tag: t.name,
            }
        response.body.should == i.to_json
      }
    }
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
marty-1.2.9 spec/controllers/rpc_import_spec.rb
marty-1.2.8 spec/controllers/rpc_import_spec.rb
marty-1.2.7 spec/controllers/rpc_import_spec.rb
marty-1.2.6 spec/controllers/rpc_import_spec.rb
marty-1.2.5 spec/controllers/rpc_import_spec.rb
marty-1.2.4 spec/controllers/rpc_import_spec.rb
marty-1.2.3 spec/controllers/rpc_import_spec.rb
marty-1.2.2 spec/controllers/rpc_import_spec.rb
marty-1.2.1 spec/controllers/rpc_import_spec.rb
marty-1.2.0 spec/controllers/rpc_import_spec.rb
marty-1.1.9 spec/controllers/rpc_import_spec.rb
marty-1.1.8 spec/controllers/rpc_import_spec.rb
marty-1.1.7 spec/controllers/rpc_import_spec.rb
marty-1.1.6 spec/controllers/rpc_import_spec.rb
marty-1.1.5 spec/controllers/rpc_import_spec.rb
marty-1.1.4 spec/controllers/rpc_import_spec.rb
marty-1.1.3 spec/controllers/rpc_import_spec.rb
marty-1.1.2 spec/controllers/rpc_import_spec.rb
marty-1.1.1 spec/controllers/rpc_import_spec.rb
marty-1.0.54 spec/controllers/rpc_import_spec.rb