Sha256: 9ebbee3de72883fcf69f09562c7d2d0fcb9c7eb6e63c0aea75cb8392fa574474

Contents?: true

Size: 979 Bytes

Versions: 7

Compression:

Stored size: 979 Bytes

Contents

require 'spec_helper'

describe Oplop do
  
  describe ".password" do

    specify "valid arguments" do
      lambda{ Oplop.password(:master => "a", :label => "a") }.should_not raise_error(ArgumentError)
    end

    specify "invalid arguments" do
      lambda{ Oplop.password }.should raise_error(ArgumentError, /Master and label are required/)
    end

    specify "invalid arguments" do
      lambda{ Oplop.password(:master => "a", :label => "b", :foo => 'c') }.should raise_error(ArgumentError, /Unknown key/)
    end

    context "tests from testdata.json (see Python implementation at http://code.google.com/p/oplop/)" do

      # loop around each "case" in testdata.yml
      Yajl::Parser.new.parse(File.new(File.dirname(__FILE__) + "/testdata.json", 'r')).each do |testdata|

        specify testdata["why"] do
          Oplop.password(:master => testdata["master"], :label => testdata["label"]).should == testdata["password"]
        end

      end

    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
oplop-0.0.7 spec/oplop_spec.rb
oplop-0.0.6 spec/oplop_spec.rb
oplop-0.0.5 spec/oplop_spec.rb
oplop-0.0.4 spec/oplop_spec.rb
oplop-0.0.3 spec/oplop_spec.rb
oplop-0.0.2 spec/oplop_spec.rb
oplop-0.0.1 spec/oplop_spec.rb