How to use asset_name method of Konacha Package

Best Konacha code snippet using Konacha.asset_name

spec_spec.rb

Source:spec_spec.rb Github

copy

Full Screen

1require 'spec_helper'2describe Konacha::Spec do3 describe "#asset_name" do4 it "is the asset_name of the path" do5 described_class.new("array_spec.js").asset_name.should == "array_spec"6 described_class.new("array_spec.coffee").asset_name.should == "array_spec"7 end8 it "ignores multiple extensions" do9 described_class.new("array_spec.js.coffee").asset_name.should == "array_spec"10 end11 it "includes relative path" do12 described_class.new("subdirectory/array_spec.js").asset_name.should == "subdirectory/array_spec"13 end14 end15 describe ".all" do16 it "returns an array of specs" do17 Konacha.should_receive(:spec_paths) { ["a_spec.js", "b_spec.js"] }18 all = described_class.all19 all.length.should == 220 end21 it "returns specs passed via the ENV['spec'] parameter" do22 ENV["SPEC"] = "foo_spec,bar_spec,baz_spec"23 all = described_class.all24 all.length.should == 325 paths = all.map {|p| p.path}26 paths =~ %w{foo_spec bar_spec baz_spec}27 ENV["SPEC"] = nil28 end29 it "returns all Specs if given an empty path" do30 all = ["a_spec.js", "b_spec.js"]31 Konacha.should_receive(:spec_paths) { all }32 described_class.all("").map(&:path).should == all33 end34 it "returns an array containing the Spec with the given asset_name" do35 all = ["a_spec.js", "b_spec.js"]36 Konacha.should_receive(:spec_paths) { all }37 described_class.all("b_spec").map(&:path).should == [all[1]]38 end39 it "returns Specs that are children of the given path" do40 all = ["a/a_spec_1.js", "a/a_spec_2.js", "b/b_spec.js"]41 Konacha.should_receive(:spec_paths) { all }42 described_class.all("a").map(&:path).should == all[0..1]43 end44 it "raises NotFound if no Specs match" do45 Konacha.should_receive(:spec_paths) { [] }46 expect { described_class.all("b_spec") }.to raise_error(Konacha::Spec::NotFound)47 end48 end...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful