spec/user_spec.rb in amee-3.2.1 vs spec/user_spec.rb in amee-4.0.0
- old
+ new
@@ -1,9 +1,9 @@
# Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
# Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.
-require File.dirname(__FILE__) + '/spec_helper.rb'
+require 'spec_helper.rb'
describe AMEE::Admin::User do
before(:each) do
@user = AMEE::Admin::User.new
@@ -87,11 +87,11 @@
@data.created.should == DateTime.new(2009,9,11,16,41,16)
@data.modified.should == DateTime.new(2009,9,11,16,41,16)
@data.username.should == @options[:username]
@data.name.should == @options[:name]
@data.email.should == @options[:email]
- @data.api_version.should be_close(@options[:apiVersion], 1e-9)
+ @data.api_version.should be_within(1.0e-09).of(@options[:apiVersion])
@data.status.should == "ACTIVE"
end
it "should parse JSON correctly" do
connection = flexmock "connection"
@@ -101,11 +101,11 @@
@data.created.should == DateTime.new(2009,9,11,15,29,42)
@data.modified.should == DateTime.new(2009,9,11,15,29,42)
@data.username.should == @options[:username]
@data.name.should == @options[:name]
@data.email.should == @options[:email]
- @data.api_version.should be_close(@options[:apiVersion], 1e-9)
+ @data.api_version.should be_within(1.0e-09).of(@options[:apiVersion])
@data.status.should == "ACTIVE"
end
it "should fail gracefully with incorrect data" do
connection = flexmock "connection"
@@ -136,11 +136,11 @@
@new_data = @data.update(@new_options)
@new_data.created.should_not == @new_data.modified.should
@new_data.username.should == @new_options[:username]
@new_data.name.should == @new_options[:name]
@new_data.email.should == @new_options[:email]
- @new_data.api_version.should be_close(@new_options[:APIVersion],1e-9)
+ @new_data.api_version.should be_within(1.0e-09).of(@new_options[:APIVersion])
end
it "can delete an existing user" do
connection = flexmock "connection"
connection.should_receive(:get).with(@changed_path, {}).and_return(flexmock(:body => '<?xml version="1.0" encoding="UTF-8" standalone="no"?><Resources><UserResource><Environment uid="5F5887BCF726"/><User created="2009-09-11 16:41:16.0" modified="2009-09-11 16:55:14.0" uid="65ED20D9C5EF"><Status>ACTIVE</Status><Type>STANDARD</Type><GroupNames/><ApiVersion>2.0</ApiVersion><Locale>en_GB</Locale><Name>Test User created by Ruby Gem, then changed</Name><Username>_rubytest</Username><Email>ruby_changed@amee.cc</Email><Environment uid="5F5887BCF726"/></User></UserResource></Resources>'))
@@ -187,11 +187,11 @@
@data.created.should == DateTime.new(2009,9,11,16,41,16)
@data.modified.should == DateTime.new(2009,9,11,16,41,16)
@data.username.should == @options[:username]
@data.name.should == @options[:name]
@data.email.should == @options[:email]
- @data.api_version.should be_close(@options[:apiVersion], 1e-9)
+ @data.api_version.should be_within(1.0e-09).of(@options[:apiVersion])
@data.status.should == "ACTIVE"
end
it "should parse JSON correctly" do
connection = flexmock "connection"
@@ -201,11 +201,11 @@
@data.created.should == DateTime.new(2009,9,11,15,29,42)
@data.modified.should == DateTime.new(2009,9,11,15,29,42)
@data.username.should == @options[:username]
@data.name.should == @options[:name]
@data.email.should == @options[:email]
- @data.api_version.should be_close(@options[:apiVersion], 1e-9)
+ @data.api_version.should be_within(1.0e-09).of(@options[:apiVersion])
@data.status.should == "ACTIVE"
end
it "should fail gracefully with incorrect data" do
connection = flexmock "connection"
@@ -236,10 +236,10 @@
@new_data = @data.update(@new_options)
@new_data.created.should_not == @new_data.modified.should
@new_data.username.should == @new_options[:username]
@new_data.name.should == @new_options[:name]
@new_data.email.should == @new_options[:email]
- @new_data.api_version.should be_close(@new_options[:APIVersion],1e-9)
+ @new_data.api_version.should be_within(1.0e-09).of(@new_options[:APIVersion])
end
it "can delete an existing user" do
connection = flexmock "connection"
connection.should_receive(:get).with(@changed_path, {}).and_return(flexmock(:body => '<?xml version="1.0" encoding="UTF-8" standalone="no"?><Resources><UserResource><Environment uid="5F5887BCF726"/><User created="2009-09-11 16:41:16.0" modified="2009-09-11 16:55:14.0" uid="65ED20D9C5EF"><Status>ACTIVE</Status><Type>STANDARD</Type><GroupNames/><ApiVersion>2.0</ApiVersion><Locale>en_GB</Locale><Name>Test User created by Ruby Gem, then changed</Name><Username>_rubytest</Username><Email>ruby_changed@amee.cc</Email><Environment uid="5F5887BCF726"/></User></UserResource></Resources>'))
\ No newline at end of file