|
305 | 305 | specify {is_expected.to include(:author, :age, :name, :description, :updated, :created, :title, :price, :date)} |
306 | 306 | end |
307 | 307 |
|
| 308 | + describe "#variable_names=" do |
| 309 | + it "can set variable names from constants" do |
| 310 | + solutions.variable_names = %i{author age foo} |
| 311 | + expect(solutions.variable_names).to include(:author, :age, :foo) |
| 312 | + expect(solutions.variable_names).not_to include(:name) |
| 313 | + end |
| 314 | + |
| 315 | + it "can set variable names from variables" do |
| 316 | + solutions.variable_names = %w{author age foo}.map {|n| RDF::Query::Variable.new(n)} |
| 317 | + expect(solutions.variable_names).to include(:author, :age, :foo) |
| 318 | + expect(solutions.variable_names).not_to include(:name) |
| 319 | + end |
| 320 | + end |
| 321 | + |
308 | 322 | describe "#count" do |
309 | 323 | its(:count) {is_expected.to eq 2} |
310 | 324 | it "Counting the number of matching solutions" do |
|
318 | 332 | end |
319 | 333 | end |
320 | 334 |
|
| 335 | + describe "#eql?" do |
| 336 | + it "is true for equivalent solutions" do |
| 337 | + expect(solutions).to eql solutions.dup |
| 338 | + end |
| 339 | + |
| 340 | + it "is false for different solutions" do |
| 341 | + solns2 = RDF::Query::Solutions(uri) |
| 342 | + expect(solutions).not_to eql solns2 |
| 343 | + end |
| 344 | + |
| 345 | + it "is false for the same solution with different variable_names" do |
| 346 | + solns2 = solutions.dup |
| 347 | + solns2.variable_names = %i{foo bar} |
| 348 | + expect(solutions).not_to eql solns2 |
| 349 | + end |
| 350 | + end |
| 351 | + |
| 352 | + describe "#==" do |
| 353 | + it "is true for equivalent solutions" do |
| 354 | + expect(solutions).to eq solutions.dup |
| 355 | + end |
| 356 | + |
| 357 | + it "is false for different solutions" do |
| 358 | + solns2 = RDF::Query::Solutions(uri) |
| 359 | + expect(solutions).not_to eq solns2 |
| 360 | + end |
| 361 | + |
| 362 | + it "is false for the same solution with different variable_names" do |
| 363 | + solns2 = solutions.dup |
| 364 | + solns2.variable_names = %i{foo bar} |
| 365 | + expect(solutions).not_to eq solns2 |
| 366 | + end |
| 367 | + end |
| 368 | + |
321 | 369 | describe "#bindings" do |
322 | 370 | subject { |
323 | 371 | RDF::Query::Solutions( |
|
0 commit comments