Sha256: bd92bcb4e6b9cbe9b0ce4eb0967f3e09f0693cb4cefe5f4a9137414f9c454f80

Contents?: true

Size: 1.46 KB

Versions: 48

Compression:

Stored size: 1.46 KB

Contents

# -*- encoding : utf-8 -*-

describe Card::Set::Type::JavaScript do
  let(:js)                    { 'alert( "Hi" );'    }
  let(:compressed_js)         { 'alert("Hi");'      }
  let(:changed_js)            { 'alert( "Hello" );' }
  let(:compressed_changed_js) { 'alert("Hello");'   }

  def comment_with_source content, source="test javascript"
    "//#{source}\n#{content}"
  end

  it_behaves_like "content machine", that_produces: :js do
    let(:machine_card) do
      Card.gimme! "test javascript", type: :java_script, content: js
    end
    let(:card_content) do
      { in:          js,
        out:         comment_with_source(compressed_js),
        changed_in:  changed_js,
        changed_out: comment_with_source(compressed_changed_js) }
    end
  end

  it_behaves_like "machine input" do
    let(:create_machine_input_card) do
      Card.gimme! "test javascript", type: :java_script, content: js
    end
    let(:create_another_machine_input_card) do
      Card.gimme! "more javascript", type: :java_script, content: js
    end
    let(:create_machine_card) do
      Card.gimme! "script with js+*script", type: :pointer
    end
    let(:card_content) do
      { in:          js,
        out:         comment_with_source(compressed_js),
        changed_in:  changed_js,
        changed_out: comment_with_source(compressed_changed_js),
        added_out:   "//test javascript\n#{compressed_js}\n"\
                     "//more javascript\n#{compressed_js}" }
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
card-1.93.2 mod/machines/spec/set/type/javascript_spec.rb
card-1.93.1 mod/machines/spec/set/type/javascript_spec.rb
card-1.93.0 mod/machines/spec/set/type/javascript_spec.rb
card-1.92.2 mod/machines/spec/set/type/javascript_spec.rb
card-1.92.1 mod/machines/spec/set/type/javascript_spec.rb
card-1.92 mod/machines/spec/set/type/javascript_spec.rb
card-1.91 mod/machines/spec/set/type/javascript_spec.rb
card-1.21.0 mod/machines/spec/set/type/javascript_spec.rb