summaryrefslogtreecommitdiff
path: root/qa/spec/scenario/actable_spec.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-02-20 12:45:04 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-09 10:36:27 +0100
commit7d20e47622c9a6e0a780bdbe9b53c8890c00deba (patch)
tree9650b8b1d1edde4b92a748a9ee9ab5c4e4c1ba5c /qa/spec/scenario/actable_spec.rb
parent72e940df2c24ab80056dfe296011c7a44ebdf3f0 (diff)
downloadgitlab-ce-7d20e47622c9a6e0a780bdbe9b53c8890c00deba.tar.gz
Add GitLab QA integrations tests to GitLab CE / EE
Diffstat (limited to 'qa/spec/scenario/actable_spec.rb')
-rw-r--r--qa/spec/scenario/actable_spec.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/qa/spec/scenario/actable_spec.rb b/qa/spec/scenario/actable_spec.rb
new file mode 100644
index 00000000000..422763910e4
--- /dev/null
+++ b/qa/spec/scenario/actable_spec.rb
@@ -0,0 +1,47 @@
+describe QA::Scenario::Actable do
+ subject do
+ Class.new do
+ include QA::Scenario::Actable
+
+ attr_accessor :something
+
+ def do_something(arg = nil)
+ "some#{arg}"
+ end
+ end
+ end
+
+ describe '.act' do
+ it 'provides means to run steps' do
+ result = subject.act { do_something }
+
+ expect(result).to eq 'some'
+ end
+
+ it 'supports passing variables' do
+ result = subject.act('thing') do |variable|
+ do_something(variable)
+ end
+
+ expect(result).to eq 'something'
+ end
+
+ it 'returns value from the last method' do
+ result = subject.act { 'test' }
+
+ expect(result).to eq 'test'
+ end
+ end
+
+ describe '.perform' do
+ it 'makes it possible to pass binding' do
+ variable = 'something'
+
+ result = subject.perform do |object|
+ object.something = variable
+ end
+
+ expect(result).to eq 'something'
+ end
+ end
+end