Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 7aa7b4bd69fcb5aea453f46582b15b89 > files > 2

perl-DBD-Mock-1.450.0-2.mga3.src.rpm

%define upstream_name    DBD-Mock
%define upstream_version 1.45

Name:       perl-%{upstream_name}
Version:    %perl_convert_version %{upstream_version}
Release:    %mkrel 2

Summary:    Mock database driver for testing
License:    GPL+ or Artistic
Group:      Development/Perl
Url:        http://search.cpan.org/dist/%{upstream_name}
Source0:    http://www.cpan.org/modules/by-module/DBD/%{upstream_name}-%{upstream_version}.tar.gz

BuildRequires: perl(DBI) >= 1.300.0
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(Test::Exception) >= 0.310.0
BuildRequires: perl(Test::More) >= 0.470.0
BuildArch:  noarch

%description
Testing with databases can be tricky. If you are developing a system
married to a single database then you can make some assumptions about your
environment and ask the user to provide relevant connection information.
But if you need to test a framework that uses DBI, particularly a framework
that uses different types of persistence schemes, then it may be more
useful to simply verify what the framework is trying to do -- ensure the
right SQL is generated and that the correct parameters are bound.
'DBD::Mock' makes it easy to just modify your configuration (presumably
held outside your code) and just use it instead of 'DBD::Foo' (like the
DBD::Pg manpage or the DBD::mysql manpage) in your framework.

There is no distinct area where using this module makes sense. (Some people
may successfully argue that this is a solution looking for a problem...)
Indeed, if you can assume your users have something like the DBD::AnyData
manpage or the DBD::SQLite manpage or if you do not mind creating a
dependency on them then it makes far more sense to use these legitimate
driver implementations and test your application in the real world -- at
least as much of the real world as you can create in your tests...

And if your database handle exists as a package variable or something else
easily replaced at test-time then it may make more sense to use the
Test::MockObject manpage to create a fully dynamic handle. There is an
excellent article by chromatic about using the Test::MockObject manpage in
this and other ways, strongly recommended. (See the SEE ALSO manpage for a
link)

%prep
%setup -q -n %{upstream_name}-%{upstream_version}

%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%make

%check
make test

%install
%makeinstall_std

%files
%doc Changes META.json META.yml MYMETA.yml README
%{_mandir}/man3/*
%perl_vendorlib/DBD

%changelog

* Sun Jan 13 2013 umeabot <umeabot> 1.450.0-2.mga3
+ Revision: 365003
- Mass Rebuild - https://wiki.mageia.org/en/Feature:Mageia3MassRebuild

* Tue Nov 06 2012 jquelin <jquelin> 1.450.0-1.mga3
+ Revision: 314895
- update to 1.45

* Tue Aug 30 2011 jquelin <jquelin> 1.430.0-1.mga2
+ Revision: 136580
- update to 1.43
- update to 1.42

  + kharec <kharec>
    - update to 1.41

* Wed Jan 19 2011 jquelin <jquelin> 1.390.0-1.mga1
+ Revision: 23838
- cleaning spec file
- imported package perl-DBD-Mock