This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/features/view_specs/view_spec.feature b/features/view_specs/view_spec.feature | |
index e85c306..6534c30 100644 | |
--- a/features/view_specs/view_spec.feature | |
+++ b/features/view_specs/view_spec.feature | |
@@ -152,3 +152,34 @@ Feature: view spec | |
""" | |
When I run "rspec spec/views" | |
Then the output should contain "1 example, 0 failures" | |
+ | |
+ Scenario: spec with view that accesses helper_method helpers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
class Bar; end | |
end | |
anonymous_sub = Class.new(Foo) do | |
def check | |
Bar | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyModule | |
SUBTESTS = %w[foo bar baz] | |
end | |
describe "#add_question_set_of_type" do | |
MyModule::SUBTESTS.each do |subtest| | |
describe %Q("#{subtest}") do | |
let(:subtest) { "#{subtest} in let" } | |
before { @subtest = "#{subtest} in before" } | |
it "does something" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shared_examples_for "a measurable object" do |measurement_method, measurement| | |
it "should return #{measurement} from ##{measurement_method}" do | |
subject.send(measurement_method).should == measurement | |
end | |
end | |
describe Array do | |
it_should_behave_like "a measurable object", :size, 2 do | |
subject { [2, 13] } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe CfgInterface do | |
fixtures :cfg_entities, :cfg_entity_attributes, :cfg_interfaces, :cfg_intf_filters | |
it "should return a hash with filter parameters" do | |
filters_hash = CfgInterface.filters_hash_for('CONS_ALL_ACCOUNT') | |
filters_hash.should have(2).entries | |
filters_hash['description'].should eql('ach_accounts.description') | |
filters_hash['id_param'].should eql('ach_accounts.id') | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.configure do |c| | |
c.around do |example| | |
orig_env = ENV | |
example.run | |
ENV.clear | |
ENV.merge(orig_env) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClassProjectsController < ApplicationController | |
def new | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe SomeClass do | |
freeze { 1.day.from_now } | |
it "does some stuff with time" do | |
end | |
end | |
# this actually does... | |
describe SomeClass do | |
around { |example| Timecop.freeze(1.day.from_now, &example) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spec::Matchers.define :eq do |expected| | |
match do |actual| | |
actual == expected | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby-1.9.2-p0 > class Foo; end | |
#=> nil | |
ruby-1.9.2-p0 > Foo.new('bar') | |
#=> #<Foo:0x00000100974e50> | |
ruby-1.9.2-p0 > class Foo; end | |
=> nil | |
ruby-1.9.2-p0 > Foo.new(1,2) | |
=> #<Foo:0x000001009dd4a0> | |
ruby-1.9.2-p0 > Foo.new(1,2,3, :a => 'b') | |
=> #<Foo:0x0000010181b918> |